From e613c3945d4d81cce398c73fe7714860eb113006 Mon Sep 17 00:00:00 2001 From: PS Date: Sun, 1 Feb 2026 12:04:04 +0100 Subject: version 0.2.0.0 --- src/bin/system-init | 28 ++++++++++++++++++++++++++ src/bin/system-shutdown | 14 +++++++++++++ src/lib/service/system/goetia-shutdown/down | 0 src/lib/service/system/goetia-shutdown/run | 7 +++++++ src/lib/service/system/goetia-shutdown/stage3b | 14 +++++++++++++ src/lib/service/system/goetia-shutdown/stage4 | 14 +++++++++++++ 6 files changed, 77 insertions(+) create mode 100755 src/bin/system-init create mode 100755 src/bin/system-shutdown create mode 100644 src/lib/service/system/goetia-shutdown/down create mode 100755 src/lib/service/system/goetia-shutdown/run create mode 100644 src/lib/service/system/goetia-shutdown/stage3b create mode 100644 src/lib/service/system/goetia-shutdown/stage4 (limited to 'src') diff --git a/src/bin/system-init b/src/bin/system-init new file mode 100755 index 0000000..7050b33 --- /dev/null +++ b/src/bin/system-init @@ -0,0 +1,28 @@ +#!@shebangdir@/execlineb -P + +# ISC license. + +multisubstitute { + importas -SD default BUNDLE + importas -SD + /command:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/libexec:/usr/local/libexec + PATH +} +export PATH ${PATH} + +execline-cd / +s6-setsid + +foreground { set-ctrlaltdel -s } + +if { mount -t tmpfs -o mode=0755 tmpfs @tmpfsdir@ } + +prepare-svscan + @sysconfdir@ + @tmpfsdir@/@sysrundir@ + ${BUNDLE} + +foreground { mkdir -p -- @tmpfsdir@/@sysrundir@/log } +foreground { cp -Rpf -- @syslogdir@/uncaught-logs @tmpfsdir@/@sysrundir@/log/ } + +s6-svscan @tmpfsdir@/@sysrundir@/service diff --git a/src/bin/system-shutdown b/src/bin/system-shutdown new file mode 100755 index 0000000..53b2d4b --- /dev/null +++ b/src/bin/system-shutdown @@ -0,0 +1,14 @@ +#!@shebangdir@/execlineb -s0 + +# ISC license. + +ifelse { eltest \\\\${@} =~ ^-[hpr]$ } { + if { mkdir -p @tmpfsdir@/@sysrundir@/shutdown-directive } + if { + redirfd -w 1 @tmpfsdir@/@sysrundir@/shutdown-directive/DIRECTIVE + echo ${@} + } + s6-svc -U @tmpfsdir@/@sysrundir@/service/goetia-shutdown +} +if { echo "system-shutdown: usage: system-shutdown -h | -p | -r" } +exit 100 diff --git a/src/lib/service/system/goetia-shutdown/down b/src/lib/service/system/goetia-shutdown/down new file mode 100644 index 0000000..e69de29 diff --git a/src/lib/service/system/goetia-shutdown/run b/src/lib/service/system/goetia-shutdown/run new file mode 100755 index 0000000..32f37fe --- /dev/null +++ b/src/lib/service/system/goetia-shutdown/run @@ -0,0 +1,7 @@ +#!@shebangdir@/execlineb -P + +# ISC license. + +fdmove -c 2 1 + +system-shutdown-daemon diff --git a/src/lib/service/system/goetia-shutdown/stage3b b/src/lib/service/system/goetia-shutdown/stage3b new file mode 100644 index 0000000..3daf81f --- /dev/null +++ b/src/lib/service/system/goetia-shutdown/stage3b @@ -0,0 +1,14 @@ +#!@shebangdir@/execlineb -P + +# ISC license. + +if -n { + tryexec { ./stage4 } + foreground { chmod u+x stage4 } + + foreground { kill -SIGCONT -- -1 } + foreground { sleep 1 } + foreground { echo sending all processes the KILL signal... } + foreground { kill -SIGKILL -- -1 } +} +chmod a-x stage3b stage4 diff --git a/src/lib/service/system/goetia-shutdown/stage4 b/src/lib/service/system/goetia-shutdown/stage4 new file mode 100644 index 0000000..1d25d68 --- /dev/null +++ b/src/lib/service/system/goetia-shutdown/stage4 @@ -0,0 +1,14 @@ +#!@shebangdir@/execlineb -P + +# ISC license. + +if -n { + s6-envdir -I @tmpfsdir@/@sysrundir@/shutdown-directive + importas -SD "-r" DIRECTIVE + + foreground { umount -a } + foreground { mount -o remount,ro / } + + powertool ${DIRECTIVE} +} +chmod a-x stage3b stage4 -- cgit v1.2.3