diff options
author | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-12-31 15:02:32 +0000 |
---|---|---|
committer | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-12-31 15:02:32 +0000 |
commit | 4c27fd2675465fd8b7bfa2458a8123239bbab8f8 (patch) | |
tree | 19563270a419053c5e83aa245930b8c56fc12194 /package/base-files/files/etc | |
parent | 55894a40aaba5fa70a090486a1273f42d512461f (diff) |
package/base-files: use case statement in led init script
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29628 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/etc')
-rwxr-xr-x | package/base-files/files/etc/init.d/led | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index e4e812d7ad..c0e26a0b8b 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -34,21 +34,33 @@ load_led() { echo 0 >/sys/class/leds/${sysfs}/brightness } echo $trigger > /sys/class/leds/${sysfs}/trigger - [ "$trigger" == "netdev" -a -n "$dev" ] && { - echo $dev > /sys/class/leds/${sysfs}/device_name - echo $mode > /sys/class/leds/${sysfs}/mode - } - [ "$trigger" == "timer" ] && { - [ -n "$delayon" ] && echo $delayon > /sys/class/leds/${sysfs}/delay_on - [ -n "$delayoff" ] && echo $delayoff > /sys/class/leds/${sysfs}/delay_off - } - [ "$trigger" == "usbdev" -a -n "$dev" ] && { - echo $dev > /sys/class/leds/${sysfs}/device_name - echo $interval > /sys/class/leds/${sysfs}/activity_interval - } - [ "$trigger" == "port_state" -a -n "$port_state" ] && { - echo $port_state > /sys/class/leds/${sysfs}/port_state - } + case "$trigger" in + "netdev") + [ -n "$dev" ] && { + echo $dev > /sys/class/leds/${sysfs}/device_name + echo $mode > /sys/class/leds/${sysfs}/mode + } + ;; + + "timer") + [ -n "$delayon" ] && \ + echo $delayon > /sys/class/leds/${sysfs}/delay_on + [ -n "$delayoff" ] && \ + echo $delayoff > /sys/class/leds/${sysfs}/delay_off + ;; + + "usbdev") + [ -n "$dev" ] && { + echo $dev > /sys/class/leds/${sysfs}/device_name + echo $interval > /sys/class/leds/${sysfs}/activity_interval + } + ;; + + "port_state") + [ -n "$port_state" ] && \ + echo $port_state > /sys/class/leds/${sysfs}/port_state + ;; + esac } } |