123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #!/bin/sh
- type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
- echo void-live > ${NEWROOT}/etc/hostname
- 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 wheel -s /bin/bash
- chroot ${NEWROOT} passwd -d $USERNAME >/dev/null 2>&1
- chroot ${NEWROOT} sh -c 'echo "root:voidlinux" | chpasswd -c SHA512'
- if [ -f ${NEWROOT}/etc/sudoers ]; then
- echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
- fi
- if [ -d ${NEWROOT}/etc/runit ]; then
- sed "s|agetty|& -a $USERNAME|" -i ${NEWROOT}/etc/sv/agetty-tty1/run
- fi
- if [ -d ${NEWROOT}/etc/systemd/system ]; then
- 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@.service"
- ln -sf /etc/systemd/system/getty@.service \
- "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
- 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
|