X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=config.nornet%2Fsliceimage.post;fp=config.nornet%2Fsliceimage.post;h=5a145e2e727ac4a2c267bcb8786f49699cb9bc49;hb=a561da515a8c0895700fb5af968b74c16b72ab54;hp=0000000000000000000000000000000000000000;hpb=eb767bfbb96f784a174224120b66d4d9134bfdeb;p=build.git diff --git a/config.nornet/sliceimage.post b/config.nornet/sliceimage.post new file mode 100644 index 00000000..5a145e2e --- /dev/null +++ b/config.nornet/sliceimage.post @@ -0,0 +1,34 @@ +#!/bin/bash + +vdir=$1 + +if [ -z "${vdir}" ] ; then + echo "ERROR: $0" + echo "Provide the directory of the root filesystem to operate on" + exit +fi + +# reset root password to be empty +echo "in slice image: resetting root password" +sed -i -e "s/root:[\*|x]/root:/" ${vdir}/etc/passwd + +# modify the sudoers file to remove the 'requiretty' attribute +echo "in slice image: removing requiretty from /etc/sudoers" +sed -i -e 's,^\(Defaults.*requiretty\),#\1,' ${vdir}/etc/sudoers + +# make sure we do not end up with an empty /selinux +# libvirt gets all confused when that happens +cd ${vdir} +if [ -d selinux ] ; then + if [ "$(ls -A selinux)" ] ; then + echo "sliceimage.post: WARNING: ${vdir}/selinux is not empty - preserving" + else + echo "sliceimage.post: REMOVING empty ${vdir}/selinux" + rmdir selinux + fi +fi + +# for when runing under lxc, make sure we don't try to fsck from a slice +sed -i -e 's,1 1,0 0,' ${vdir}/etc/fstab + +cd -