5 if [ -z "${vdir}" ] ; then
7 echo "Provide the directory of the root filesystem to operate on"
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
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
19 # Fix up /etc/init.d/halt
20 # xxx this would be wrong in f>=16 because there's no /sbin anymore
21 # but I suspect this is for vserver only..
22 echo "* in slice image: fixing /etc/init.d/halt"
23 cat > ${vdir}/etc/init.d/halt <<EOF
25 exec /sbin/killall5 -15
28 # make sure we do not end up with an empty /selinux
29 # libvirt gets all confused when that happens
31 if [ -d selinux ] ; then
32 if [ "$(ls -A selinux)" ] ; then
33 echo "* sliceimage.post: WARNING: ${vdir}/selinux is not empty - preserving"
35 echo "* sliceimage.post: REMOVING empty ${vdir}/selinux"
40 # for when runing under lxc, make sure we don't try to fsck from a slice
41 sed -i -e 's,1 1,0 0,' ${vdir}/etc/fstab
43 # a workaround for running f12 slices under f18; as per Andy findings, we
44 # remove /etc/event.d/tty[23456] inside the slice image
45 # this is not required in f>=16 since these files are upstart-specific anyway
46 rm -f ${vdir}/etc/event.d/tty[23456]
48 # mid 2015 (I know..) : fix for fedora 14 slices
49 # use fedora's archive, and other yum-related issues
50 if [[ "$vdir" =~ .*f14.* ]] ; then
51 echo "* sliceimage.post: rectifying fedora14 slice image with fedora-release-14-2.noarch.rpm"
52 rpm --root=$vdir -U http://mirror.onelab.eu/third-party/fedora-release-14-2.noarch.rpm