12345678910111213141516171819202122232425262728 |
- #!/bin/sh
- type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
- USERNAME=$(getarg live.user)
- [ -z "$USERNAME" ] && USERNAME=anon
- echo "USERNAME=$USERNAME" >> ${NEWROOT}/etc/default/live.conf
- chmod 644 ${NEWROOT}/etc/default/live.conf
- chroot ${NEWROOT} useradd -c $USERNAME -m $USERNAME -G \
- systemd-journal,wheel -s /bin/bash
- chroot ${NEWROOT} passwd -d $USERNAME >/dev/null 2>&1
- if [ -f ${NEWROOT}/etc/sudoers ]; then
- echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
- fi
- rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
- sed -e "s|/sbin/agetty --noclear|& -a ${USERNAME}|g" \
- "${NEWROOT}/usr/lib/systemd/system/getty@.service" > \
- "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
|