From: Christian Hofstaedtler Date: Sun, 11 Dec 2011 17:56:39 +0000 (+0100) Subject: Make username replacement in inittab more robust X-Git-Tag: v0.17.1~56 X-Git-Url: https://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=352c82226ec5489438b7066db702fb31aa5c68a3 Make username replacement in inittab more robust inittab is shipped by grml-live for a while, so we can stop playing tricks for replacing the username. --- diff --git a/etc/grml/fai/config/files/etc/inittab/GRMLBASE b/etc/grml/fai/config/files/etc/inittab/GRMLBASE index 4b80155..7e49dba 100644 --- a/etc/grml/fai/config/files/etc/inittab/GRMLBASE +++ b/etc/grml/fai/config/files/etc/inittab/GRMLBASE @@ -59,9 +59,9 @@ po::powerokwait:/etc/init.d/powerfail stop 1:12345:respawn:/sbin/grml-runtty /dev/tty1 /usr/share/grml-scripts/run-welcome root 2:2345:respawn:/sbin/grml-runtty /dev/tty2 /usr/share/grml-scripts/run-screen root 3:2345:respawn:/sbin/grml-runtty /dev/tty3 /usr/share/grml-scripts/run-screen root -4:2345:respawn:/sbin/grml-runtty /dev/tty4 /usr/share/grml-scripts/run-screen grml -5:2345:respawn:/sbin/grml-runtty /dev/tty5 /bin/zsh grml -6:2345:respawn:/sbin/grml-runtty /dev/tty6 /bin/zsh grml +4:2345:respawn:/sbin/grml-runtty /dev/tty4 /usr/share/grml-scripts/run-screen $USERNAME +5:2345:respawn:/sbin/grml-runtty /dev/tty5 /bin/zsh $USERNAME +6:2345:respawn:/sbin/grml-runtty /dev/tty6 /bin/zsh $USERNAME 9:2345:respawn:/sbin/getty 38400 tty9 #10:2345:respawn:/sbin/grml-runtty /dev/tty10 /usr/sbin/grml-iptstate root 11:2345:respawn:/sbin/grml-runtty /dev/tty11 /usr/bin/htop root diff --git a/etc/grml/fai/config/files/etc/inittab/GRML_SMALL b/etc/grml/fai/config/files/etc/inittab/GRML_SMALL index f3147e5..09f48eb 100644 --- a/etc/grml/fai/config/files/etc/inittab/GRML_SMALL +++ b/etc/grml/fai/config/files/etc/inittab/GRML_SMALL @@ -59,9 +59,9 @@ po::powerokwait:/etc/init.d/powerfail stop 1:12345:respawn:/sbin/grml-runtty /dev/tty1 /usr/share/grml-scripts/run-welcome root 2:2345:respawn:/sbin/grml-runtty /dev/tty2 /usr/share/grml-scripts/run-screen root 3:2345:respawn:/sbin/grml-runtty /dev/tty3 /usr/share/grml-scripts/run-screen root -#4:2345:respawn:/sbin/grml-runtty /dev/tty4 /usr/share/grml-scripts/run-screen grml -#5:2345:respawn:/sbin/grml-runtty /dev/tty5 /bin/zsh grml -#6:2345:respawn:/sbin/grml-runtty /dev/tty6 /bin/zsh grml +#4:2345:respawn:/sbin/grml-runtty /dev/tty4 /usr/share/grml-scripts/run-screen $USERNAME +#5:2345:respawn:/sbin/grml-runtty /dev/tty5 /bin/zsh $USERNAME +#6:2345:respawn:/sbin/grml-runtty /dev/tty6 /bin/zsh $USERNAME #9:2345:respawn:/sbin/getty 38400 tty9 #10:2345:respawn:/sbin/grml-runtty /dev/tty10 /usr/sbin/grml-iptstate root #11:2345:respawn:/sbin/grml-runtty /dev/tty11 /usr/bin/htop root diff --git a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup b/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup index 4af5106..d7ad56e 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup @@ -9,6 +9,11 @@ set -u set -e +USERNAME='' +[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf +[ -n "$GRML_LIVE_LOCAL_CONFIG" ] && . "$GRML_LIVE_LOCAL_CONFIG" +[ -n "$USERNAME" ] || USERNAME=grml + if ! [ -r $target/etc/runlevel.conf ] ; then echo 'Warning: /etc/runlevel.conf does not exist...' echo '... assuming we do not have file-rc, skipping 15-initsetup' @@ -30,6 +35,7 @@ fcopy -v /etc/runlevel.conf # provide Grml's inittab configuration fcopy -v /etc/inittab +sed -i "s/\$USERNAME\$/${USERNAME}/" $target/etc/inittab # provide Grml's bootlocal init scripts fcopy -v /etc/init.d/bootlocal.first diff --git a/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup b/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup index 68f110b..29cf07e 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/21-usersetup @@ -68,12 +68,6 @@ add_user_to_group voice sed -i 's/^root::/root:*:/' $target/etc/shadow sed -i "s/^$USERNAME:!:/$USERNAME:*:/" $target/etc/shadow -# make sure users can log in on consoles 4, 5 and 6 if username != grml: -if [ "$USERNAME" != "grml" ] ; then - sed -i "s/-u grml -g grml --autologin grml/-u ${USERNAME} -g ${USERNAME} --autologin ${USERNAME}/" \ - $target/etc/inittab -fi - if [ -r $target/bin/zsh ] ; then $ROOTCMD chsh -s /bin/zsh root $ROOTCMD chsh -s /bin/zsh $USERNAME