From 340a8974a25b3e776269e5fe3202a52645de759b Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Mon, 29 Apr 2013 22:01:04 -0400 Subject: [PATCH] add sliceimage post for mlab --- config.mlab/sliceimage.post | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 config.mlab/sliceimage.post diff --git a/config.mlab/sliceimage.post b/config.mlab/sliceimage.post new file mode 100644 index 00000000..262a2ffe --- /dev/null +++ b/config.mlab/sliceimage.post @@ -0,0 +1,44 @@ +#!/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 + +# disable Upstart by creating a symlink to /bin/true +#mv ${vdir}/sbin/initctl ${vdir}/sbin/initctl.orig +chroot ${vdir} mv /sbin/initctl /sbin/initctl.orig +chroot ${vdir} ln /bin/true /sbin/initctl + +# Fix up /etc/init.d/halt +# xxx this would be wrong in f>=16 because there's no /sbin anymore +# but I suspect this is for vserver only.. +echo "in slice image: fixing /etc/init.d/halt" +cat > ${vdir}/etc/init.d/halt <