pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/openvpn Add a "reset" action to the openvpn rc.d s...
details: https://anonhg.NetBSD.org/pkgsrc/rev/c68c681c85e9
branches: trunk
changeset: 499283:c68c681c85e9
user: jlam <jlam%pkgsrc.org@localhost>
date: Sun Sep 18 03:11:39 2005 +0000
description:
Add a "reset" action to the openvpn rc.d script which triggers a
SIGUSR1 reset of the openvpn process. This is useful for simplifying
dhclient-exit-hooks hook scripts that need to tell the openvpn process
to reset and re-run its "up" script.
Bump the PKGREVISION of net/openvpn to 1.
diffstat:
net/openvpn/Makefile | 3 ++-
net/openvpn/files/openvpn.sh | 32 ++++++++++++++++++++++++++++++--
2 files changed, 32 insertions(+), 3 deletions(-)
diffs (78 lines):
diff -r 13cf42c64698 -r c68c681c85e9 net/openvpn/Makefile
--- a/net/openvpn/Makefile Sun Sep 18 01:25:07 2005 +0000
+++ b/net/openvpn/Makefile Sun Sep 18 03:11:39 2005 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.9 2005/09/01 03:40:42 jlam Exp $
+# $NetBSD: Makefile,v 1.10 2005/09/18 03:11:39 jlam Exp $
#
DISTNAME= openvpn-2.0.2
PKGNAME= ${DISTNAME:S/_//}
+PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= http://openvpn.net/release/ \
http://openvpn.net/release/old/
diff -r 13cf42c64698 -r c68c681c85e9 net/openvpn/files/openvpn.sh
--- a/net/openvpn/files/openvpn.sh Sun Sep 18 01:25:07 2005 +0000
+++ b/net/openvpn/files/openvpn.sh Sun Sep 18 03:11:39 2005 +0000
@@ -1,6 +1,6 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: openvpn.sh,v 1.1 2005/08/17 19:55:57 jlam Exp $
+# $NetBSD: openvpn.sh,v 1.2 2005/09/18 03:11:40 jlam Exp $
#
# PROVIDE: openvpn
# REQUIRE: NETWORKING
@@ -20,6 +20,9 @@
# # a process is started for all
# # *.conf files.
#
+# The "reset" action will trigger a SIGUSR1 restart of the OpenVPN
+# process. Please read the openvpn(8) man page for more details.
+#
# For information on how to write an OpenVPN config file, please read the
# openvpn(8) man page or check the website at:
#
@@ -33,10 +36,11 @@
sysconfdir="@PKG_SYSCONFDIR@"
command="@PREFIX@/sbin/openvpn"
command_args="--cd $sysconfdir --daemon"
-extra_commands="reload"
+extra_commands="reload reset"
required_dirs="$sysconfdir"
start_cmd="openvpn_start"
+reset_cmd="openvpn_reset"
openvpn_start()
{
@@ -71,5 +75,29 @@
cd $savewd
}
+openvpn_reset()
+{
+ if [ -z "$rc_pid" ]; then
+ if [ -n "$pidfile" ]; then
+ echo 1>&2 \
+ "${name} not running? (check $pidfile)."
+ else
+ echo 1>&2 "${name} not running?"
+ fi
+ exit 1
+ fi
+ echo "Triggering SIGUSR1 restart of ${name}."
+ if ! eval $_precmd && [ -z "$rc_force" ]; then
+ return 1
+ fi
+ _doit="kill -${sig_reload:-USR1} $rc_pid"
+ if [ -n "$_user" ]; then
+ _doit="su -m $_user -c 'sh -c \"$_doit\"'"
+ fi
+ if ! eval $_doit && [ -z "$rc_force" ]; then
+ return 1
+ fi
+}
+
load_rc_config $name
run_rc_command "$1"
Home |
Main Index |
Thread Index |
Old Index