From 5c189003c59177ee5353dd8b5035c10e86a0357b Mon Sep 17 00:00:00 2001 From: Henning Heinold Date: Fri, 12 Dec 2014 20:56:23 +0100 Subject: [PATCH] openvpn: clean update from sysv-rc to systemd for the startup files [hfreyther: We assume that the user might install OpenVPN with a different priority but that it will always be available in the runlevel two (e.g. even if the user changed the default runlevel)] Related: SYS#517 --- recipes-extra/openvpn/openvpn_2.3.6.bb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/recipes-extra/openvpn/openvpn_2.3.6.bb b/recipes-extra/openvpn/openvpn_2.3.6.bb index bb00043..ed3376d 100644 --- a/recipes-extra/openvpn/openvpn_2.3.6.bb +++ b/recipes-extra/openvpn/openvpn_2.3.6.bb @@ -40,6 +40,7 @@ do_install_append() { install -m 0755 ${WORKDIR}/openvpn-generator ${D}${systemd_unitdir}/system-generators } +RDEPENDS_${PN} += "update-rc.d" RRECOMMENDS_${PN} = "kernel-module-tun" FILES_${PN}-dbg += "${libdir}/openvpn/plugins/.debug" @@ -48,6 +49,18 @@ FILES_${PN}-dbg += "${libdir}/openvpn/plugins/.debug" # during install and upgrade. Simply ship the files. FILES_${PN} += "${systemd_unitdir}" +pkg_postinst_${PN} () { + if [ "x$D" != "x" ]; then + exit 1 + fi + + if [ -L /etc/rc2.d/S*openvpn ]; then + update-rc.d -f openvpn remove + if [ ! -L /etc/systemd/system/multi-user.target.wants/openvpn.service ]; then + ln -s '/lib/systemd/system/openvpn.service' '/etc/systemd/system/multi-user.target.wants/openvpn.service' + fi + fi +} # We need to test opkg upgrade of OpenVPN through the OpenVPN first DEFAULT_PREFERENCE = "-1"