From dc88d633896da94407fdd321c51a8dcd340cb866 Mon Sep 17 00:00:00 2001 From: lemniskett Date: Mon, 9 Nov 2020 21:08:19 +0700 Subject: [PATCH] Add systemd service support with servicectl --- runit/archbox/run => archboxinit.bash | 5 +---- chroot_setup.bash | 8 ++++++++ install.sh | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) rename runit/archbox/run => archboxinit.bash (72%) diff --git a/runit/archbox/run b/archboxinit.bash similarity index 72% rename from runit/archbox/run rename to archboxinit.bash index 530c67f..ae4c627 100755 --- a/runit/archbox/run +++ b/archboxinit.bash @@ -11,7 +11,4 @@ mount -R /run $CHROOT/run mount -R /lib/modules $CHROOT/lib/modules mount -R /boot $CHROOT/boot mount -R /var/lib/dbus $CHROOT/var/lib/dbus - -# Runit will re-execute scripts those are finished, -# so we create a neverending loop. -while true; do sleep 10800; done +chroot $CHROOT /usr/local/bin/serviced diff --git a/chroot_setup.bash b/chroot_setup.bash index 7032a91..879bec0 100755 --- a/chroot_setup.bash +++ b/chroot_setup.bash @@ -14,6 +14,13 @@ pacman-key --init pacman-key --populate archlinux msg "Installing essential packages..." pacman -Syu base base-devel xorg pulseaudio --noconfirm +msg "Installing servicectl..." +mkdir -p /usr/local/share/servicectl/enabled +curl -L 'https://raw.githubusercontent.com/lemniskett/servicectl/master/servicectl' > /usr/local/share/servicectl/servicectl 2>/dev/null +curl -L 'https://raw.githubusercontent.com/lemniskett/servicectl/master/serviced' > /usr/local/share/servicectl/serviced 2>/dev/null +chmod +x /usr/local/share/servicectl/service{d,ctl} +ln -s /usr/local/share/servicectl/servicectl /usr/local/bin/servicectl +ln -s /usr/local/share/servicectl/serviced /usr/local/bin/serviced msg "Creating user account..." CHROOT_USER="$(cat /tmp/archbox_user)" useradd -m $CHROOT_USER @@ -27,3 +34,4 @@ while true; do passwd $CHROOT_USER && break done sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers +echo "Don't forget to run /usr/local/share/archbox/bin/archboxinit in host on boot" diff --git a/install.sh b/install.sh index 33837d1..790c36b 100755 --- a/install.sh +++ b/install.sh @@ -7,7 +7,7 @@ install -v -D -m 755 ./copyresolv.bash /usr/local/share/archbox/bin/copyresolv install -v -D -m 755 ./archboxcommand.bash /usr/local/share/archbox/bin/archbox install -v -D -m 755 ./remount_run.bash /usr/local/share/archbox/bin/remount_run install -v -D -m 755 ./chroot_setup.bash /usr/local/share/archbox/chroot_setup.bash - +install -v -D -m 755 ./archboxinit.bash /usr/local/share/archbox/bin/archboxinit [[ -z $1 ]] && exit 0 if [ $1 = "--exp" ]; then