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