#!/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 # 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 <=16 since these files are upstart-specific anyway rm -f ${vdir}/etc/event.d/tty[23456] cd -