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
This commit is contained in:
Henning Heinold 2014-12-12 20:56:23 +01:00 committed by Holger Hans Peter Freyther
parent 078c48f8f1
commit 5c189003c5
1 changed files with 13 additions and 0 deletions

View File

@ -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"