Browse Source

dracut/adduser: autologin if live.autologin is set in the kernel cmdline.

Juan RP 10 years ago
parent
commit
a30890cffc
1 changed files with 6 additions and 0 deletions
  1. 6 0
      dracut/adduser.sh

+ 6 - 0
dracut/adduser.sh

@@ -6,8 +6,10 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 
 echo void-live > ${NEWROOT}/etc/hostname
 
+AUTOLOGIN=$(getarg live.autologin)
 USERNAME=$(getarg live.user)
 USERSHELL=$(getarg live.shell)
+
 [ -z "$USERNAME" ] && USERNAME=anon
 [ -x $NEWROOT/bin/bash -a -z "$USERSHELL" ] && USERSHELL=/bin/bash
 [ -z "$USERSHELL" ] && USERSHELL=/bin/sh
@@ -48,3 +50,7 @@ polkit.addRule(function(action, subject) {
 _EOF
     chroot ${NEWROOT} chown polkitd:polkitd /etc/polkit-1/rules.d/void-live.rules
 fi
+
+if [ -n "$AUTOLOGIN" ]; then
+        sed -i "s,GETTY_ARGS=\"--noclear\",GETTY_ARGS=\"--noclear -a $USERNAME\",g" ${NEWROOT}/etc/sv/agetty-tty1/run
+fi