[package] kernel: fix leds-net48xx and scx200-gpio dependencies, closes #4486
[openwrt.git] / package / base-files / files / sbin / led.sh
1 #!/bin/sh
2 # (C) 2008 openwrt.org
3
4 . /etc/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 }
This page took 0.042756 seconds and 5 git commands to generate.