summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-11-20 20:50:52 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-11-20 20:50:52 +0000
commit49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca (patch)
tree3d282358778df8da70beb2d4002e580a3fe4262f /test
parent7bba427e939839d286d87a8c5f5fef3383e6dbc5 (diff)
downloadnixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.tar
nixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.tar.gz
nixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.tar.bz2
nixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.tar.lz
nixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.tar.xz
nixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.tar.zst
nixpkgs-49b2a218b54f4eefb7ac4ef50acc14d4ae2908ca.zip
* Support entering maintenance mode ("shutdown now") and powering off
  the system ("halt").

svn path=/nixu/trunk/; revision=7083
Diffstat (limited to 'test')
-rw-r--r--test/boot-environment.nix10
-rw-r--r--test/upstart-jobs/halt.nix23
-rw-r--r--test/upstart-jobs/maintenance-shell.nix19
3 files changed, 52 insertions, 0 deletions
diff --git a/test/boot-environment.nix b/test/boot-environment.nix
index b70906b13f6..887e8feb978 100644
--- a/test/boot-environment.nix
+++ b/test/boot-environment.nix
@@ -101,6 +101,16 @@ rec {
       (import ./upstart-jobs/dhclient.nix {
         dhcp = pkgs.dhcpWrapper;
       })
+
+      # Handles the maintenance/stalled event (single-user shell).
+      (import ./upstart-jobs/maintenance-shell.nix {
+        inherit (pkgs) bash;
+      })
+
+      # Handles the reboot/halt events.
+      (import ./upstart-jobs/halt.nix {
+        inherit (pkgs) bash;
+      })
     ]
 
     # The terminals on ttyX.
diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix
new file mode 100644
index 00000000000..f259ea77cc9
--- /dev/null
+++ b/test/upstart-jobs/halt.nix
@@ -0,0 +1,23 @@
+{bash}:
+
+{
+  name = "sys-halt";
+  
+  job = "
+start on reboot
+start on halt
+start on system-halt
+start on power-off
+
+script
+    exec < /dev/tty1 > /dev/tty1 2>&1
+    echo \"\"
+    echo \"<<< SYSTEM SHUTDOWN >>>\"
+    echo \"\"
+
+    # Right now all events above power off the system.
+    exec halt -f -p
+end script
+  ";
+  
+}
diff --git a/test/upstart-jobs/maintenance-shell.nix b/test/upstart-jobs/maintenance-shell.nix
new file mode 100644
index 00000000000..9e2acdaa0f5
--- /dev/null
+++ b/test/upstart-jobs/maintenance-shell.nix
@@ -0,0 +1,19 @@
+{bash}:
+
+{
+  name = "maintenance-shell";
+  
+  job = "
+start on maintenance
+start on stalled
+
+script
+    exec < /dev/tty1 > /dev/tty1 2>&1
+    echo \"\"
+    echo \"<<< MAINTENANCE SHELL >>>\"
+    echo \"\"
+    exec ${bash}/bin/sh
+end script
+  ";
+  
+}