From 14457b1168d09f96ae9452c0103f3c4f75b4deec Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Sun, 2 Jul 2023 22:55:18 +0200 Subject: [PATCH] install stage 1: configure system to auto-login root and run install stage 2 --- install-stage1.sh | 22 +++++++++++++++++++++- install-stage2.sh | 4 +++- notes_to_self.txt | 5 ++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/install-stage1.sh b/install-stage1.sh index c9b55e7..5f15cb6 100644 --- a/install-stage1.sh +++ b/install-stage1.sh @@ -388,6 +388,12 @@ echo -n "Reconfiguring all installed packages... " run_in_target xbps-reconfigure -fa >> $LOGFILE 2>&1 echo "done" +echo -n "Configuring runit to start some services... " +run_in_target ln -s /etc/sv/acpid /etc/runit/runsvdir/default/ +run_in_target ln -s /etc/sv/dbus /etc/runit/runsvdir/default/ +run_in_target ln -s /etc/sv/NetworkManager /etc/runit/runsvdir/default/ +echo "done" + echo -n "Adding stage 2 installer... " STAGE2_DIR="/mnt/target/opt/void-usb/installer" @@ -411,7 +417,21 @@ for I in ${!SECTIONS[@]}; do done done -#TODO: auto-login root and run install stage 2 +mv /mnt/target/etc/sv/agetty-tty1/conf /mnt/target/etc/sv/agetty-tty1/conf.bak >> $LOGFILE 2>&1 +echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then + if [ "${tty}" = "tty1" ]; then + GETTY_ARGS="--noclear --autologin root" + fi +fi' > /mnt/target/etc/sv/agetty-tty1/conf + +[ -f /mnt/target/root/.profile ] && mv /mnt/target/root/.profile /mnt/target/root/.profile.bak >> $LOGFILE 2>&1 +echo "if ps aux | grep 'installer-stage2.sh' > /dev/null 2>&1; then + true +else + /opt/void-usb/installer/install-stage2.sh + exit +fi" > /mnt/target/root/.profile + echo "done" echo "Creating system image..." diff --git a/install-stage2.sh b/install-stage2.sh index 9be8fbf..b20097b 100644 --- a/install-stage2.sh +++ b/install-stage2.sh @@ -1,2 +1,4 @@ #!/usr/bin/env bash -exec bash + +#debugging +exec bash --norc --noprofile diff --git a/notes_to_self.txt b/notes_to_self.txt index b42d97f..90b056c 100644 --- a/notes_to_self.txt +++ b/notes_to_self.txt @@ -64,5 +64,8 @@ Stage 2: -> run passwd (interactively) -> add to groups -> including sudo group + -> clean up + -> mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf + -> if [ -f /mnt/target/root/.profile.bak ]; then mv /mnt/target/root/.profile.bak /mnt/target/root/.profile; else rm /mnt/target/root/.profile; fi + -> rm -r /opt/void-usb/installer -> build new squashfs image and reboot - -> rm -r /opt/void-usb/installer