Skip to content

Commit

Permalink
Fix up the OpenConnect ucsf-vpn-flavors.sh hook script
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed May 17, 2024
1 parent 21e1a1d commit 0518eb3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions vpnc/connect.d/ucsf-vpn-flavors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,32 @@
## Called via 'ucsf-vpn'?
if [ -n "${UCSF_VPN_VERSION}" ]; then
ucsf_vpn_log() {
echo "[$(date --iso-8601=seconds)] $@" >> "${UCSF_VPN_LOGFILE}"
echo "[$(date --iso-8601=seconds)] $*" >> "${UCSF_VPN_LOGFILE}"
}

_hook_file_="${UCSF_VPN_FLAVOR}"/pre-connect.sh
ucsf_vpn_log "$* ..."
ucsf_vpn_log "UCSF_VPN_VERSION=${UCSF_VPN_VERSION}"
ucsf_vpn_log "UCSF_VPN_FLAVOR=${UCSF_VPN_FLAVOR}"

if [ "$1" = "connect" ]; then
_hook_="pre-connect"
else
_hook_="$1"
fi
ucsf_vpn_log "hook=${_hook_}"

_hook_file_="${UCSF_VPN_FLAVOR}/${_hook_}.sh"
ucsf_vpn_log "${_hook_file_} ..."
if [ -f "${_hook_file_}" ]; then
ucsf_vpn_log "${_hook_file_} ..."
_hook_status_="done"

# shellcheck disable=SC1090
. "${_hook_file_}" || _hook_status_="error"

ucsf_vpn_log "${_hook_file_} ... ${_hook_status_}"
else
ucsf_vpn_log "${_hook_file_} ... non-existing"
fi

ucsf_vpn_log "$* ... done"
fi

0 comments on commit 0518eb3

Please sign in to comment.