From c31e985c8ee43b691a389bea995b35a5b8b5f5c3 Mon Sep 17 00:00:00 2001 From: teldra Date: Mon, 22 Jun 2020 01:43:05 +0200 Subject: [PATCH 1/4] New package: boot-66serv-2.2.1 based on: https://github.com/void-linux/void-packages/pull/23122 https://github.com/void-linux/void-packages/pull/21142 [ci-skip] --- srcpkgs/boot-66serv/files/66 | 2 ++ srcpkgs/boot-66serv/files/runit | 16 ++++++++++++ srcpkgs/boot-66serv/files/switch-initutils | 22 ++++++++++++++++ srcpkgs/boot-66serv/files/tty@ | 12 +++++++++ srcpkgs/boot-66serv/template | 30 ++++++++++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 srcpkgs/boot-66serv/files/66 create mode 100644 srcpkgs/boot-66serv/files/runit create mode 100755 srcpkgs/boot-66serv/files/switch-initutils create mode 100644 srcpkgs/boot-66serv/files/tty@ create mode 100644 srcpkgs/boot-66serv/template diff --git a/srcpkgs/boot-66serv/files/66 b/srcpkgs/boot-66serv/files/66 new file mode 100644 index 00000000000..c82ece19fc5 --- /dev/null +++ b/srcpkgs/boot-66serv/files/66 @@ -0,0 +1,2 @@ +#!/usr/bin/execlineb -P +66-boot -b "Booting Voidlinux" -m diff --git a/srcpkgs/boot-66serv/files/runit b/srcpkgs/boot-66serv/files/runit new file mode 100644 index 00000000000..9c25c7dff43 --- /dev/null +++ b/srcpkgs/boot-66serv/files/runit @@ -0,0 +1,16 @@ +[main] +@type = longrun +@version = @VERSION@ +@description = "runit" +@user = (root) +@options = ( log ) + +[start] +@execute = ( /etc/runit/2 ) + +[stop] +@execute = ( exec-cmdline -s { sv force-stop /var/service/*; sv exit /var/service/* } ) + +[logger] +@backup = 3 +@maxsize = 1000000 diff --git a/srcpkgs/boot-66serv/files/switch-initutils b/srcpkgs/boot-66serv/files/switch-initutils new file mode 100755 index 00000000000..3919274b0f7 --- /dev/null +++ b/srcpkgs/boot-66serv/files/switch-initutils @@ -0,0 +1,22 @@ +# This service automatically moves +# /usr/bin/{reboot,poweroff,halt,shutdown} +# so that if started with 66, users can shutdown etc. with it. +# It automatically moves everything back if started with +# runit again. +# This is run by runit and 66 + +if grep -q "init=/usr/bin/66" /proc/cmdline; then + for i in reboot poweroff halt shutdown; do + if ! test -e /usr/bin/${i}.runit; then + mv /usr/bin/${i} /usr/bin/${i}.runit + ln -s /etc/66/${i} /usr/bin/${i} + fi + done +else + for i in reboot poweroff halt shutdown; do + if test -e /usr/bin/${i}.runit; then + rm /usr/bin/${i} + mv /usr/bin/${i}.runit /usr/bin/${i} + fi + done +fi diff --git a/srcpkgs/boot-66serv/files/tty@ b/srcpkgs/boot-66serv/files/tty@ new file mode 100644 index 00000000000..7b72f625d84 --- /dev/null +++ b/srcpkgs/boot-66serv/files/tty@ @@ -0,0 +1,12 @@ +[main] +@type = classic +@version = @VERSION@ +@description = "Launch @I" +@user = ( root ) +@options = ( env ) + +[start] +@execute = ( execl-cmdline -s { agetty ${cmd_args} @I } ) + +[environment] +cmd_args=!-J 38400 diff --git a/srcpkgs/boot-66serv/template b/srcpkgs/boot-66serv/template new file mode 100644 index 00000000000..1a57510f3cf --- /dev/null +++ b/srcpkgs/boot-66serv/template @@ -0,0 +1,30 @@ +# Template file for 'boot-66serv' +pkgname=boot-66serv +version=2.2.1 +revision=1 +wrksrc=${pkgname}-v${version} +build_style=gnu-configure +configure_args="--HOSTNAME=voidlinux --TTY=!4 + --KEYMAP=!us --TZ=Europe/Madrid" +make_install_target="install install-man install-html" +hostmakedepends="lowdown" +makedepends="file" +depends="s6 s6-rc s6-linux-utils s6-portable-utils 66 66-tools" +short_desc="Stage 1 boot for 66" +maintainer="mobinmob " +# previous maintainer="teldra " +license="ISC" +homepage="https://framagit.org/Obarun/boot-66serv" +conf_files="/etc/66/rc.local" +distfiles="https://framagit.org/Obarun/${pkgname}/-/archive/v${version}/${pkgname}-v${version}.tar.gz" +checksum=34eac7f84dd9cafda78a7b5a21eed484e9d6b52e8fba0ade6dbb5f1567def84d + +post_install() { + vinstall ${FILESDIR}/switch-initutils 644 etc/runit/core-services 99-switch-initutils.sh + vbin ${FILESDIR}/66 + vlicense LICENSE + vinstall ${FILESDIR}/tty@ 644 usr/share/66/service/ + vsed -i "s/@VERSION@/${version}/" "${DESTDIR}/usr/share/66/service/tty@" + vinstall ${FILESDIR}/runit 644 usr/share/66/service/ + vsed -i "s/@VERSION@/${version}/" "${DESTDIR}/usr/share/66/service/runit" +} From 9ded679e0460c642e43b786c9cef4b51a3cb032b Mon Sep 17 00:00:00 2001 From: mobinmob Date: Sun, 8 Nov 2020 17:08:32 +0200 Subject: [PATCH 2/4] improve runit service frontend file. --- srcpkgs/boot-66serv/files/runit | 18 ++++++++++++++++-- srcpkgs/boot-66serv/template | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/srcpkgs/boot-66serv/files/runit b/srcpkgs/boot-66serv/files/runit index 9c25c7dff43..c5e36bbfa4f 100644 --- a/srcpkgs/boot-66serv/files/runit +++ b/srcpkgs/boot-66serv/files/runit @@ -6,10 +6,24 @@ @options = ( log ) [start] -@execute = ( /etc/runit/2 ) +@build = custom +@shebang = ( "/bin/sh" ) +@execute = ( +PATH=/usr/bin:/usr/sbin + +runlevel=66 + +runsvchdir "${runlevel}" +mkdir -p /run/runit/runsvdir +ln -s /etc/runit/runsvdir/current /run/runit/runsvdir/current + +exec env - PATH=$PATH \ + runsvdir -P /run/runit/runsvdir/current 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' + + ) [stop] -@execute = ( exec-cmdline -s { sv force-stop /var/service/*; sv exit /var/service/* } ) +@execute = ( execl-cmdline -s { sv force-stop /var/service/*; sv exit /var/service/* } ) [logger] @backup = 3 diff --git a/srcpkgs/boot-66serv/template b/srcpkgs/boot-66serv/template index 1a57510f3cf..f953ead216e 100644 --- a/srcpkgs/boot-66serv/template +++ b/srcpkgs/boot-66serv/template @@ -19,6 +19,8 @@ conf_files="/etc/66/rc.local" distfiles="https://framagit.org/Obarun/${pkgname}/-/archive/v${version}/${pkgname}-v${version}.tar.gz" checksum=34eac7f84dd9cafda78a7b5a21eed484e9d6b52e8fba0ade6dbb5f1567def84d +make_dirs="/etc/runit/runsvdir/66 0750 root root" + post_install() { vinstall ${FILESDIR}/switch-initutils 644 etc/runit/core-services 99-switch-initutils.sh vbin ${FILESDIR}/66 From 232978a14db458e141310901f45fc82f6e11ab34 Mon Sep 17 00:00:00 2001 From: mobinmob Date: Tue, 24 Nov 2020 01:54:26 +0200 Subject: [PATCH 3/4] make [stop] do its job :P --- srcpkgs/boot-66serv/files/runit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/srcpkgs/boot-66serv/files/runit b/srcpkgs/boot-66serv/files/runit index c5e36bbfa4f..fe741ff2bd8 100644 --- a/srcpkgs/boot-66serv/files/runit +++ b/srcpkgs/boot-66serv/files/runit @@ -23,7 +23,11 @@ exec env - PATH=$PATH \ ) [stop] -@execute = ( execl-cmdline -s { sv force-stop /var/service/*; sv exit /var/service/* } ) +@build = custom +@shebang = ( "/bin/sh" ) +@execute = ( + sv force-stop /var/service/* + sv exit /var/service/* ) [logger] @backup = 3 From 89d18a8b4d4339f8e9f3a857bb4ba83db07c3f3b Mon Sep 17 00:00:00 2001 From: mobinmob Date: Wed, 25 Nov 2020 21:24:43 +0200 Subject: [PATCH 4/4] Separate switch-initutils code for runit and 66, and document both consistently. --- srcpkgs/boot-66serv/files/switch-initutils | 34 +++++++++------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/srcpkgs/boot-66serv/files/switch-initutils b/srcpkgs/boot-66serv/files/switch-initutils index 3919274b0f7..b596b3ba95f 100755 --- a/srcpkgs/boot-66serv/files/switch-initutils +++ b/srcpkgs/boot-66serv/files/switch-initutils @@ -1,22 +1,14 @@ -# This service automatically moves -# /usr/bin/{reboot,poweroff,halt,shutdown} -# so that if started with 66, users can shutdown etc. with it. -# It automatically moves everything back if started with -# runit again. -# This is run by runit and 66 +# This core service checks for /usr/bin/{reboot,poweroff,halt,shutdown} +# and if they are part of 66 it deletes them and moves the runit +# utilities in their place. It runs by default. There is a similar +# oneshot service for 66 that does the opposite and should be enabled. +# The script make sure that the user has the proper utilities for the +# init system they are currently running. + +for i in reboot poweroff halt shutdown; do + if test -e /usr/bin/${i}.runit; then + rm /usr/bin/${i} + mv /usr/bin/${i}.runit /usr/bin/${i} + fi +done -if grep -q "init=/usr/bin/66" /proc/cmdline; then - for i in reboot poweroff halt shutdown; do - if ! test -e /usr/bin/${i}.runit; then - mv /usr/bin/${i} /usr/bin/${i}.runit - ln -s /etc/66/${i} /usr/bin/${i} - fi - done -else - for i in reboot poweroff halt shutdown; do - if test -e /usr/bin/${i}.runit; then - rm /usr/bin/${i} - mv /usr/bin/${i}.runit /usr/bin/${i} - fi - done -fi