Skip to content

Commit

Permalink
Add support for all known hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed May 18, 2024
1 parent 07257e9 commit 20b967e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Useful resources:
* UCSF Managing Your Passwords:
- https://it.ucsf.edu/services/managing-your-passwords
Version: 5.8.0-9006
Version: 5.8.0-9007
Copyright: Henrik Bengtsson (2016-2024)
License: GPL (>= 2.1) [https://www.gnu.org/licenses/gpl.html]
Source: https://github.com/HenrikBengtsson/ucsf-vpn
Expand Down
14 changes: 5 additions & 9 deletions bin/ucsf-vpn
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
### * UCSF Managing Your Passwords:
### - https://it.ucsf.edu/services/managing-your-passwords
###
### Version: 5.8.0-9006
### Version: 5.8.0-9007
### Copyright: Henrik Bengtsson (2016-2024)
### License: GPL (>= 2.1) [https://www.gnu.org/licenses/gpl.html]
### Source: https://github.com/HenrikBengtsson/ucsf-vpn
Expand Down Expand Up @@ -1209,7 +1209,7 @@ function source_envs() {


function flavor_home() {
local path file pathname
local path hook pathname
local -i count

## No flavor specified
Expand All @@ -1224,8 +1224,8 @@ function flavor_home() {
fi

count=0
for file in pre-connect.sh post-connect.sh; do
pathname=${path}/${file}
for hook in pre-init connect post-connect disconnect post-disconnect attempt-reconnect post-attempt-reconnect reconnect; do
pathname=${path}/${hook}.sh
if [[ -f "${pathname}" ]]; then
if ! bash -n "${pathname}"; then
merror "File syntax error: ${pathname}"
Expand Down Expand Up @@ -1283,11 +1283,7 @@ if [ -n "\${UCSF_VPN_VERSION}" ]; then
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
_hook_="\$1"
ucsf_vpn_log "hook=\${_hook_}"
_hook_file_="\${UCSF_VPN_FLAVOR}/\${_hook_}.sh"
Expand Down
8 changes: 4 additions & 4 deletions src/ucsf-vpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
### * UCSF Managing Your Passwords:
### - https://it.ucsf.edu/services/managing-your-passwords
###
### Version: 5.8.0-9006
### Version: 5.8.0-9007
### Copyright: Henrik Bengtsson (2016-2024)
### License: GPL (>= 2.1) [https://www.gnu.org/licenses/gpl.html]
### Source: https://github.com/HenrikBengtsson/ucsf-vpn
Expand Down Expand Up @@ -318,7 +318,7 @@ function source_envs() {


function flavor_home() {
local path file pathname
local path hook pathname
local -i count

## No flavor specified
Expand All @@ -333,8 +333,8 @@ function flavor_home() {
fi

count=0
for file in pre-connect.sh post-connect.sh; do
pathname=${path}/${file}
for hook in pre-init connect post-connect disconnect post-disconnect attempt-reconnect post-attempt-reconnect reconnect; do
pathname=${path}/${hook}.sh
if [[ -f "${pathname}" ]]; then
if ! bash -n "${pathname}"; then
merror "File syntax error: ${pathname}"
Expand Down
6 changes: 1 addition & 5 deletions src/vpnc/ucsf-vpn-flavors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ if [ -n "${UCSF_VPN_VERSION}" ]; then
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
_hook_="$1"
ucsf_vpn_log "hook=${_hook_}"

_hook_file_="${UCSF_VPN_FLAVOR}/${_hook_}.sh"
Expand Down

0 comments on commit 20b967e

Please sign in to comment.