core-system-init-freebsd

core-system init submodule, FreeBSD version
git clone https://ccx.te2000.cz/git/core-system-init-freebsd
Log | Files | Refs

commit 139e3d56bef8263bd7d422e446ac6742f2b04d52
parent e4d0708ae987518eae2c136baefdf5ee7a17f90a
Author: Jan Pobříslo <ccx@te2000.cz>
Date:   Tue, 15 Nov 2022 12:55:57 +0100

Decouple catch-all loger from s6-svscanboot into s6-svscan-log

Diffstat:
Minstall | 52+++++++++++++++++++++++++++++++++++-----------------
Mrun-image/service/.s6-svscan/SIGHUP | 2+-
Mrun-image/service/.s6-svscan/SIGINT | 2+-
Drun-image/service/s6-svscan-log/notification-fd | 1-
Drun-image/service/s6-svscan-log/run | 6------
5 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/install b/install @@ -28,14 +28,19 @@ $qc/redirfd -w 2 /dev/console $qc/redirfd -w 1 /dev/console $qc/redirfd -r 0 /dev/null $qc/export PATH "/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - $qc/execline-umask 022 -$qc/if { printf "%s: " "Starting S6" } -$qc/if { date } + #foreground { kldload tmpfs.ko } # we don't seem to have simple check to see if /run is mounted specifically, # so this will have to do $qc/if { mount -a -t tmpfs } + +# wait for catch-all logger fifo to appear +$qc/if { $qc/s6-test -p /run/s6-svscan.fifo } +$qc/redirfd -w 1 /run/s6-svscan.fifo +$qc/fdmove -c 2 1 + +$qc/if { printf "%s\n" "Starting S6" } $qc/if { $qc/if -Xnt { $qc/s6-test -d /run/service/.s6-svscan } $q_all/init/scripts/populate-run @@ -48,16 +53,37 @@ $qc/pipeline -w $qc/if -Xnt { $qc/s6-test -f /run/s6-rc/state } $q_all/init/scripts/rc.init ok-all } -$qc/fdmove -c 3 1 -$qc/fdmove -c 1 2 $qc/unexport ! $qc/cd /run/service -$qc/redirfd -wnb 1 /run/service/s6-svscan-log/fifo -$qc/fdmove -c 2 1 $qc/s6-svscan -t0 -d3 /run/service EOF "$cmd/s6-chmod" 755 "$dst/init/s6-svscanboot" || exit $? +# s6-svscan-log {{{1 +"$cmd/s6-cat" >"$dst/init/s6-svscan-log" <<EOF || exit $? +#!$sm_dst_package/command/execlineb -P +# make sure we have sane environment first +$qc/redirfd -w 2 /dev/console +$qc/redirfd -w 1 /dev/console +$qc/redirfd -r 0 /dev/null +$qc/export PATH "/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +$qc/execline-umask 022 + +#foreground { kldload tmpfs.ko } +# we don't seem to have simple check to see if /run is mounted specifically, +# so this will have to do +$qc/if { mount -a -t tmpfs } + +$qc/if { mkdir -p /run/uncaught-logs } +$qc/if { + $qc/if -nt { $qc/s6-test -p /run/s6-svscan.fifo } + mkfifo /run/s6-svscan.fifo +} +$qc/redirfd -rnb 0 /run/s6-svscan.fifo +$qc/s6-log -b -- t /run/uncaught-logs +EOF +"$cmd/s6-chmod" 755 "$dst/init/s6-svscan-log" || exit $? + # populate-run {{{1 "$cmd/s6-cat" >"$dst/init/scripts/populate-run" <<EOF || exit $? #!$sm_dst_package/command/execlineb -P @@ -69,22 +95,14 @@ $qc/ifelse { $qc/s6-test -e /run/service } { $qc/foreground { $qc/s6-echo -- "ERROR: /run/s6-rc already exists" } false } -if { mkdir -p /run/uncaught-logs } -if { - elglob GLOB $(q "$(realpath "$src")")/run-image/* cp -a \$GLOB /run -} -mkfifo /run/service/s6-svscan-log/fifo +elglob GLOB $(q "$(realpath "$src")")/run-image/* cp -a \$GLOB /run EOF "$cmd/s6-chmod" 755 "$dst/init/scripts/populate-run" || exit $? # rc.init {{{1 "$cmd/s6-cat" >"$dst/init/scripts/rc.init" <<EOF || exit $? #!$sm_dst_package/command/execlineb -S1 -#$qc/export TERM "screen" -# write startup logs to logger instead of console -$qc/redirfd -w 1 /run/service/s6-svscan-log/fifo -$qc/fdmove -c 2 1 -$qc/foreground { $qc/s6-echo "* Starting s6-rc from "$q_all/s6-rc-db } +$qc/foreground { $qc/s6-echo "* Starting s6-rc from "$q_all/s6-rc-db" runlevel \${1}" } $qc/if { $qc/s6-rc-init -d -c $q_all/s6-rc-db /run/service } $q_all/init/scripts/runlevel \$1 EOF diff --git a/run-image/service/.s6-svscan/SIGHUP b/run-image/service/.s6-svscan/SIGHUP @@ -1,4 +1,4 @@ #!/bin/execlineb -P foreground { "/current/init/scripts/rc.shutdown" } -s6-svscanctl -b "/run"/service +s6-svscanctl -t "/run"/service diff --git a/run-image/service/.s6-svscan/SIGINT b/run-image/service/.s6-svscan/SIGINT @@ -1,4 +1,4 @@ #!/bin/execlineb -P foreground { "/current/init/scripts/rc.shutdown" } -s6-svscanctl -b "/run"/service +s6-svscanctl -t "/run"/service diff --git a/run-image/service/s6-svscan-log/notification-fd b/run-image/service/s6-svscan-log/notification-fd @@ -1 +0,0 @@ -3 diff --git a/run-image/service/s6-svscan-log/run b/run-image/service/s6-svscan-log/run @@ -1,6 +0,0 @@ -#!/command/execlineb -P - -/command/redirfd -w 1 /dev/null -/command/redirfd -w 2 /dev/console -/command/redirfd -rnb 0 fifo -/command/s6-log -bd3 -- t /run/uncaught-logs