openwrtv3/target/linux/lantiq/base-files/etc/diag.sh

47 lines
761 B
Bash
Raw Normal View History

2012-12-15 02:01:00 +00:00
#!/bin/sh
# Copyright (C) 2010-2015 OpenWrt.org
2012-12-15 02:01:00 +00:00
. /lib/functions/leds.sh
2012-12-15 02:01:00 +00:00
boot="$(get_dt_led boot)"
failsafe="$(get_dt_led failsafe)"
running="$(get_dt_led running)"
upgrade="$(get_dt_led upgrade)"
2012-12-15 02:01:00 +00:00
set_state() {
status_led="$boot"
2012-12-15 02:01:00 +00:00
case "$1" in
preinit)
status_led_blink_preinit
2012-12-15 02:01:00 +00:00
;;
failsafe)
status_led_off
[ -n "$running" ] && {
status_led="$running"
status_led_off
}
status_led="$failsafe"
status_led_blink_failsafe
;;
preinit_regular)
status_led_blink_preinit_regular
2012-12-15 02:01:00 +00:00
;;
upgrade)
[ -n "$running" ] && {
status_led="$running"
status_led_off
}
status_led="$upgrade"
status_led_blink_preinit_regular
;;
2012-12-15 02:01:00 +00:00
done)
status_led_off
[ -n "$running" ] && {
status_led="$running"
status_led_on
}
2012-12-15 02:01:00 +00:00
;;
esac
}