summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openwrt/rhctl/Makefile7
-rwxr-xr-xopenwrt/rhctl/files/heartbeatclient.init56
-rw-r--r--openwrt/rhctl/files/rhctl.config1
3 files changed, 61 insertions, 3 deletions
diff --git a/openwrt/rhctl/Makefile b/openwrt/rhctl/Makefile
index dad5bd3..84fc2e3 100644
--- a/openwrt/rhctl/Makefile
+++ b/openwrt/rhctl/Makefile
@@ -12,13 +12,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=rhctl
-PKG_VERSION:=0.2
+PKG_VERSION:=0.3
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:=1a6f4d51c77a3e5b56b574d4dc0d4c86
+PKG_MD5SUM:=646e9d1439cc9c23d3cb64773b34c513
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
@@ -60,6 +60,7 @@ define Build/Compile
$(STRIP) $(PKG_BUILD_DIR)/switchctl
$(STRIP) $(PKG_BUILD_DIR)/serialclient
$(STRIP) $(PKG_BUILD_DIR)/stdioclient
+ $(STRIP) $(PKG_BUILD_DIR)/heartbeatclient
endef
define Package/rhctl/install
@@ -71,11 +72,13 @@ define Package/rhctl/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/switchctl $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/serialclient $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/stdioclient $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/heartbeatclient $(1)/usr/bin/
$(INSTALL_BIN) ./files/rhctlsh $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/udev.init $(1)/etc/init.d/udev
$(INSTALL_BIN) ./files/switchctl.init $(1)/etc/init.d/switchctl
$(INSTALL_BIN) ./files/serialclient.init $(1)/etc/init.d/serialclient
+ $(INSTALL_BIN) ./files/heartbeatclient.init $(1)/etc/init.d/heartbeatclient
$(INSTALL_DIR) $(1)/etc/udev/rules.d
$(INSTALL_DATA) ./files/udev.rules $(1)/etc/udev/rules.d/50-rhctl.rules
endef
diff --git a/openwrt/rhctl/files/heartbeatclient.init b/openwrt/rhctl/files/heartbeatclient.init
new file mode 100755
index 0000000..1b7d004
--- /dev/null
+++ b/openwrt/rhctl/files/heartbeatclient.init
@@ -0,0 +1,56 @@
+#!/bin/sh /etc/rc.common
+START=72
+
+BIN=heartbeatclient
+DAEMON=/usr/bin/$BIN
+DESC=$BIN
+RUN_D=/var/run/rhctl
+PIDFILE=$RUN_D/$BIN.pid
+
+
+option_cb() {
+ local varname="$1"
+ local value="$2"
+
+ if ! echo "$CONFIG_OPTIONS" | grep " $varname " > /dev/null; then
+ CONFIG_OPTIONS="$CONFIG_OPTIONS $varname "
+ fi
+}
+
+start_daemon() {
+ local option
+ local value
+ local args=""
+
+ for option in $CONFIG_OPTIONS
+ do
+ config_get value "$1" "$option"
+ option=`echo $option | tr '_' '-'`
+ if [ -n "$value" ]; then
+ args="$args --$option $value"
+ fi
+ done
+ local status="OK"
+ $DAEMON --write-pid $PIDFILE $args || status="failed"
+ echo -n " ($status)"
+}
+
+start() {
+ echo -n "Starting $DESC:"
+ config_load "rhctl"
+ mkdir -p $RUN_D
+ config_foreach start_daemon "hearbeatclient"
+ echo "."
+}
+
+stop() {
+ echo -n "Stopping $DESC:"
+ if [ -f $PIDFILE ]; then
+ kill `cat $PIDFILE` > /dev/null 2>&1
+ rm -f $PIDFILE > /dev/null 2>&1
+ echo -n " (Ok)"
+ else
+ echo -n " (not running)"
+ fi
+ echo "."
+}
diff --git a/openwrt/rhctl/files/rhctl.config b/openwrt/rhctl/files/rhctl.config
index 1b14f04..3b4874e 100644
--- a/openwrt/rhctl/files/rhctl.config
+++ b/openwrt/rhctl/files/rhctl.config
@@ -25,7 +25,6 @@ config 'serialclient'
option type 'standby'
config 'heartbeatclient'
- option disabled 1
option command_sock '/var/run/rhctl/switchctl.sock'
option baudrate '38400'
option device '/dev/ttyHeartbeat'