[Midnightbsd-cvs] mports [16566] trunk/security/openvpn/files: move openvpn rc script to follow current standards.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Aug 23 08:42:50 EDT 2014


Revision: 16566
          http://svnweb.midnightbsd.org/mports/?rev=16566
Author:   laffer1
Date:     2014-08-23 08:42:46 -0400 (Sat, 23 Aug 2014)
Log Message:
-----------
move openvpn rc script to follow current standards.

Added Paths:
-----------
    trunk/security/openvpn/files/openvpn.in

Removed Paths:
-------------
    trunk/security/openvpn/files/openvpn.sh.in

Copied: trunk/security/openvpn/files/openvpn.in (from rev 16495, trunk/security/openvpn/files/openvpn.sh.in)
===================================================================
--- trunk/security/openvpn/files/openvpn.in	                        (rev 0)
+++ trunk/security/openvpn/files/openvpn.in	2014-08-23 12:42:46 UTC (rev 16566)
@@ -0,0 +1,134 @@
+#!/bin/sh
+#
+# openvpn.sh - load tun/tap driver and start OpenVPN daemon
+#
+# (C) Copyright 2005 - 2008, 2010 by Matthias Andree
+# based on suggestions by Matthias Grimm and Dirk Gouders
+# with multi-instance contribution from Denis Shaposhnikov, Gleb Kozyrev
+# and Vasil Dimov
+# softrestart feature suggested by Nick Hibma
+#
+# $FreeBSD: ports/security/openvpn/files/openvpn.sh.in,v 1.15 2011/01/08 10:04:58 mandree Exp $
+# 
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+# Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# PROVIDE: openvpn
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+# -----------------------------------------------------------------------------
+#
+# This script supports running multiple instances of openvpn.
+# To run additional instances link this script to something like
+# % ln -s openvpn openvpn_foo
+# and define additional openvpn_foo_* variables in one of
+# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/openvpn_foo
+#
+# Below NAME should be substituted with the name of this script. By default
+# it is openvpn, so read as openvpn_enable. If you linked the script to
+# openvpn_foo, then read as openvpn_foo_enable etc.
+#
+# The following variables are supported (defaults are shown).
+# You can place them in any of
+# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/NAME
+#
+# NAME_enable="NO"	# set to YES to enable openvpn
+# NAME_if=""		# driver(s) to load, set to "tun", "tap" or "tun tap"
+#
+# # optional:
+# NAME_flags=""				# additional command line arguments
+# NAME_configfile="%%PREFIX%%/etc/openvpn/NAME.conf"	# --config file
+# NAME_dir="%%PREFIX%%/etc/openvpn"	# --cd directory
+#
+# You also need to set NAME_configfile and NAME_dir, if the configuration
+# file and directory where keys and certificates reside differ from the above
+# settings.
+#
+# Note that we deliberately refrain from unloading drivers.
+#
+# For further documentation, please see openvpn(8).
+#
+
+. /etc/rc.subr
+
+case "$0" in
+/etc/rc*)
+	# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
+	# so get the name of the script from $_file
+	name="$_file"
+	;;
+*)
+	name="$0"
+	;;
+esac
+
+name="${name##*/}"
+
+rcvar=$(set_rcvar)
+
+openvpn_precmd()
+{
+	for i in $interfaces ; do
+		if ! sysctl debug.if_${i}_debug >/dev/null 2>&1 ; then
+			if ! kldload if_${i} ; then
+				warn "Could not load $i module."
+				return 1
+			fi
+		fi
+	done
+	return 0
+}
+
+stop_postcmd()
+{
+	rm -f "$pidfile" || warn "Could not remove $pidfile."
+}
+
+softrestart()
+{
+    sig_reload=USR1 run_rc_command reload
+    exit $?
+}
+
+# reload: support SIGHUP to reparse configuration file
+# softrestart: support SIGUSR1 to reconnect without superuser privileges
+extra_commands="reload softrestart"
+softrestart_cmd="softrestart"
+
+# pidfile
+pidfile="/var/run/${name}.pid"
+
+# command and arguments
+command="%%PREFIX%%/sbin/openvpn"
+
+# run this first
+start_precmd="openvpn_precmd"
+# and this last
+stop_postcmd="stop_postcmd"
+
+load_rc_config ${name}
+
+eval ": \${${name}_enable:=\"NO\"}"
+eval ": \${${name}_configfile:=\"%%PREFIX%%/etc/openvpn/${name}.conf\"}"
+eval ": \${${name}_dir:=\"%%PREFIX%%/etc/openvpn\"}"
+
+configfile="$(eval echo \${${name}_configfile})"
+dir="$(eval echo \${${name}_dir})"
+interfaces="$(eval echo \${${name}_if})"
+
+required_files=${configfile}
+command_args="--cd ${dir} --daemon ${name} --config ${configfile} --writepid ${pidfile}"
+
+run_rc_command "$1"

