1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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
- 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
- chroot ${NEWROOT} useradd -m -c $USERNAME -G audio,video,wheel -s $USERSHELL $USERNAME
- chroot ${NEWROOT} passwd -d $USERNAME >/dev/null 2>&1
- chroot ${NEWROOT} sh -c 'echo "root:voidlinux" | chpasswd -c SHA512'
- chroot ${NEWROOT} sh -c "echo "$USERNAME:voidlinux" | chpasswd -c SHA512"
- if [ -f ${NEWROOT}/etc/sudoers ]; then
- echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
- fi
- if [ -d ${NEWROOT}/etc/polkit-1 ]; then
-
- cat > ${NEWROOT}/etc/polkit-1/rules.d/void-live.rules <<_EOF
- polkit.addAdminRule(function(action, subject) {
- return ["unix-group:wheel"];
- });
- polkit.addRule(function(action, subject) {
- if (subject.isInGroup("wheel")) {
- return polkit.Result.YES;
- }
- });
- _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
|