diff --git a/test/boot-environment.nix b/test/boot-environment.nix index aecb23fd4b3..16ac9484820 100644 --- a/test/boot-environment.nix +++ b/test/boot-environment.nix @@ -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 { diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix index 23b863e803d..58be12db69c 100644 --- a/test/upstart-jobs/halt.nix +++ b/test/upstart-jobs/halt.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 ";