HEX
Server: Apache/2.4.63 (Unix)
System: Linux Synopilou92 4.4.302+ #72806 SMP Mon Jul 21 23:16:00 CST 2025 x86_64
User: pilou92 (1026)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /volume1/@appstore/VPNCenter/scripts/UpdateL2TPIface.sh
#!/bin/sh

#################################################################
# This hook is invoked when ovs change
#################################################################

PACKAGE_LOCATION="/var/packages/VPNCenter"
PKG_USERCONF_DIR="/usr/syno/etc/packages/VPNCenter"
SYNOVPN_CONF="${PKG_USERCONF_DIR}/synovpn.conf"

case $1 in
	--sdk-mod-ver)
		echo "1.0"
		;;
	--name)
		;;
	--pkg-ver)
		;;
	--vendor)
		;;
	--pre)
		;;
	--post)
		if [ "xcreate" = "x$ACTION" ]; then
			iface=`/usr/syno/bin/synogetkeyvalue ${SYNOVPN_CONF} vpninterface`
			/usr/syno/bin/synosetkeyvalue ${SYNOVPN_CONF} vpninterface ovs_${iface}
			${PACKAGE_LOCATION}/target/bin/synovpnnet update_l2tp_if
			${PACKAGE_LOCATION}/target/bin/synovpnnet restore_psk
			${PACKAGE_LOCATION}/target/scripts/l2tpd.sh restart
		fi
		if [ "xdelete" = "x$ACTION" ]; then
			iface=`/usr/syno/bin/synogetkeyvalue ${SYNOVPN_CONF} vpninterface`
			/usr/syno/bin/synosetkeyvalue ${SYNOVPN_CONF} vpninterface ${iface#ovs_*}
			${PACKAGE_LOCATION}/target/bin/synovpnnet update_l2tp_if
			${PACKAGE_LOCATION}/target/bin/synovpnnet restore_psk
			${PACKAGE_LOCATION}/target/scripts/l2tpd.sh restart
		fi
		;;
	*)
		echo "Usage: $0 --sdk-mod-ver|--name|--pkg-ver|--vendor|--pre|--post"
		;;
esac