From ec90a818aff984ff2b2205b7f9726afbac9d9eba Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Wed, 20 Jun 2007 12:23:02 +0000 Subject: [PATCH] Add an init script as well as a default options file, make it more fancy and ready to use SVN-Revision: 7681 --- net/openvpn/Makefile | 4 ++++ net/openvpn/files/openvpn.default | 2 ++ net/openvpn/files/openvpn.init | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 net/openvpn/files/openvpn.default create mode 100644 net/openvpn/files/openvpn.init diff --git a/net/openvpn/Makefile b/net/openvpn/Makefile index c55efe1b34..294948b104 100644 --- a/net/openvpn/Makefile +++ b/net/openvpn/Makefile @@ -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 index 0000000000..f53d7e6546 --- /dev/null +++ b/net/openvpn/files/openvpn.default @@ -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 index 0000000000..2d90230c79 --- /dev/null +++ b/net/openvpn/files/openvpn.init @@ -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) +} -- 2.30.2