mklive: misc tweaks to generate a proper image with runit.

This commit is contained in:
Juan RP 2014-05-23 15:05:31 +02:00
parent 3b5b9cba6a
commit 07ce345ba6
3 changed files with 16 additions and 4 deletions

View File

@ -4,6 +4,8 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
echo void-live > ${NEWROOT}/etc/hostname
USERNAME=$(getarg live.user) USERNAME=$(getarg live.user)
[ -z "$USERNAME" ] && USERNAME=anon [ -z "$USERNAME" ] && USERNAME=anon
@ -12,16 +14,24 @@ echo "USERNAME=$USERNAME" >> ${NEWROOT}/etc/default/live.conf
chmod 644 ${NEWROOT}/etc/default/live.conf chmod 644 ${NEWROOT}/etc/default/live.conf
# Create new user and remove password. We'll use autologin by default. # Create new user and remove password. We'll use autologin by default.
chroot ${NEWROOT} useradd -c $USERNAME -m $USERNAME -G \ chroot ${NEWROOT} useradd -c $USERNAME -m $USERNAME -G systemd-journal,wheel -s /bin/bash
systemd-journal,wheel -s /bin/bash
chroot ${NEWROOT} passwd -d $USERNAME >/dev/null 2>&1 chroot ${NEWROOT} passwd -d $USERNAME >/dev/null 2>&1
# Setup default root password (voidlinux).
chroot ${NEWROOT} sh -c 'echo "root:voidlinux" | chpasswd -c SHA512'
# Enable sudo permission by default. # Enable sudo permission by default.
if [ -f ${NEWROOT}/etc/sudoers ]; then if [ -f ${NEWROOT}/etc/sudoers ]; then
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
fi fi
# Enable autologin for agetty(8). # Enable autologin for agetty(8) on tty1 and disable pam_systemd.
if [ -d ${NEWROOT}/etc/runit ]; then
sed -e "s|\-8|& -a $USERNAME|g" -i ${NEWROOT}/etc/sv/agetty-tty1/run
sed -e '/systemd/d' -i ${NEWROOT}/etc/pam.d/*
fi
# Enable autologin for agetty(8) on tty1 with systemd.
if [ -d ${NEWROOT}/etc/systemd/system ]; then if [ -d ${NEWROOT}/etc/systemd/system ]; then
rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service" rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
sed -e "s|/sbin/agetty --noclear|& -a ${USERNAME}|g" \ sed -e "s|/sbin/agetty --noclear|& -a ${USERNAME}|g" \

View File

@ -18,5 +18,5 @@ KEYMAP=$(getarg vconsole.keymap)
if [ -f ${NEWROOT}/etc/vconsole.conf ]; then if [ -f ${NEWROOT}/etc/vconsole.conf ]; then
sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/vconsole.conf sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/vconsole.conf
elif [ -f ${NEWROOT}/etc/rc.conf ]; then elif [ -f ${NEWROOT}/etc/rc.conf ]; then
sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/rc.conf.conf sed -e "s,^#KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/rc.conf
fi fi

View File

@ -123,6 +123,8 @@ install_packages() {
else else
install -Dm755 /usr/sbin/void-installer $ROOTFS/usr/sbin/void-installer install -Dm755 /usr/sbin/void-installer $ROOTFS/usr/sbin/void-installer
fi fi
# Cleanup and remove useless stuff.
rm -rf $ROOTFS/var/cache/* $ROOTFS/run/* $ROOTFS/var/run/*
} }
copy_dracut_files() { copy_dracut_files() {