Deleted: trunk/security/openvpn/files/openvpn.sh.in
===================================================================
--- trunk/security/openvpn/files/openvpn.sh.in	2014-08-23 02:59:49 UTC (rev 16565)
+++ trunk/security/openvpn/files/openvpn.sh.in	2014-08-23 12:42:46 UTC (rev 16566)
@@ -1,134 +0,0 @@
-#!/bin/sh
-#
-# openvpn.sh - load tun/tap driver and start OpenVPN daemon
-#
-# (C) Copyright 2005 - 2008, 2010 by Matthias Andree
-# based on suggestions by Matthias Grimm and Dirk Gouders
-# with multi-instance contribution from Denis Shaposhnikov, Gleb Kozyrev
-# and Vasil Dimov
-# softrestart feature suggested by Nick Hibma
-#
-# $FreeBSD: ports/security/openvpn/files/openvpn.sh.in,v 1.15 2011/01/08 10:04:58 mandree Exp $
-# 
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
-# Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# PROVIDE: openvpn
-# REQUIRE: DAEMON
-# KEYWORD: shutdown
-
-# -----------------------------------------------------------------------------
-#
-# This script supports running multiple instances of openvpn.
-# To run additional instances link this script to something like
-# % ln -s openvpn openvpn_foo
-# and define additional openvpn_foo_* variables in one of
-# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/openvpn_foo
-#
-# Below NAME should be substituted with the name of this script. By default
-# it is openvpn, so read as openvpn_enable. If you linked the script to
-# openvpn_foo, then read as openvpn_foo_enable etc.
-#
-# The following variables are supported (defaults are shown).
-# You can place them in any of
-# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/NAME
-#
-# NAME_enable="NO"	# set to YES to enable openvpn
-# NAME_if=""		# driver(s) to load, set to "tun", "tap" or "tun tap"
-#
-# # optional:
-# NAME_flags=""				# additional command line arguments
-# NAME_configfile="%%PREFIX%%/etc/openvpn/NAME.conf"	# --config file
-# NAME_dir="%%PREFIX%%/etc/openvpn"	# --cd directory
-#
-# You also need to set NAME_configfile and NAME_dir, if the configuration
-# file and directory where keys and certificates reside differ from the above
-# settings.
-#
-# Note that we deliberately refrain from unloading drivers.
-#
-# For further documentation, please see openvpn(8).
-#
-
-. /etc/rc.subr
-
-case "$0" in
-/etc/rc*)
-	# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
-	# so get the name of the script from $_file
-	name="$_file"
-	;;
-*)
-	name="$0"
-	;;
-esac
-
-name="${name##*/}"
-
-rcvar=$(set_rcvar)
-
-openvpn_precmd()
-{
-	for i in $interfaces ; do
-		if ! sysctl debug.if_${i}_debug >/dev/null 2>&1 ; then
-			if ! kldload if_${i} ; then
-				warn "Could not load $i module."
-				return 1
-			fi
-		fi
-	done
-	return 0
-}
-
-stop_postcmd()
-{
-	rm -f "$pidfile" || warn "Could not remove $pidfile."
-}
-
-softrestart()
-{
-    sig_reload=USR1 run_rc_command reload
-    exit $?
-}
-
-# reload: support SIGHUP to reparse configuration file
-# softrestart: support SIGUSR1 to reconnect without superuser privileges
-extra_commands="reload softrestart"
-softrestart_cmd="softrestart"
-
-# pidfile
-pidfile="/var/run/${name}.pid"
-
-# command and arguments
-command="%%PREFIX%%/sbin/openvpn"
-
-# run this first
-start_precmd="openvpn_precmd"
-# and this last
-stop_postcmd="stop_postcmd"
-
-load_rc_config ${name}
-
-eval ": \${${name}_enable:=\"NO\"}"
-eval ": \${${name}_configfile:=\"%%PREFIX%%/etc/openvpn/${name}.conf\"}"
-eval ": \${${name}_dir:=\"%%PREFIX%%/etc/openvpn\"}"
-
-configfile="$(eval echo \${${name}_configfile})"
-dir="$(eval echo \${${name}_dir})"
-interfaces="$(eval echo \${${name}_if})"
-
-required_files=${configfile}
-command_args="--cd ${dir} --daemon ${name} --config ${configfile} --writepid ${pidfile}"
-
-run_rc_command "$1"



More information about the Midnightbsd-cvs mailing list