pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/openvpn-current Add a rc.d control script for open...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b26e4ef0489b
branches:  trunk
changeset: 485354:b26e4ef0489b
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Dec 07 21:29:57 2004 +0000

description:
Add a rc.d control script for openvpn.

diffstat:

 net/openvpn-current/Makefile         |   4 +-
 net/openvpn-current/files/openvpn.sh |  66 ++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 1 deletions(-)

diffs (92 lines):

diff -r 1322c9680325 -r b26e4ef0489b net/openvpn-current/Makefile
--- a/net/openvpn-current/Makefile      Tue Dec 07 21:28:20 2004 +0000
+++ b/net/openvpn-current/Makefile      Tue Dec 07 21:29:57 2004 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.9 2004/12/03 23:19:01 jlam Exp $
+# $NetBSD: Makefile,v 1.10 2004/12/07 21:29:57 jlam Exp $
 #
 
 DISTNAME=      openvpn-2.0_beta15
 PKGNAME=       ${DISTNAME:S/_//}
+PKGREVISION=   1
 CATEGORIES=    net
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=openvpn/}
 
@@ -18,6 +19,7 @@
 
 PKG_SYSCONFSUBDIR=     openvpn
 EGDIR=                 ${PREFIX}/share/examples/${PKGBASE}
+RCD_SCRIPTS=           openvpn
 
 CONFIGURE_ARGS+=       --enable-pthread
 CONFIGURE_ARGS+=       --enable-lzo
diff -r 1322c9680325 -r b26e4ef0489b net/openvpn-current/files/openvpn.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/openvpn-current/files/openvpn.sh      Tue Dec 07 21:29:57 2004 +0000
@@ -0,0 +1,66 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: openvpn.sh,v 1.1 2004/12/07 21:29:57 jlam Exp $
+#
+# PROVIDE: openvpn
+# REQUIRE: NETWORKING
+#
+# To start openvpn at startup, copy this script to /etc/rc.d.  You will
+# also need to set the following variables:
+#
+# openvpn=YES
+# openvpn_cfg="server.conf"    # whitespace-separated list of OpenVPN
+#                              # config files relative to directory
+#                              # @PKG_SYSCONFDIR@.
+#
+# For information on how to write an OpenVPN config file, please read the
+# openvpn(8) man page or check the website at:
+#
+#      http://openvpn.sourceforge.net/
+#
+
+. /etc/rc.subr
+
+name="openvpn"
+rcvar=$name
+sysconfdir="@PKG_SYSCONFDIR@"
+command="@PREFIX@/sbin/openvpn"
+command_args="--cd $sysconfdir --daemon"
+extra_commands="reload"
+required_dirs="$sysconfdir"
+
+start_cmd="openvpn_start"
+
+openvpn_start()
+{
+       for d in $required_dirs; do
+               if [ ! -d "$d/." ]; then
+                       warn "$d is not a directory."
+                       return 1
+               fi
+       done
+       if [ -z "$openvpn_cfg" ]; then
+               warn "\$openvpn_cfg is not set."
+               return 1
+       fi
+       savewd="$PWD"
+       cd $sysconfdir
+       for f in $openvpn_cfg; do
+               if [ ! -r "$f" ]; then
+                       warn "$f is not readable."
+                       cd $savewd
+                       return 1
+               fi
+       done
+       for f in $openvpn_cfg; do
+               doit="$command $command_args --config $f"
+               if ! eval $doit; then
+                       cd $savewd
+                       return 1
+               fi
+       done
+       cd $savewd
+}
+
+load_rc_config $name
+run_rc_command "$1"



Home | Main Index | Thread Index | Old Index