forked from DGNum/liminix
add hook to run maintenance mode instead of rebooting
This commit is contained in:
parent
bab6d346a8
commit
62c788eb86
2 changed files with 24 additions and 14 deletions
|
@ -118,7 +118,13 @@ let
|
||||||
mode = "0755";
|
mode = "0755";
|
||||||
};
|
};
|
||||||
finish = {
|
finish = {
|
||||||
file = quit "s6-svscan exited. Rebooting.";
|
file = ''
|
||||||
|
${openConsole}
|
||||||
|
ifelse { test -x /run/maintenance/exec } { /run/maintenance/exec }
|
||||||
|
foreground { echo "s6-svscan exited. Rebooting." }
|
||||||
|
wait { }
|
||||||
|
${s6-linux-init}/bin/s6-linux-init-hpr -fr
|
||||||
|
'';
|
||||||
mode = "0755";
|
mode = "0755";
|
||||||
};
|
};
|
||||||
SIGINT = {
|
SIGINT = {
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
### Things to do *right before* the machine gets rebooted or
|
## s6-linux-init-shutdownd never tells s6-svscan to exit, so if
|
||||||
### powered off, at the very end of the shutdown sequence,
|
## you're running s6-linux-init, it's normal that your
|
||||||
### when all the filesystems are unmounted.
|
## .s6-svscan/finish script is not executed.
|
||||||
|
|
||||||
### This is a last resort hook; normally nothing should be
|
## The place where you want to hack things is /etc/rc.shutdown.final,
|
||||||
### done here (your rc.shutdown script should have taken care
|
## which is run by the stage 4 script right before the hard reboot.
|
||||||
### of everything) and you should leave this script empty.
|
## So you can do dirty stuff [...] which should clean up the
|
||||||
|
## s6-supervise and the foreground, and give control to
|
||||||
|
## .s6-svscan/finish.
|
||||||
|
|
||||||
### Some distributions, however, may need to perform some
|
## -- Laurent Bercot on skaware mailing list,
|
||||||
### actions after unmounting the filesystems: typically if
|
## https://skarnet.org/lists/skaware/1913.html
|
||||||
### an additional teardown action is required on a filesystem
|
|
||||||
### after unmounting it, or if the system needs to be
|
|
||||||
### pivot_rooted before it can be shut down, etc.
|
|
||||||
|
|
||||||
### Those are all exceptional cases. If you don't know for
|
exec >/dev/console 2>&1
|
||||||
### certain that you need to do something here, you don't.
|
|
||||||
|
# down, exit supervisor, wait, stay down
|
||||||
|
s6-svc -dxwD /run/service/s6-linux-init-shutdownd
|
||||||
|
# HUP, exit supervisor, wait, down
|
||||||
|
s6-svc -hxwd /run/service/s6-svscan-log
|
||||||
|
s6-svscanctl -b /run/service # abort
|
||||||
|
|
Loading…
Reference in a new issue