kernel/base-files: clean up old code related to refreshing mtd partitions, it is...
[openwrt/svn-archive/archive.git] / package / base-files / files / sbin / led.sh
1 #!/bin/sh
2 # (C) 2008 openwrt.org
3
4 . /lib/functions.sh
5 ACTION=$1
6 NAME=$2
7 do_led() {
8 local name
9 local sysfs
10 config_get name $1 name
11 config_get sysfs $1 sysfs
12 [ "$name" == "$NAME" -o "$sysfs" = "$NAME" -a -e "/sys/class/leds/${sysfs}" ] && {
13 [ "$ACTION" == "set" ] &&
14 echo 1 >/sys/class/leds/${sysfs}/brightness \
15 || echo 0 >/sys/class/leds/${sysfs}/brightness
16 exit 0
17 }
18 }
19
20 [ "$1" == "clear" -o "$1" == "set" ] &&
21 [ -n "$2" ] &&{
22 config_load system
23 config_foreach do_led
24 exit 1
25 }