* Handle reboot properly.

svn path=/nixu/trunk/; revision=7102
This commit is contained in:
Eelco Dolstra 2006-11-23 22:53:16 +00:00
parent 498bb32c82
commit 843aa8505c
2 changed files with 22 additions and 11 deletions

View File

@ -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 {

View File

@ -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
";