summaryrefslogtreecommitdiff
path: root/packages/openslug-init/openslug-init-0.10/leds_rs_green
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-05-23 18:02:35 +0000
committerJohn Bowler <jbowler@nslu2-linux.org>2005-05-23 18:02:35 +0000
commit4b72cfb3f2a471ece09a87321a790c92cfe6966f (patch)
tree49b8bd2df4c5800fa98a5e20f6def71886227a4f /packages/openslug-init/openslug-init-0.10/leds_rs_green
parent25282cd2b0ad770927943ef428f7f4eca869cb98 (diff)
New /linuxrc boot mechanism
Use "turnup help" to find out how to do turnup now! BKrev: 42921abbPAuC7JcmxHiVNgYZgCeE5A
Diffstat (limited to 'packages/openslug-init/openslug-init-0.10/leds_rs_green')
-rw-r--r--packages/openslug-init/openslug-init-0.10/leds_rs_green38
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/openslug-init/openslug-init-0.10/leds_rs_green b/packages/openslug-init/openslug-init-0.10/leds_rs_green
index e69de29bb2..5483d67202 100644
--- a/packages/openslug-init/openslug-init-0.10/leds_rs_green
+++ b/packages/openslug-init/openslug-init-0.10/leds_rs_green
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# This script is executed at the start and end of each run-level
+# transition. It is the first 'stop' script and the last 'start'
+# script.
+#
+# 'stop' sets the correct colour power LED to flash between the
+# two colours of the previous and next runlevel.
+# 'start' sets the LED to steady
+#
+# 'red' is the initial setting on kernel boot
+#
+# 'amber' is used for run levels S (from /linuxrc), 0 (halt),
+# 1 (single user) and 6 (reboot). halt and reboot do not
+# terminate therefore the LED remains flashing until the
+# kernel terminates.
+#
+# 'green' is used for run levels 2-5 - the normal user run levels.
+#
+# colours are 'g' (green), 'r' (red) or 'gr' (amber).
+colour() {
+ case "$1" in
+ S|0|1|6) echo gr;;
+ 2|3|4|5) echo g;;
+ N) echo gr;; # apparently used for S as well
+ *) echo "led change: $runlevel: runlevel unknown" >&2
+ echo r;;
+ esac
+}
+
+# leds syntax is -A +<init state> /<new state>
+case "$1" in
+start) leds -A +"$(colour "$runlevel")";;
+stop) leds -A +"$(colour "$previous")" /"$(colour "$runlevel")";;
+*) echo "led change: $1: command ignored" >&2;;
+esac
+
+exit 0