extract console redirection stuff from "quit" function

so we can use it for scripts that don't reboot at their end
This commit is contained in:
Daniel Barlow 2023-11-21 23:27:20 +00:00
parent 7c9297f91d
commit a202ae476a

View file

@ -94,17 +94,20 @@ let
}; };
".s6-svscan" = ".s6-svscan" =
let let
openConsole = ''
#!${execline}/bin/execlineb -P
${execline}/bin/redirfd -w 2 /dev/console
${execline}/bin/fdmove -c 1 2
'';
quit = message: '' quit = message: ''
#!${execline}/bin/execlineb -P ${openConsole}
${execline}/bin/redirfd -w 2 /dev/console ${execline}/bin/foreground { ${s6-linux-init}/bin/s6-linux-init-echo -- ${message} }
${execline}/bin/fdmove -c 1 2 ${s6-linux-init}/bin/s6-linux-init-hpr -fr
${execline}/bin/foreground { ${s6-linux-init}/bin/s6-linux-init-echo -- ${message} } '';
${s6-linux-init}/bin/s6-linux-init-hpr -fr
'';
shutdown = action: '' shutdown = action: ''
#!${execline}/bin/execlineb -P #!${execline}/bin/execlineb -P
${s6-linux-init}/bin/s6-linux-init-shutdown -a #{action} -- now ${s6-linux-init}/bin/s6-linux-init-shutdown -a #{action} -- now
''; '';
empty = "#!${execline}/bin/execlineb -P\n"; empty = "#!${execline}/bin/execlineb -P\n";
in dir { in dir {
crash = { crash = {