forked from pool/openvpn
This commit is contained in:
parent
98cb36a7ed
commit
d8962ffe03
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Feb 17 18:22:23 CET 2009 - mt@suse.de
|
||||||
|
|
||||||
|
- Improved init script to show config name in action messages
|
||||||
|
and allow to specify a config name in the second argument.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Dec 1 10:58:12 CET 2008 - mt@suse.de
|
Mon Dec 1 10:58:12 CET 2008 - mt@suse.de
|
||||||
|
|
||||||
|
154
openvpn.init
154
openvpn.init
@ -1,7 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Copyright (c) 2003 SuSE Linux AG
|
# Copyright (c) 2003 SuSE Linux AG
|
||||||
|
# Copyright (c) 2004-2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# Author: Peter Poeml <poeml@suse.de>
|
# Author: Peter Poeml <poeml@suse.de>
|
||||||
|
# Marius Tomaschewski <mt@suse.de>
|
||||||
#
|
#
|
||||||
# inspired by the init script contributed to the OpenVPN project by
|
# inspired by the init script contributed to the OpenVPN project by
|
||||||
# Douglas Keller <doug@voidstar.dyndns.org>
|
# Douglas Keller <doug@voidstar.dyndns.org>
|
||||||
@ -22,7 +24,7 @@
|
|||||||
# Description: Start OpenVPN tunnel
|
# Description: Start OpenVPN tunnel
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
|
# we don't use any...
|
||||||
# test -s /etc/sysconfig/openvpn && \
|
# test -s /etc/sysconfig/openvpn && \
|
||||||
# . /etc/sysconfig/openvpn
|
# . /etc/sysconfig/openvpn
|
||||||
|
|
||||||
@ -67,58 +69,82 @@ rc_reset
|
|||||||
# considered a success.
|
# considered a success.
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
ret=true
|
|
||||||
|
|
||||||
case "$1" in
|
action="$1" ; shift
|
||||||
|
config="$1" ; shift
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
start)
|
start)
|
||||||
echo -n "Starting $DAEMON "
|
|
||||||
|
|
||||||
/sbin/modprobe tun &>/dev/null
|
/sbin/modprobe tun &>/dev/null
|
||||||
|
|
||||||
for conf in $confdir/*.conf; do
|
name=""
|
||||||
pidfile=$piddir/$(basename "${conf%%.conf}").pid
|
for conf in $confdir/${config:-*}.conf ; do
|
||||||
if [ -e "$pidfile" ]; then
|
test -f "$conf" || continue
|
||||||
|
name=$(basename "${conf%%.conf}")
|
||||||
|
pidfile="$piddir/${name}.pid"
|
||||||
|
|
||||||
|
echo -n "Starting $DAEMON [$name] "
|
||||||
|
|
||||||
|
if [ -f "$pidfile" ]; then
|
||||||
killproc -p "$pidfile" -USR2 $openvpn
|
killproc -p "$pidfile" -USR2 $openvpn
|
||||||
s=$?
|
ret=$?
|
||||||
case $s in
|
case $ret in
|
||||||
0) continue ;; # no an error
|
7) # not running, remove pid and start
|
||||||
7) rm -f "$pidfile" ;; # not running
|
echo -n "(removed stale pid file) " ;
|
||||||
*) ret=false ; continue ;;
|
rm -f "$pidfile" ;;
|
||||||
|
0) # running - no an error, skip start
|
||||||
|
rc_failed 0 ; rc_status -v ; continue ;;
|
||||||
|
*) # another error, set it and continue
|
||||||
|
rc_failed 1 ; rc_status -v ; continue ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
# openvpn may ask for auth ...
|
||||||
|
echo ""
|
||||||
|
|
||||||
$openvpn --daemon \
|
$openvpn --daemon \
|
||||||
--writepid "$pidfile" \
|
--writepid "$pidfile" \
|
||||||
--config "$conf" \
|
--config "$conf" \
|
||||||
--cd $confdir \
|
--cd $confdir \
|
||||||
|| ret=false
|
|| rc_failed 1
|
||||||
done
|
|
||||||
|
# write the status one line up
|
||||||
|
rc_status -v1
|
||||||
|
done
|
||||||
|
test -n "$name" || {
|
||||||
|
echo 1>&2 "No $DAEMON${config:+ '$config'} configuration file found"
|
||||||
|
rc_failed 6
|
||||||
|
}
|
||||||
|
rc_status
|
||||||
|
|
||||||
# Remember status and be verbose
|
|
||||||
$ret
|
|
||||||
rc_status -v
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Shutting down $DAEMON "
|
|
||||||
|
|
||||||
## Stop daemon with killproc(8) and if this fails
|
## Stop daemon with killproc(8) and if this fails
|
||||||
## set echo the echo return value.
|
## set echo the echo return value.
|
||||||
|
|
||||||
for i in $piddir/*.pid; do
|
name=""
|
||||||
killproc -p "$i" $openvpn || ret=false
|
for pidfile in $piddir/${config:-*}.pid; do
|
||||||
done
|
test -f "$pidfile" || continue
|
||||||
|
name=$(basename "${pidfile%%.pid}")
|
||||||
|
|
||||||
# Remember status and be verbose
|
echo -n "Shutting down $DAEMON [$name] "
|
||||||
$ret
|
killproc -p "$pidfile" $openvpn
|
||||||
rc_status -v
|
rc_status -v
|
||||||
|
rm -f "$pidfile"
|
||||||
|
done
|
||||||
|
test -n "$name" || {
|
||||||
|
echo 1>&2 "No $DAEMON${config:+ for '$config' configuration} running"
|
||||||
|
}
|
||||||
|
|
||||||
|
rc_status
|
||||||
;;
|
;;
|
||||||
try-restart)
|
try-restart)
|
||||||
## Do a restart only if the service was active before.
|
## Do a restart only if the service was active before.
|
||||||
## Note: try-restart is now part of LSB (as of 1.9).
|
## Note: try-restart is now part of LSB (as of 1.9).
|
||||||
## RH has a similar command named condrestart.
|
## RH has a similar command named condrestart.
|
||||||
$0 status
|
$0 status ${config:+"$config"}
|
||||||
if test $? = 0; then
|
if test $? = 0; then
|
||||||
$0 restart
|
$0 restart ${config:+"$config"}
|
||||||
else
|
else
|
||||||
rc_reset # Not running is not a failure.
|
rc_reset # Not running is not a failure.
|
||||||
fi
|
fi
|
||||||
@ -128,43 +154,81 @@ case "$1" in
|
|||||||
restart)
|
restart)
|
||||||
## Stop the service and regardless of whether it was
|
## Stop the service and regardless of whether it was
|
||||||
## running or not, start it again.
|
## running or not, start it again.
|
||||||
$0 stop
|
$0 stop ${config:+"$config"}
|
||||||
sleep 3
|
sleep 3
|
||||||
$0 start
|
$0 start ${config:+"$config"}
|
||||||
|
|
||||||
# Remember status and be quiet
|
# Remember status and be quiet
|
||||||
rc_status
|
rc_status
|
||||||
;;
|
;;
|
||||||
reload|force-reload)
|
reopen|reload|force-reload)
|
||||||
for i in $piddir/*.pid; do
|
for pidfile in $piddir/${config:-*}.pid; do
|
||||||
killproc -p "$i" -HUP $openvpn || ret=false
|
test -f "$pidfile" || continue
|
||||||
done
|
name=$(basename "${pidfile%%.pid}")
|
||||||
|
|
||||||
|
echo -n "Reload service $DAEMON [$name] "
|
||||||
|
killproc -p "$pidfile" -HUP $openvpn
|
||||||
rc_status -v
|
rc_status -v
|
||||||
|
done
|
||||||
|
rc_status
|
||||||
;;
|
;;
|
||||||
reopen)
|
reopen)
|
||||||
for i in $piddir/*.pid; do
|
for pidfile in $piddir/${config:-*}.pid; do
|
||||||
killproc -p "$i" -USR1 $openvpn || ret=false
|
test -f "$pidfile" || continue
|
||||||
done
|
name=$(basename "${pidfile%%.pid}")
|
||||||
|
|
||||||
|
echo -n "Reopen service $DAEMON [$name] "
|
||||||
|
killproc -p "$pidfile" -USR1 $openvpn
|
||||||
rc_status -v
|
rc_status -v
|
||||||
|
done
|
||||||
|
rc_status
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
echo -n "Checking for $DAEMON: "
|
name=""
|
||||||
running=false
|
for pidfile in $piddir/${config:-*}.pid; do
|
||||||
for i in $piddir/*.pid; do
|
test -f "$pidfile" || continue
|
||||||
running=true
|
name=$(basename "${pidfile%%.pid}")
|
||||||
killproc -p "$i" -USR2 $openvpn || { rv=$?; ret=false; }
|
|
||||||
done
|
echo -n "Checking for $DAEMON [$name] "
|
||||||
if $running; then
|
killproc -p "$pidfile" -USR2 $openvpn
|
||||||
$ret
|
|
||||||
rc_status -v
|
rc_status -v
|
||||||
echo Status written to /var/log/messages
|
done
|
||||||
|
if test -n "$name" ; then
|
||||||
|
echo "$DAEMON status written to /var/log/messages"
|
||||||
else
|
else
|
||||||
|
echo -n "Checking for $DAEMON "
|
||||||
rc_failed 3
|
rc_failed 3
|
||||||
rc_status -v
|
rc_status -v
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
probe)
|
||||||
|
## Optional: Probe for the necessity of a reload, print out the
|
||||||
|
## argument to this init script which is required for a reload.
|
||||||
|
## Note: probe is not (yet) part of LSB (as of 1.9)
|
||||||
|
result=""
|
||||||
|
for conf in $confdir/${config:-*}.conf ; do
|
||||||
|
test -f "$conf" || continue
|
||||||
|
name=$(basename "${conf%%.conf}")
|
||||||
|
pidfile="$piddir/${name}.pid"
|
||||||
|
|
||||||
|
if test ! -f "$pidfile" ; then
|
||||||
|
result="restart"
|
||||||
|
elif test "$conf" -nt "$pidfile" ; then
|
||||||
|
test "$result" = "restart" || \
|
||||||
|
result="reload"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for pidfile in $piddir/${config:-*}.pid; do
|
||||||
|
test -f "$pidfile" || continue
|
||||||
|
name=$(basename "${pidfile%%.pid}")
|
||||||
|
conf="$confdir/${name}.conf"
|
||||||
|
|
||||||
|
test -f "$conf" && result="restart"
|
||||||
|
done
|
||||||
|
test -n "$result" && echo "$result"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|status|try-restart|restart|reload|reopen}"
|
echo "Usage: $0 {start|stop|status|try-restart|restart|reload|reopen|probe}"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
rc_exit
|
rc_exit
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package openvpn (Version 2.0.9)
|
# spec file for package openvpn (Version 2.0.9)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -27,7 +27,7 @@ AutoReqProv: on
|
|||||||
PreReq: %insserv_prereq %fillup_prereq
|
PreReq: %insserv_prereq %fillup_prereq
|
||||||
%endif
|
%endif
|
||||||
Version: 2.0.9
|
Version: 2.0.9
|
||||||
Release: 143
|
Release: 144
|
||||||
Summary: Full-featured SSL VPN solution using a TUN/TAP Interface
|
Summary: Full-featured SSL VPN solution using a TUN/TAP Interface
|
||||||
Source: http://openvpn.net/release/openvpn-%{version}.tar.gz
|
Source: http://openvpn.net/release/openvpn-%{version}.tar.gz
|
||||||
Source1: http://openvpn.net/signatures/openvpn-%{version}.tar.gz.asc
|
Source1: http://openvpn.net/signatures/openvpn-%{version}.tar.gz.asc
|
||||||
@ -221,6 +221,9 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi
|
|||||||
%{plugin_libdir}/openvpn-auth-pam.so
|
%{plugin_libdir}/openvpn-auth-pam.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Feb 17 2009 mt@suse.de
|
||||||
|
- Improved init script to show config name in action messages
|
||||||
|
and allow to specify a config name in the second argument.
|
||||||
* Mon Dec 01 2008 mt@suse.de
|
* Mon Dec 01 2008 mt@suse.de
|
||||||
- Removed restart_on_update rpm install hook that may break the
|
- Removed restart_on_update rpm install hook that may break the
|
||||||
update process, e.g. when openvpn asks for auth data or the
|
update process, e.g. when openvpn asks for auth data or the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user