forked from pool/openvpn
Accepting request 150171 from network:vpn
- Join openvpn.service systemd cgroup in start when needed, e.g. when starting with further parameters. (bnc#781106) (forwarded request 150170 from mtomaschewski) OBS-URL: https://build.opensuse.org/request/show/150171 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openvpn?expand=0&rev=44
This commit is contained in:
commit
df91aeab5a
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 28 13:59:07 UTC 2013 - mt@suse.com
|
||||
|
||||
- Join openvpn.service systemd cgroup in start when needed, e.g.
|
||||
when starting with further parameters. (bnc#781106)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 29 18:19:40 CET 2012 - sbrabec@suse.cz
|
||||
|
||||
|
31
openvpn.init
31
openvpn.init
@ -72,6 +72,35 @@ shopt -s nullglob
|
||||
action="$1" ; shift
|
||||
config="$1" ; shift
|
||||
|
||||
systemd_cgroup_dir="/sys/fs/cgroup/systemd"
|
||||
openvpn_cgroup_dir="${systemd_cgroup_dir}/system/openvpn.service"
|
||||
|
||||
join_openvpn_service_cgroup()
|
||||
{
|
||||
local pid dummy
|
||||
|
||||
# when the systemd cgroup mountpoint does not exists,
|
||||
# assume we run unter systemv init -> nothing to do.
|
||||
/bin/mountpoint -q "${systemd_cgroup_dir}" || return 0
|
||||
|
||||
# create the openvpn.service cgroup when needed
|
||||
if test ! -d "${openvpn_cgroup_dir}" ; then
|
||||
/bin/mkdir -p "${openvpn_cgroup_dir}" || return 1
|
||||
fi
|
||||
|
||||
# check if the openvpn.service cgroup task list exists
|
||||
if test -f "${openvpn_cgroup_dir}/tasks" ; then
|
||||
# when we're already a member, all is done
|
||||
while read pid dummy ; do
|
||||
test "$pid" = "$$" && return 0
|
||||
done < "${openvpn_cgroup_dir}/tasks"
|
||||
|
||||
# otherwise join the openvpn.service cgroup
|
||||
echo "$$" > "${openvpn_cgroup_dir}/tasks" && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
autostart_filter()
|
||||
{
|
||||
test "x$config" != "x" && return 0
|
||||
@ -84,6 +113,8 @@ autostart_filter()
|
||||
|
||||
case "$action" in
|
||||
start)
|
||||
join_openvpn_service_cgroup
|
||||
|
||||
/sbin/modprobe tun &>/dev/null
|
||||
|
||||
name=""
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package openvpn
|
||||
#
|
||||
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
|
Loading…
Reference in New Issue
Block a user