Add an init script as well as a default options file, make it more fancy and ready...
authorFlorian Fainelli <florian@openwrt.org>
Wed, 20 Jun 2007 12:23:02 +0000 (12:23 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 20 Jun 2007 12:23:02 +0000 (12:23 +0000)
SVN-Revision: 7681

net/openvpn/Makefile
net/openvpn/files/openvpn.default [new file with mode: 0644]
net/openvpn/files/openvpn.init [new file with mode: 0644]

index c55efe1b34766861c714107f0fc540362841ffea..294948b1041e22e1d9f9e2a2813514a193369ec8 100644 (file)
@@ -58,6 +58,10 @@ endef
 define Package/openvpn/install 
        $(INSTALL_DIR) $(1)/usr/sbin
        $(CP) $(PKG_INSTALL_DIR)/usr/sbin/openvpn $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_BIN) files/$(PKG_NAME).default $(1)/etc/default/$(PKG_NAME)
 endef
 
 define Package/openvpn-easy-rsa/install        
diff --git a/net/openvpn/files/openvpn.default b/net/openvpn/files/openvpn.default
new file mode 100644 (file)
index 0000000..f53d7e6
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG="/etc/openvpn/server.conf"
+OPTIONS="--config $CONFIG --daemon"
diff --git a/net/openvpn/files/openvpn.init b/net/openvpn/files/openvpn.init
new file mode 100644 (file)
index 0000000..2d90230
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+START=70
+BIN=openvpn
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       mkdir -p $RUN_D
+       $BIN $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}