From 726d00c05e68261f3df8ec0997fe3350166ffbf2 Mon Sep 17 00:00:00 2001 From: Colin Booth Date: Sun, 14 Feb 2021 16:47:01 -0800 Subject: [PATCH] runit-void: update version, use alternatives for init and power commands The runit-void package handles multiple duties. Th first is being the base system configuration for all mainline void linux installs. The second is handling the population of ownership of the init and power controls (/usr/bin/halt, /usr/bin/shutdown, and the init, poweroff, and reboot symlinks). Since those commands are required to manage a system, anybody who wants to experiment with an alternate init scheme needs to do one of: put their init control elsewhere, hold runit-void, or clean up after any reloads of runit-void. This change adds the suffix `-runit` to shutdown, halt, poweroff, and reboot and then registers shutdown, halt, poweroff, reboot, and init names with alternatives under the void-init group. This will allow other inits to take over for runit-void in a non-destructive fashion and allows for easy rollbacks even in the face of disaster. Thanks to st3r4g for pointing me towards xbps-alternatives instead of using a virtual package to handle the ownership flip-flop. It is a much cleaner method with significantly more straightforward semantics, though not without its pitfalls. --- srcpkgs/runit-void/template | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/srcpkgs/runit-void/template b/srcpkgs/runit-void/template index c495a45a3de..a41e1b109db 100644 --- a/srcpkgs/runit-void/template +++ b/srcpkgs/runit-void/template @@ -1,6 +1,6 @@ # Template file for 'runit-void' pkgname=runit-void -version=20200720 +version=20210313 revision=1 wrksrc="void-runit-${version}" build_style=gnu-makefile @@ -24,6 +24,13 @@ conf_files=" /etc/sv/agetty-hvc0/conf /etc/sv/agetty-hvsi0/conf" +alternatives=" + void-init:init:/usr/bin/runit-init + void-init:halt:/usr/bin/halt-runit + void-init:poweroff:/usr/bin/poweroff-runit + void-init:reboot:/usr/bin/reboot-runit + void-init:shutdown:/usr/bin/shutdown-runit" + make_dirs=" /etc/zzz.d/suspend 0755 root root /etc/zzz.d/resume 0755 root root" @@ -31,6 +38,10 @@ make_dirs=" post_install() { vmkdir usr/bin mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin + mv ${DESTDIR}/usr/bin/halt ${DESTDIR}/usr/bin/halt-runit + mv ${DESTDIR}/usr/bin/shutdown ${DESTDIR}/usr/bin/shutdown-runit + ln -sf halt-runit ${DESTDIR}/usr/bin/poweroff-runit + ln -sf halt-runit ${DESTDIR}/usr/bin/reboot-runit vconf ${FILESDIR}/hostname vconf ${FILESDIR}/os-release vconf ${FILESDIR}/locale.conf @@ -40,7 +51,9 @@ post_install() { rm -f ${DESTDIR}/etc/runit/runsvdir/current rm -rf ${DESTDIR}/etc/runit/runsvdir/default rm -rf ${DESTDIR}/etc/runit/runsvdir/single - ln -s runit-init ${DESTDIR}/usr/bin/init + # Remove extraneous power symlinks + rm ${DESTDIR}/usr/bin/poweroff + rm ${DESTDIR}/usr/bin/reboot } runit-void-apparmor_package() {