aboutsummaryrefslogtreecommitdiff
path: root/distro
diff options
context:
space:
mode:
authorChristian Hesse2017-01-24 15:39:46 +0100
committerDavid Sommerseth2017-01-25 19:39:42 +0100
commitca5b4c2aad2370be7862660d274b7485f2d0af71 (patch)
treed3272131b728ee9430f0fda7195dd9c72dabc5c8 /distro
parente83a8684f0a0d944e9d53cdad2b543cfd1b6fbae (diff)
downloadopenvpn-ca5b4c2aad2370be7862660d274b7485f2d0af71.zip
openvpn-ca5b4c2aad2370be7862660d274b7485f2d0af71.tar.gz
systemd: Use automake tools to install unit files
If systemd is enabled we install unit files to $libdir/systemd/system (or the path specified by SYSTEMD_UNIT_DIR). The unit files are generated on the fly with matching $sbindir. Signed-off-by: Christian Hesse <mail@eworm.de> Acked-by: David Sommerseth <davids@openvpn.net> Message-Id: <20170124143947.27385-1-list@eworm.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13940.html Signed-off-by: David Sommerseth <davids@openvpn.net>
Diffstat (limited to 'distro')
-rw-r--r--distro/Makefile.am4
-rw-r--r--distro/systemd/Makefile.am26
-rw-r--r--distro/systemd/openvpn-client@.service.in (renamed from distro/systemd/openvpn-client@.service)2
-rw-r--r--distro/systemd/openvpn-server@.service.in (renamed from distro/systemd/openvpn-server@.service)2
4 files changed, 29 insertions, 5 deletions
diff --git a/distro/Makefile.am b/distro/Makefile.am
index 7a9ffd0..eb0e554 100644
--- a/distro/Makefile.am
+++ b/distro/Makefile.am
@@ -12,6 +12,4 @@
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
-SUBDIRS = rpm
-
-EXTRA_DIST = systemd/openvpn-client@.service systemd/openvpn-server@.service
+SUBDIRS = rpm systemd
diff --git a/distro/systemd/Makefile.am b/distro/systemd/Makefile.am
new file mode 100644
index 0000000..b10c6ed
--- /dev/null
+++ b/distro/systemd/Makefile.am
@@ -0,0 +1,26 @@
+#
+# OpenVPN -- An application to securely tunnel IP networks
+# over a single UDP port, with support for SSL/TLS-based
+# session authentication and key exchange,
+# packet encryption, packet authentication, and
+# packet compression.
+#
+# Copyright (C) 2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
+#
+
+%.service: %.service.in Makefile
+ $(AM_V_GEN)sed -e 's|\@sbindir\@|$(sbindir)|' \
+ $< > $@.tmp && mv $@.tmp $@
+
+EXTRA_DIST = \
+ openvpn-client@.service.in \
+ openvpn-server@.service.in
+
+if ENABLE_SYSTEMD
+systemdunit_DATA = \
+ openvpn-client@.service \
+ openvpn-server@.service
+endif
+
+MAINTAINERCLEANFILES = \
+ $(srcdir)/Makefile.in
diff --git a/distro/systemd/openvpn-client@.service b/distro/systemd/openvpn-client@.service.in
index 5618af3..d933772 100644
--- a/distro/systemd/openvpn-client@.service
+++ b/distro/systemd/openvpn-client@.service.in
@@ -12,7 +12,7 @@ PrivateTmp=true
RuntimeDirectory=openvpn-client
RuntimeDirectoryMode=0710
WorkingDirectory=/etc/openvpn/client
-ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config %i.conf
+ExecStart=@sbindir@/openvpn --suppress-timestamps --nobind --config %i.conf
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE
LimitNPROC=10
DeviceAllow=/dev/null rw
diff --git a/distro/systemd/openvpn-server@.service b/distro/systemd/openvpn-server@.service.in
index b9b4dba..da5c78e 100644
--- a/distro/systemd/openvpn-server@.service
+++ b/distro/systemd/openvpn-server@.service.in
@@ -12,7 +12,7 @@ PrivateTmp=true
RuntimeDirectory=openvpn-server
RuntimeDirectoryMode=0710
WorkingDirectory=/etc/openvpn/server
-ExecStart=/usr/sbin/openvpn --status %t/openvpn-server/status-%i.log --status-version 2 --suppress-timestamps --config %i.conf
+ExecStart=@sbindir@/openvpn --status %t/openvpn-server/status-%i.log --status-version 2 --suppress-timestamps --config %i.conf
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE
LimitNPROC=10
DeviceAllow=/dev/null rw