Bladeren bron

mklive: accept live.shell kernel cmdline to switch user shell; from pancake.

Juan RP 10 jaren geleden
bovenliggende
commit
14381901e4
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 1
      dracut/adduser.sh

+ 7 - 1
dracut/adduser.sh

@@ -7,14 +7,20 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 echo void-live > ${NEWROOT}/etc/hostname
 
 USERNAME=$(getarg live.user)
+USERSHELL=$(getarg live.shell)
 [ -z "$USERNAME" ] && USERNAME=anon
+[ -z "$USERSHELL" ] && USERSHELL=/bin/sh
 
 # Create /etc/default/live.conf to store USER.
 echo "USERNAME=$USERNAME" >> ${NEWROOT}/etc/default/live.conf
 chmod 644 ${NEWROOT}/etc/default/live.conf
 
+if ! grep -q ${USERSHELL} ${NEWROOT}/etc/shells ; then
+    echo ${USERSHELL} >> ${NEWROOT}/etc/shells
+fi
+
 # Create new user and remove password. We'll use autologin by default.
-chroot ${NEWROOT} useradd -c $USERNAME -m $USERNAME -G wheel -s /bin/sh
+chroot ${NEWROOT} useradd -c $USERNAME -m $USERNAME -G wheel -s $USERSHELL
 chroot ${NEWROOT} passwd -d $USERNAME >/dev/null 2>&1
 
 # Setup default root password (voidlinux).