From f8f458ca79d2f3a840ee87dbed9896670ed9e8e6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 10 Jan 2010 19:50:44 +0000 Subject: heartbeat initscript translates now led names diff --git a/openwrt/rhctl/Makefile b/openwrt/rhctl/Makefile index cdf9681..82fb58e 100644 --- a/openwrt/rhctl/Makefile +++ b/openwrt/rhctl/Makefile @@ -18,7 +18,7 @@ PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://localhost/ -PKG_MD5SUM:=b641ecdf5c7461244ebfdc1d058031a6 +PKG_MD5SUM:=5ef6f94450062e0daf7eb2b974ace3cf PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install diff --git a/openwrt/rhctl/files/heartbeatclient.init b/openwrt/rhctl/files/heartbeatclient.init index b201c5e..b4c6042 100755 --- a/openwrt/rhctl/files/heartbeatclient.init +++ b/openwrt/rhctl/files/heartbeatclient.init @@ -22,21 +22,41 @@ start_daemon() { local value local args="" + local status="OK" for option in $CONFIG_OPTIONS do config_get value "$1" "$option" option=`echo $option | tr '_' '-'` - if [ -n "$value" ]; then + if [ $option = "led" ]; then + local led_path + eval "led_path=\${LED_${value}}" + if [ -z "$led_path" ]; then + status="OK but led not found" + else + led_path="/sys/class/leds/$led_path/brightness" + args="$args --led $led_path" + fi + elif [ -n "$value" ]; then args="$args --$option $value" fi done - local status="OK" $DAEMON --write-pid $PIDFILE $args || status="failed" echo -n " ($status)" } +get_led() +{ + local name + local sysfs + config_get name $1 name + config_get sysfs $1 sysfs + eval LED_$name=$sysfs +} + start() { echo -n "Starting $DESC:" + config_load "system" + config_foreach get_led "led" config_load "rhctl" mkdir -p $RUN_D config_foreach start_daemon "heartbeatclient" diff --git a/openwrt/rhctl/files/rhctl.config b/openwrt/rhctl/files/rhctl.config index ef8c617..2e4f176 100644 --- a/openwrt/rhctl/files/rhctl.config +++ b/openwrt/rhctl/files/rhctl.config @@ -31,3 +31,4 @@ config 'heartbeatclient' option baudrate '38400' option device '/dev/ttyHeartbeat' option timeout '15' + option led 'heartbeat' \ No newline at end of file -- cgit v0.10.2