* 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;
|
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.
|
# The terminals on ttyX.
|
||||||
++ (map
|
++ (map
|
||||||
(ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix {
|
(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 = "
|
job = "
|
||||||
start on reboot
|
start on ${event}
|
||||||
start on halt
|
|
||||||
start on system-halt
|
|
||||||
start on power-off
|
|
||||||
|
|
||||||
script
|
script
|
||||||
exec < /dev/tty1 > /dev/tty1 2>&1
|
exec < /dev/tty1 > /dev/tty1 2>&1
|
||||||
@ -28,7 +30,11 @@ script
|
|||||||
sync || true
|
sync || true
|
||||||
|
|
||||||
# Right now all events above power off the system.
|
# Right now all events above power off the system.
|
||||||
|
if test ${event} = reboot; then
|
||||||
|
exec reboot -f
|
||||||
|
else
|
||||||
exec halt -f -p
|
exec halt -f -p
|
||||||
|
fi
|
||||||
end script
|
end script
|
||||||
";
|
";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user