From c442d0a1b20c3055bdf001050fdf3de6d8da07d0 Mon Sep 17 00:00:00 2001 From: Colin Booth Date: Sun, 14 Feb 2021 16:47:01 -0800 Subject: [PATCH] runit-void: split package into main package and init controls 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 either put their init control elsewhere or clean up after any reloads of runit-void. The structure here is to split the commands required to start or stop a system away from the configuration and services that make up the core of Void. Core functionality continues to be provided by runit-void but it is adjusted to depend on a virutal package called "void-init" for the init and power commands. In mainline Void systems "void-init" is provided by runit-void-init, a subpackage built alongside runit-void, however this change allows any package to provide that functionality without breaking the core distribution configuration. From a package management perspective runit-void-init provides void-init and replaces void-init. This allows for a single-pass replacement of any other void-init providers simply by installing runit-void-init. Similarly, an alternative init package can be installed in a single pass via the same mechanisms without explicitly defining all packages that it needs to override. --- etc/defaults.virtual | 1 + srcpkgs/runit-void-init | 1 + srcpkgs/runit-void/INSTALL | 6 ------ srcpkgs/runit-void/runit-void-init.INSTALL | 10 ++++++++++ srcpkgs/runit-void/template | 23 +++++++++++++++++++--- 5 files changed, 32 insertions(+), 9 deletions(-) create mode 120000 srcpkgs/runit-void-init create mode 100644 srcpkgs/runit-void/runit-void-init.INSTALL diff --git a/etc/defaults.virtual b/etc/defaults.virtual index 083ab6349ea..3e517fa25ba 100644 --- a/etc/defaults.virtual +++ b/etc/defaults.virtual @@ -36,3 +36,4 @@ xserver-abi-video xorg-server libGL libglvnd libEGL libglvnd libGLES libglvnd +void-init runit-void-init diff --git a/srcpkgs/runit-void-init b/srcpkgs/runit-void-init new file mode 120000 index 00000000000..56af4340f73 --- /dev/null +++ b/srcpkgs/runit-void-init @@ -0,0 +1 @@ +runit-void \ No newline at end of file diff --git a/srcpkgs/runit-void/INSTALL b/srcpkgs/runit-void/INSTALL index 5a998f22549..276bf80d350 100644 --- a/srcpkgs/runit-void/INSTALL +++ b/srcpkgs/runit-void/INSTALL @@ -15,11 +15,5 @@ post) [ -e /etc/sv/agetty-tty${f}/down ] || ln -sf /etc/sv/agetty-tty$f etc/runit/runsvdir/default done [ -e etc/sv/udevd/run ] && ln -sf /etc/sv/udevd etc/runit/runsvdir/default - - if [ -d usr/sbin -a ! -L usr/sbin ]; then - for f in init shutdown halt reboot poweroff; do - ln -sr ../bin/$f usr/sbin/$f - done - fi ;; esac diff --git a/srcpkgs/runit-void/runit-void-init.INSTALL b/srcpkgs/runit-void/runit-void-init.INSTALL new file mode 100644 index 00000000000..c4c383805fa --- /dev/null +++ b/srcpkgs/runit-void/runit-void-init.INSTALL @@ -0,0 +1,10 @@ +case "${ACTION}" in +post) + # install init and shutdown files + if [ -d usr/sbin -a ! -L usr/sbin ]; then + for f in init shutdown halt reboot poweroff; do + ln -sr ../bin/$f usr/sbin/$f + done + fi + ;; +esac diff --git a/srcpkgs/runit-void/template b/srcpkgs/runit-void/template index c495a45a3de..9c566821773 100644 --- a/srcpkgs/runit-void/template +++ b/srcpkgs/runit-void/template @@ -1,7 +1,7 @@ # Template file for 'runit-void' pkgname=runit-void version=20200720 -revision=1 +revision=2 wrksrc="void-runit-${version}" build_style=gnu-makefile short_desc="Void Linux runit scripts" @@ -11,7 +11,7 @@ homepage="https://github.com/void-linux/void-runit" distfiles="https://github.com/void-linux/void-runit/archive/${version}.tar.gz" checksum=706ed491315bd75b4b4ca07bc04af97369f8ef8820e9fa1931dae6939ea2e2db -depends="virtual?awk procps-ng runit" +depends="virtual?awk procps-ng runit virtual?void-init" conf_files=" /etc/hostname /etc/locale.conf @@ -40,7 +40,6 @@ 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 } runit-void-apparmor_package() { @@ -52,3 +51,21 @@ runit-void-apparmor_package() { vmove etc/runit/core-services/09-apparmor.sh } } + +runit-void-init_package() { + short_desc+=" - init interface" + depends="runit runit-void" + provides="void-init-0_1" + replaces="void-init>=0" + pkg_install() { + vmove usr/bin/halt + vmove usr/bin/poweroff + vmove usr/bin/reboot + vmove usr/bin/shutdown + vmove usr/share/man/man8/halt.8 + vmove usr/share/man/man8/poweroff.8 + vmove usr/share/man/man8/reboot.8 + vmove usr/share/man/man8/shutdown.8 + ln -s runit-init ${PKGDESTDIR}/usr/bin/init + } +}