diff options
author | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-05-29 16:39:15 +0000 |
---|---|---|
committer | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-05-29 16:39:15 +0000 |
commit | 3a3aa7378b980fcd2ef7c1284d52ec4fe510aacb (patch) | |
tree | e21efa23691a02af6c1aebf8f216ddb55cdc373c /target/linux/kirkwood/base-files/etc/uci-defaults/leds | |
parent | 436c9f6d34c31e0173a60953858fe42b238822e4 (diff) |
kirkwood: use uci-defaults to configure different boards
Signed-off-by: Luka Perkov <openwrt@lukaperkov.net>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31990 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/kirkwood/base-files/etc/uci-defaults/leds')
-rw-r--r-- | target/linux/kirkwood/base-files/etc/uci-defaults/leds | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/target/linux/kirkwood/base-files/etc/uci-defaults/leds b/target/linux/kirkwood/base-files/etc/uci-defaults/leds new file mode 100644 index 000000000..a0b1c1c1f --- /dev/null +++ b/target/linux/kirkwood/base-files/etc/uci-defaults/leds @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Copyright (C) 2012 OpenWrt.org +# + +COMMIT_SYSTEM=0 + +set_led_netdev() { + local cfg="led_$1" + local sysfs=$2 + local dev=$3 + + uci -q get system.$cfg && return 0 + + uci batch <<EOF +set system.$cfg='led' +set system.$cfg.sysfs='$sysfs' +set system.$cfg.trigger='netdev' +set system.$cfg.dev='$dev' +set system.$cfg.mode='link tx rx' +EOF + COMMIT_SYSTEM=1 +} + +set_led_default() { + local cfg="led_$1" + local sysfs=$2 + local default=$3 + + uci -q get system.$cfg && return 0 + + uci batch <<EOF +set system.$cfg='led' +set system.$cfg.sysfs='$sysfs' +set system.$cfg.trigger='none' +set system.$cfg.default='$default' +EOF + COMMIT_SYSTEM=1 +} + +. /lib/kirkwood.sh + +hardware=$(kirkwood_hardware_name) + +case "$hardware" in +"Seagate FreeAgent DockStar") + set_led_netdev "eth0" "dockstar:orange:misc" "eth0" + set_led_default "health" "dockstar:green:health" "1" + ;; + +*) + ;; +esac + +[ "$COMMIT_SYSTEM" == "1" ] && uci commit system + +exit 0 |