# # Copyright (C) 2008-2014 The LuCI Team # # This is free software, licensed under the Apache License, Version 2.0 . # include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ocserv-r4ven-me LUCI_TITLE:=LuCI Support for OpenConnect VPN LUCI_DEPENDS:=+luci-base +ocserv +certtool +openssl-util +kmod-tcp-bbr PKG_PROVIDES:=luci-app-ocserv PKG_LICENSE:=Apache-2.0 PKG_MAINTAINER:=Nikos Mavrogiannopoulos # Defined before luci.mk so the package framework registers a pre-deinstall hook. define Package/luci-app-ocserv-r4ven-me/prerm #!/bin/sh [ "$${PKG_UPGRADE}" = 1 ] && exit 0 root="$${IPKG_INSTROOT}" dst="$${root}/etc/init.d/ocserv" backup="$${root}/usr/libexec/ocserv-stock.init" if [ -f "$${backup}" ]; then cp "$${backup}" "$${dst}" chmod 0755 "$${dst}" rm -f "$${backup}" fi exit 0 endef include ../../luci.mk # /etc/ocserv holds the CA, PKI and issued client certificates, generated at runtime (not # shipped by the ocserv package, so sysupgrade would otherwise drop them on a reflash). define Package/luci-app-ocserv-r4ven-me/postinst #!/bin/sh root="$${IPKG_INSTROOT}" src="$${root}/usr/libexec/ocserv-multivhost.init" dst="$${root}/etc/init.d/ocserv" backup="$${root}/usr/libexec/ocserv-stock.init" if [ -f "$${src}" ]; then if [ -f "$${dst}" ] && ! grep -qF 'Managed by luci-app-ocserv (multi-vhost capable).' "$${dst}"; then cp "$${dst}" "$${backup}" chmod 0755 "$${backup}" fi cp "$${src}" "$${dst}" chmod 0755 "$${dst}" fi # Versions 0.261113.* ran an "exit through another client" service: stop what an upgrade leaves behind. if [ -z "$${root}" ]; then ubus call service delete '{"name":"ocserv-exit"}' >/dev/null 2>&1 for p in $$(ps | grep '[o]cserv-exit watch' | awk '{print $$1}'); do kill "$$p" 2>/dev/null; done while ip rule del prio 1499 2>/dev/null; do :; done while ip rule del prio 1500 2>/dev/null; do :; done rm -f /etc/rc.d/*ocserv-exit /var/run/ocserv-exit.count fi # bbr for TCP-based tunnels: apply now (new connections only, see /etc/sysctl.d/12-bbr.conf). if [ -z "$${root}" ]; then modprobe tcp_bbr >/dev/null 2>&1 sysctl -q -p /etc/sysctl.d/12-bbr.conf >/dev/null 2>&1 fi grep -qxF '/etc/ocserv/' "$${root}/etc/sysupgrade.conf" 2>/dev/null || \ echo '/etc/ocserv/' >> "$${root}/etc/sysupgrade.conf" # rpcd keeps the old ucode plugin in memory: without a restart the new LuCI pages call methods # with arguments the old plugin rejects ("Invalid argument"), and lists look empty. if [ -z "$${root}" ] && [ -x /etc/init.d/rpcd ]; then ( sleep 2; /etc/init.d/rpcd restart >/dev/null 2>&1 ) & fi exit 0 endef # call BuildPackage - OpenWrt buildroot signature