summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2014-03-14 13:02:21 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2014-03-14 13:54:18 +0100
commit3125e393084124442e409bef697847a1f87fc531 (patch)
tree31ff50b7324b4c12e8ea3fa1f9e573f9e59416d0
parent1f88813d1b92c4143e4b47d853c62c9868ed501b (diff)
Add systemd support
-rw-r--r--debian/changelog7
-rw-r--r--debian/openvpn.if-down.d11
-rw-r--r--debian/openvpn.if-up.d11
-rw-r--r--debian/openvpn.install1
-rw-r--r--debian/openvpn@.service13
-rwxr-xr-xdebian/rules2
6 files changed, 40 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog
index e9fc3f4..17733bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+openvpn (2.3.2-8) unstable; urgency=medium
+
+ * Add support for systemd. (Closes: #700888)
+ Add openvpn@.service and --enable-systemd to ./configure.
+
+ -- Alberto Gonzalez Iniesta <agi@inittab.org> Fri, 14 Mar 2014 12:59:57 +0100
+
openvpn (2.3.2-7) unstable; urgency=low
* Fix postinst when no *.pid files exist in /run/sendsigs.omit.d/.
diff --git a/debian/openvpn.if-down.d b/debian/openvpn.if-down.d
index 4610786..77cfb79 100644
--- a/debian/openvpn.if-down.d
+++ b/debian/openvpn.if-down.d
@@ -1,6 +1,8 @@
#!/bin/sh
-OPENVPN=/etc/init.d/openvpn
+OPENVPN=/usr/sbin/openvpn
+OPENVPN_INIT=/etc/init.d/openvpn
+SYSTEMCTL=/bin/systemctl
if [ ! -x $OPENVPN ]; then
exit 0
@@ -8,6 +10,11 @@ fi
if [ -n "$IF_OPENVPN" ]; then
for vpn in $IF_OPENVPN; do
- $OPENVPN stop $vpn
+ ## check systemd present
+ if [ -x $SYSTEMCTL ]; then
+ $SYSTEMCTL stop openvpn@$vpn
+ else
+ $OPENVPN_INIT stop $vpn
+ fi
done
fi
diff --git a/debian/openvpn.if-up.d b/debian/openvpn.if-up.d
index 539112a..a6548a5 100644
--- a/debian/openvpn.if-up.d
+++ b/debian/openvpn.if-up.d
@@ -1,6 +1,8 @@
#!/bin/sh
-OPENVPN=/etc/init.d/openvpn
+OPENVPN=/usr/sbin/openvpn
+OPENVPN_INIT=/etc/init.d/openvpn
+SYSTEMCTL=/bin/systemctl
if [ ! -x $OPENVPN ]; then
exit 0
@@ -8,6 +10,11 @@ fi
if [ -n "$IF_OPENVPN" ]; then
for vpn in $IF_OPENVPN; do
- $OPENVPN start $vpn
+ ## check systemd present
+ if [ -x $SYSTEMCTL ]; then
+ $SYSTEMCTL start openvpn@$vpn
+ else
+ $OPENVPN_INIT start $vpn
+ fi
done
fi
diff --git a/debian/openvpn.install b/debian/openvpn.install
new file mode 100644
index 0000000..f1b4436
--- /dev/null
+++ b/debian/openvpn.install
@@ -0,0 +1 @@
+debian/openvpn@.service /lib/systemd/system
diff --git a/debian/openvpn@.service b/debian/openvpn@.service
new file mode 100644
index 0000000..a7ec1ee
--- /dev/null
+++ b/debian/openvpn@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=OpenVPN connection to %i
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --config /etc/openvpn/%i.conf
+WorkingDirectory=/etc/openvpn
+
+[Install]
+WantedBy=multi-user.target
+
+
diff --git a/debian/rules b/debian/rules
index 95f835d..c5d982d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,7 +14,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
dh $@
override_dh_auto_configure:
- dh_auto_configure -- $(shell dpkg-buildflags --export=configure) --enable-password-save --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --with-ifconfig-path=/sbin/ifconfig $(ROUTE_ARGS) --with-plugindir=\$${prefix}/lib/openvpn --includedir=\$${prefix}/include/openvpn --enable-pkcs11 --enable-x509-alt-username
+ dh_auto_configure -- $(shell dpkg-buildflags --export=configure) --enable-password-save --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --with-ifconfig-path=/sbin/ifconfig $(ROUTE_ARGS) --with-plugindir=\$${prefix}/lib/openvpn --includedir=\$${prefix}/include/openvpn --enable-pkcs11 --enable-x509-alt-username --enable-systemd
override_dh_auto_build: