ar7: diag.sh: use common status_led_* functions
[openwrt/openwrt.git] / target / linux / ar7 / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2007-2013 OpenWrt.org
3
4 . /lib/functions/leds.sh
5
6 get_status_led() {
7 [ -d "/sys/class/leds/status" ] && status_led="status"
8 [ -d "/sys/class/leds/power:green" ] && status_led="power:green"
9 }
10
11 set_state() {
12 get_status_led
13
14 case "$1" in
15 preinit)
16 status_led_blink_preinit
17 ;;
18 failsafe)
19 status_led_blink_failsafe
20 ;;
21 preinit_regular)
22 status_led_blink_preinit_regular
23 ;;
24 done)
25 status_led_on
26
27 [ "$status_led" = "power:green" ] && {
28 led_off "power:red"
29 }
30 ;;
31 esac
32 }