forked from pool/openvpn
Accepting request 135135 from network:vpn
reopen fix (bnc#781106), autostart list (bnc#692440) OBS-URL: https://build.opensuse.org/request/show/135135 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openvpn?expand=0&rev=40
This commit is contained in:
commit
c7474fbb47
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 20 10:50:23 UTC 2012 - mt@suse.com
|
||||
|
||||
- Fixed openvpn init script to not map reopen to reload so the
|
||||
reopen code is without any effect (bnc#781106).
|
||||
- Added requested OPENVPN_AUTOSTART variable allowing to provide
|
||||
an optional list of config names started by default (bnc#692440).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 22 14:50:39 UTC 2012 - cfarrell@suse.com
|
||||
|
||||
|
41
openvpn.init
41
openvpn.init
@ -24,9 +24,8 @@
|
||||
# Description: Start OpenVPN tunnel
|
||||
### END INIT INFO
|
||||
|
||||
# we don't use any...
|
||||
# test -s /etc/sysconfig/openvpn && \
|
||||
# . /etc/sysconfig/openvpn
|
||||
test -s /etc/sysconfig/openvpn && \
|
||||
. /etc/sysconfig/openvpn
|
||||
|
||||
DAEMON="OpenVPN"
|
||||
openvpn=/usr/sbin/openvpn
|
||||
@ -73,6 +72,16 @@ shopt -s nullglob
|
||||
action="$1" ; shift
|
||||
config="$1" ; shift
|
||||
|
||||
autostart_filter()
|
||||
{
|
||||
test "x$config" != "x" && return 0
|
||||
test "x$OPENVPN_AUTOSTART" = "x" && return 0
|
||||
for n in ${OPENVPN_AUTOSTART} ; do
|
||||
test "x$n" = "x$1" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$action" in
|
||||
start)
|
||||
/sbin/modprobe tun &>/dev/null
|
||||
@ -81,6 +90,7 @@ case "$action" in
|
||||
for conf in $confdir/${config:-*}.conf ; do
|
||||
test -f "$conf" || continue
|
||||
name=$(basename "${conf%%.conf}")
|
||||
autostart_filter "$name" || continue
|
||||
pidfile="$piddir/${name}.pid"
|
||||
|
||||
echo -n "Starting $DAEMON [$name] "
|
||||
@ -164,14 +174,30 @@ case "$action" in
|
||||
restart)
|
||||
## Stop the service and regardless of whether it was
|
||||
## running or not, start it again.
|
||||
$0 stop ${config:+"$config"}
|
||||
sleep 3
|
||||
$0 start ${config:+"$config"}
|
||||
|
||||
# When nothing is running, start specified config or
|
||||
# the defult (autostart) set. Otherwise we stop the
|
||||
# specified one or all that are currently running.
|
||||
# Then start specified one or all that were running
|
||||
# before and have a config. Makes sense? :-)
|
||||
name=""
|
||||
list=($config)
|
||||
for pidfile in $piddir/${config:-*}.pid; do
|
||||
test -f "$pidfile" || continue
|
||||
name=$(basename "${pidfile%%.pid}")
|
||||
$0 stop "$name"
|
||||
rc_status
|
||||
test "x$name" = "x$config" && continue # in list
|
||||
test -f "$confdir/${name}.conf" && list+=("$name")
|
||||
done
|
||||
|
||||
test "x$name" = x || sleep 3 # for what was this needed?
|
||||
|
||||
$0 start "${list[@]}"
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
reopen|reload|force-reload)
|
||||
reload|force-reload)
|
||||
for pidfile in $piddir/${config:-*}.pid; do
|
||||
test -f "$pidfile" || continue
|
||||
name=$(basename "${pidfile%%.pid}")
|
||||
@ -219,6 +245,7 @@ case "$action" in
|
||||
for conf in $confdir/${config:-*}.conf ; do
|
||||
test -f "$conf" || continue
|
||||
name=$(basename "${conf%%.conf}")
|
||||
autostart_filter "$name" || continue
|
||||
pidfile="$piddir/${name}.pid"
|
||||
|
||||
if test ! -f "$pidfile" ; then
|
||||
|
@ -33,6 +33,7 @@ Source2: openvpn.init
|
||||
Source3: openvpn.README.SUSE
|
||||
Source4: client-netconfig.up
|
||||
Source5: client-netconfig.down
|
||||
Source6: openvpn.sysconfig
|
||||
Patch1: %{name}-2.1-plugin-man.dif
|
||||
Patch2: %{name}-2.1-plugin-build.dif
|
||||
Patch3: openvpn-2.1-systemd-passwd.patch
|
||||
@ -194,12 +195,16 @@ for pi in auth-pam down-root; do
|
||||
done
|
||||
# we install docs via spec into _defaultdocdir/name/management-notes.txt
|
||||
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/{OpenVPN,%name}
|
||||
# the /etc/sysconfig/openvpn template
|
||||
install -d -m0755 %{buildroot}/var/adm/fillup-templates
|
||||
install -m0600 $RPM_SOURCE_DIR/openvpn.sysconfig \
|
||||
%{buildroot}/var/adm/fillup-templates/sysconfig.openvpn
|
||||
|
||||
%clean
|
||||
if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi
|
||||
|
||||
%post
|
||||
%{?fillup_and_insserv:%fillup_and_insserv -f}
|
||||
%{?fillup_and_insserv:%fillup_and_insserv}
|
||||
|
||||
%preun
|
||||
%{?stop_on_removal:%stop_on_removal openvpn}
|
||||
@ -228,6 +233,7 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi
|
||||
%dir %{_libdir}/%{name}
|
||||
%dir %{plugin_dir}
|
||||
%dir %{plugin_libdir}
|
||||
/var/adm/fillup-templates/sysconfig.openvpn
|
||||
|
||||
%files down-root-plugin
|
||||
%defattr(-,root,root)
|
||||
|
16
openvpn.sysconfig
Normal file
16
openvpn.sysconfig
Normal file
@ -0,0 +1,16 @@
|
||||
## Type: list("",)
|
||||
## Default: ""
|
||||
#
|
||||
# Allows to specify an optional white-list of config names to start
|
||||
# in /etc/init.d/openvpn.
|
||||
#
|
||||
# Unlisted config names can be still started using the explicit name,
|
||||
# e.g. "/etc/init.d/openvpn start tun0" will start openvpn for the
|
||||
# "/etc/openvpn/tun0.conf" config file.
|
||||
#
|
||||
# Setting the variable to e.g. "foo bar" will cause the start of the
|
||||
# "/etc/openvpn/foo.conf" and "/etc/openvpn/bar.conf" config files.
|
||||
# When empty, the init script will start all existing config files.
|
||||
#
|
||||
OPENVPN_AUTOSTART=""
|
||||
|
Loading…
Reference in New Issue
Block a user