aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2022-07-07 14:08:57 +0800
committerKhem Raj <raj.khem@gmail.com>2022-07-07 10:26:37 -0400
commitc098cf9190413f237dc49d29c57be2f579fd4c40 (patch)
tree58338fff4b4bbbdfe239d6659918a9f4408dcdc2 /meta-networking
parent345b08680a11288a6c276734f811499c71cd2572 (diff)
downloadmeta-openembedded-c098cf9190413f237dc49d29c57be2f579fd4c40.tar.gz
openvpn: add PACKAGECONFIG for systemd
The systemd support had been integrated to openvpn for a long time. Add PACKAGECONFIG for it and use its own service files and volatile file. Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--[-rwxr-xr-x]meta-networking/recipes-support/openvpn/openvpn/openvpn0
-rw-r--r--meta-networking/recipes-support/openvpn/openvpn/openvpn-volatile.conf1
-rw-r--r--meta-networking/recipes-support/openvpn/openvpn/openvpn@.service12
-rw-r--r--meta-networking/recipes-support/openvpn/openvpn_2.5.7.bb49
4 files changed, 22 insertions, 40 deletions
diff --git a/meta-networking/recipes-support/openvpn/openvpn/openvpn b/meta-networking/recipes-support/openvpn/openvpn/openvpn
index e5af4b2301..e5af4b2301 100755..100644
--- a/meta-networking/recipes-support/openvpn/openvpn/openvpn
+++ b/meta-networking/recipes-support/openvpn/openvpn/openvpn
diff --git a/meta-networking/recipes-support/openvpn/openvpn/openvpn-volatile.conf b/meta-networking/recipes-support/openvpn/openvpn/openvpn-volatile.conf
deleted file mode 100644
index 1205806d52..0000000000
--- a/meta-networking/recipes-support/openvpn/openvpn/openvpn-volatile.conf
+++ /dev/null
@@ -1 +0,0 @@
-d @LOCALSTATEDIR@/run/openvpn 0755 root root -
diff --git a/meta-networking/recipes-support/openvpn/openvpn/openvpn@.service b/meta-networking/recipes-support/openvpn/openvpn/openvpn@.service
deleted file mode 100644
index 01dd2e8c25..0000000000
--- a/meta-networking/recipes-support/openvpn/openvpn/openvpn@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=OpenVPN Robust And Highly Flexible Tunneling Application On %I
-After=syslog.target network.target
-
-[Service]
-PrivateTmp=true
-Type=forking
-PIDFile=/var/run/openvpn/%i.pid
-ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --cipher AES-256-GCM --data-ciphers AES-256-GCM:AES-128-GCM:AES-256-CBC:AES-128-CBC:BF-CBC --config %i.conf
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta-networking/recipes-support/openvpn/openvpn_2.5.7.bb b/meta-networking/recipes-support/openvpn/openvpn_2.5.7.bb
index f9998aaa82..7404e6e587 100644
--- a/meta-networking/recipes-support/openvpn/openvpn_2.5.7.bb
+++ b/meta-networking/recipes-support/openvpn/openvpn_2.5.7.bb
@@ -5,13 +5,12 @@ LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=b76abd82c14ee01cc34c4ff5e3627b89"
DEPENDS = "lzo openssl iproute2 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
-inherit autotools systemd update-rc.d
+inherit autotools systemd update-rc.d pkgconfig
SRC_URI = "http://swupdate.openvpn.org/community/releases/${BP}.tar.gz \
file://0001-configure.ac-eliminate-build-path-from-openvpn-versi.patch \
file://openvpn \
- file://openvpn@.service \
- file://openvpn-volatile.conf"
+ "
UPSTREAM_CHECK_URI = "https://openvpn.net/community-downloads"
@@ -20,9 +19,6 @@ SRC_URI[sha256sum] = "08340a389905c84196b6cd750add1bc0fa2d46a1afebfd589c24120946
# CVE-2020-7224 and CVE-2020-27569 are for Aviatrix OpenVPN client, not for openvpn.
CVE_CHECK_IGNORE += "CVE-2020-7224 CVE-2020-27569"
-SYSTEMD_SERVICE:${PN} += "openvpn@loopback-server.service openvpn@loopback-client.service"
-SYSTEMD_AUTO_ENABLE = "disable"
-
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME:${PN} = "openvpn"
INITSCRIPT_PARAMS:${PN} = "start 10 2 3 4 5 . stop 70 0 1 6 ."
@@ -36,31 +32,30 @@ EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '', '--disable-p
# Explicitly specify IPROUTE to bypass the configure-time check for /sbin/ip on the host.
EXTRA_OECONF += "IPROUTE=${base_sbindir}/ip"
+EXTRA_OECONF += "SYSTEMD_UNIT_DIR=${systemd_system_unitdir} \
+ TMPFILES_DIR=${nonarch_libdir}/tmpfiles.d \
+ "
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
+ "
+
+PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
+
do_install:append() {
install -d ${D}/${sysconfdir}/init.d
install -m 755 ${WORKDIR}/openvpn ${D}/${sysconfdir}/init.d
install -d ${D}/${sysconfdir}/openvpn
+ install -d ${D}/${sysconfdir}/openvpn/server
+ install -d ${D}/${sysconfdir}/openvpn/client
+
install -d ${D}/${sysconfdir}/openvpn/sample
- install -m 755 ${S}/sample/sample-config-files/loopback-server ${D}${sysconfdir}/openvpn/sample/loopback-server.conf
- install -m 755 ${S}/sample/sample-config-files/loopback-client ${D}${sysconfdir}/openvpn/sample/loopback-client.conf
+ install -m 644 ${S}/sample/sample-config-files/loopback-server ${D}${sysconfdir}/openvpn/sample/loopback-server.conf
+ install -m 644 ${S}/sample/sample-config-files/loopback-client ${D}${sysconfdir}/openvpn/sample/loopback-client.conf
install -dm 755 ${D}${sysconfdir}/openvpn/sample/sample-keys
install -m 644 ${S}/sample/sample-keys/* ${D}${sysconfdir}/openvpn/sample/sample-keys
- if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
- install -d ${D}/${systemd_unitdir}/system
- install -m 644 ${WORKDIR}/openvpn@.service ${D}/${systemd_unitdir}/system
- install -m 644 ${WORKDIR}/openvpn@.service ${D}/${systemd_unitdir}/system/openvpn@loopback-server.service
- install -m 644 ${WORKDIR}/openvpn@.service ${D}/${systemd_unitdir}/system/openvpn@loopback-client.service
-
- install -d ${D}/${localstatedir}
- install -d ${D}/${localstatedir}/lib
- install -d -m 710 ${D}/${localstatedir}/lib/openvpn
-
- install -d ${D}${sysconfdir}/tmpfiles.d
- install -m 0644 ${WORKDIR}/openvpn-volatile.conf ${D}${sysconfdir}/tmpfiles.d/openvpn.conf
- sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${sysconfdir}/tmpfiles.d/openvpn.conf
- fi
+ install -d -m 710 ${D}/${localstatedir}/lib/openvpn
}
PACKAGES =+ " ${PN}-sample "
@@ -68,9 +63,9 @@ PACKAGES =+ " ${PN}-sample "
RRECOMMENDS:${PN} = "kernel-module-tun"
FILES:${PN}-dbg += "${libdir}/openvpn/plugins/.debug"
-FILES:${PN} += "${systemd_unitdir}/system/openvpn@.service \
- ${sysconfdir}/tmpfiles.d \
+FILES:${PN} += "${systemd_system_unitdir}/openvpn-server@.service \
+ ${systemd_system_unitdir}/openvpn-client@.service \
+ ${nonarch_libdir}/tmpfiles.d \
"
-FILES:${PN}-sample += "${systemd_unitdir}/system/openvpn@loopback-server.service \
- ${systemd_unitdir}/system/openvpn@loopback-client.service \
- ${sysconfdir}/openvpn/sample/"
+FILES:${PN}-sample = "${sysconfdir}/openvpn/sample/ \
+ "