* Handle reboot properly.
svn path=/nixu/trunk/; revision=7102
This commit is contained in:
parent
498bb32c82
commit
843aa8505c
@ -112,12 +112,17 @@ rec {
|
||||
inherit (pkgs) bash;
|
||||
})
|
||||
|
||||
# Handles the reboot/halt events.
|
||||
(import ./upstart-jobs/halt.nix {
|
||||
inherit (pkgs) bash;
|
||||
})
|
||||
]
|
||||
|
||||
# Handles the reboot/halt events.
|
||||
++ (map
|
||||
(event: makeJob (import ./upstart-jobs/halt.nix {
|
||||
inherit (pkgs) bash;
|
||||
inherit event;
|
||||
}))
|
||||
["reboot" "halt" "system-halt" "power-off"]
|
||||
)
|
||||
|
||||
# The terminals on ttyX.
|
||||
++ (map
|
||||
(ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix {
|
||||
|
@ -1,13 +1,15 @@
|
||||
{bash}:
|
||||
{bash, event}:
|
||||
|
||||
assert event == "reboot"
|
||||
|| event == "halt"
|
||||
|| event == "system-halt"
|
||||
|| event == "power-off";
|
||||
|
||||
{
|
||||
name = "sys-halt";
|
||||
name = "sys-" + event;
|
||||
|
||||
job = "
|
||||
start on reboot
|
||||
start on halt
|
||||
start on system-halt
|
||||
start on power-off
|
||||
start on ${event}
|
||||
|
||||
script
|
||||
exec < /dev/tty1 > /dev/tty1 2>&1
|
||||
@ -28,7 +30,11 @@ script
|
||||
sync || true
|
||||
|
||||
# Right now all events above power off the system.
|
||||
exec halt -f -p
|
||||
if test ${event} = reboot; then
|
||||
exec reboot -f
|
||||
else
|
||||
exec halt -f -p
|
||||
fi
|
||||
end script
|
||||
";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user