]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/openslug-init/openslug-init-0.10/initscripts/zleds
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / openslug-init / openslug-init-0.10 / initscripts / zleds
1 #!/bin/sh
2 #
3 # This script is executed at the start and end of each run-level
4 # transition.  It is the first 'stop' script and the last 'start'
5 # script.
6 #
7 # 'stop'  sets the correct colour power LED to flash between the
8 #         two colours of the previous and next runlevel.
9 # 'start' sets the LED to steady
10 #
11 # 'red'   is the initial setting on kernel boot
12 #
13 # 'amber' is used for run levels S (from /linuxrc), 0 (halt),
14 #         1 (single user) and 6 (reboot).  halt and reboot do not
15 #         terminate therefore the LED remains flashing until the
16 #         kernel terminates.
17 #
18 # 'green' is used for run levels 2-5 - the normal user run levels.
19 #
20 # colours are 'g' (green), 'r' (red) or 'gr' (amber).
21 colour() {
22         case "$1" in
23         S|0|1|6) echo gr;;
24         2|3|4|5) echo g;;
25         N)       echo r;;
26         *)       echo "led change: $runlevel: runlevel unknown" >&2
27                  echo r;;
28         esac
29 }
30
31 # leds syntax is -A +<init state> /<new state>
32 case "$1" in
33 start) leds -gr +"$(colour "$runlevel")";;
34 stop)  leds -gr +"$(colour "$previous")" /"$(colour "$runlevel")";;
35 *)     echo "led change: $1: command ignored" >&2;;
36 esac
37
38 exit 0