diff options
author | jlam <jlam@pkgsrc.org> | 2004-12-07 21:29:57 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-12-07 21:29:57 +0000 |
commit | 83a405338ccc33718d5858d95bf760e9a56579b2 (patch) | |
tree | 5e74142529f53bf7b79ad655730f8fc9fd160c66 | |
parent | 7b32a17cba39b91cb3a717977f4bf4633dafec2a (diff) | |
download | pkgsrc-83a405338ccc33718d5858d95bf760e9a56579b2.tar.gz |
Add a rc.d control script for openvpn.
-rw-r--r-- | net/openvpn-current/Makefile | 4 | ||||
-rw-r--r-- | net/openvpn-current/files/openvpn.sh | 66 |
2 files changed, 69 insertions, 1 deletions
diff --git a/net/openvpn-current/Makefile b/net/openvpn-current/Makefile index 5c3c0f369f9..2a7d6b87b6f 100644 --- a/net/openvpn-current/Makefile +++ b/net/openvpn-current/Makefile @@ -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 @@ USE_OLD_DES_API= yes PKG_SYSCONFSUBDIR= openvpn EGDIR= ${PREFIX}/share/examples/${PKGBASE} +RCD_SCRIPTS= openvpn CONFIGURE_ARGS+= --enable-pthread CONFIGURE_ARGS+= --enable-lzo diff --git a/net/openvpn-current/files/openvpn.sh b/net/openvpn-current/files/openvpn.sh new file mode 100644 index 00000000000..0b679e96e18 --- /dev/null +++ b/net/openvpn-current/files/openvpn.sh @@ -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" |