wol: Add a init script and a UCI configuration file
authorOliver Ertl <oliver@ertl-net.net>
Wed, 19 Sep 2007 21:21:04 +0000 (21:21 +0000)
committerOliver Ertl <oliver@ertl-net.net>
Wed, 19 Sep 2007 21:21:04 +0000 (21:21 +0000)
SVN-Revision: 8849

net/wol/Makefile
net/wol/files/wol.config [new file with mode: 0644]
net/wol/files/wol.init [new file with mode: 0644]

index fe8616cdcd297dcc89a6d06add6d3bd506ee80b8..c8be97ee0a0b053b5460de02f3435a9a162a52c8 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wol
 PKG_VERSION:=0.7.1
 
 PKG_NAME:=wol
 PKG_VERSION:=0.7.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=@SF/ahh
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 
 PKG_SOURCE_URL:=@SF/ahh
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -40,6 +40,10 @@ CONFIGURE_VARS += \
 define Package/wol/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/bin/
 define Package/wol/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
 endef
 
 $(eval $(call BuildPackage,wol))
 endef
 
 $(eval $(call BuildPackage,wol))
diff --git a/net/wol/files/wol.config b/net/wol/files/wol.config
new file mode 100644 (file)
index 0000000..3a29fcb
--- /dev/null
@@ -0,0 +1,3 @@
+config wol-target
+        option mac       ''
+        option enabled   '0'
diff --git a/net/wol/files/wol.init b/net/wol/files/wol.init
new file mode 100644 (file)
index 0000000..42b2262
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+START=60
+
+append_string() {
+        local section="$1"
+        local option="$2"
+        local value="$3"
+        local _val
+        config_get _val "$section" "$option"
+        [ -n "$_val" ] && append args "$3$_val"
+}
+
+start_service() {
+        local cfg="$1"
+        args=""
+
+        append_string "$cfg" broadcast "--host="
+        append_string "$cfg" port "--port="
+        append_string "$cfg" password "--passwd="
+        append_string "$cfg" mac ""
+        config_get_bool enabled "$cfg" "enabled" '1'
+        [ "$enabled" -gt 0 ] && /usr/bin/wol $args
+}
+
+start() {
+        config_load wol
+        config_foreach start_service wol-target
+}