refine strategy to spot ip address, keep on calling guest_ipv4
[build.git] / config.lxc / sliceimage.post
1 #!/bin/bash
2
3 vdir=$1
4
5 if [ -z "${vdir}" ] ; then
6         echo "ERROR: $0"
7         echo "Provide the directory of the root filesystem to operate on"
8         exit
9 fi
10
11 # reset root password to be empty
12 echo "in slice image: resetting root password"
13 sed -i -e "s/root:[\*|x]/root:/" ${vdir}/etc/passwd
14
15 # modify the sudoers file to remove the 'requiretty' attribute
16 echo "in slice image: removing requiretty from /etc/sudoers"
17 sed -i -e 's,^\(Defaults.*requiretty\),#\1,' ${vdir}/etc/sudoers
18
19 # make sure we do not end up with an empty /selinux 
20 # libvirt gets all confused when that happens
21 cd ${vdir}
22 if [ -d selinux ] ; then
23     if [ "$(ls -A selinux)" ] ; then
24         echo "sliceimage.post: WARNING: ${vdir}/selinux is not empty - preserving"
25     else
26         echo "sliceimage.post: REMOVING empty ${vdir}/selinux"
27         rmdir selinux
28     fi
29 fi
30
31 # for when runing under lxc, make sure we don't try to fsck from a slice
32 sed -i -e 's,1 1,0 0,' ${vdir}/etc/fstab
33
34 cd -