Add ability to source common configuration hook file(s). --- ./vpnc-script 2019-10-16 22:56:48.581008713 +0000 +++ ./vpnc-script 2019-10-16 22:59:15.859322960 +0000 @@ -77,6 +77,9 @@ PATH=/sbin:/usr/sbin:$PATH OS="`uname -s`" +# You can create sourcable scriptlets under "${HOOKS_DIR}/${HOOK}.d/" +# where $HOOK is either one of the $reason's above, or "common-config" +# which is sourced before other hooks when processing a valid reason. HOOKS_DIR=/etc/vpnc DEFAULT_ROUTE_FILE=/var/run/vpnc/defaultroute RESOLV_CONF_BACKUP=/var/run/vpnc/resolv.conf-backup @@ -1022,20 +1025,24 @@ fi case "$reason" in pre-init) + run_hooks common-config run_hooks pre-init do_pre_init ;; connect) + run_hooks common-config run_hooks connect do_connect run_hooks post-connect ;; disconnect) + run_hooks common-config run_hooks disconnect do_disconnect run_hooks post-disconnect ;; attempt-reconnect) + run_hooks common-config # Invoked before each attempt to re-establish the session. # If the underlying physical connection changed, we might # be left with a route to the VPN server through the VPN @@ -1043,6 +1050,7 @@ case "$reason" in run_hooks attempt-reconnect ;; reconnect) + run_hooks common-config # After successfully re-establishing the session. run_hooks reconnect ;;