mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
openfortivpn: tabify shell scripts
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
This commit is contained in:
@@ -14,16 +14,16 @@ config=$1; shift
|
||||
killed=0
|
||||
|
||||
trap_with_arg() {
|
||||
func="$1" ; shift
|
||||
for sig ; do
|
||||
trap "$func $sig" "$sig"
|
||||
done
|
||||
func="$1" ; shift
|
||||
for sig ; do
|
||||
trap "$func $sig" "$sig"
|
||||
done
|
||||
}
|
||||
|
||||
func_trap() {
|
||||
logger "openfortivpn-wrapper[$$]" "$config: sending signal ${1}"
|
||||
killed=1
|
||||
kill -${1} $child 2>/dev/null
|
||||
logger "openfortivpn-wrapper[$$]" "$config: sending signal ${1}"
|
||||
killed=1
|
||||
kill -${1} $child 2>/dev/null
|
||||
}
|
||||
|
||||
trap_with_arg func_trap INT TERM KILL
|
||||
@@ -33,11 +33,11 @@ start_time=$(date '+%s')
|
||||
/usr/sbin/openfortivpn "$@" < $pwfile 2>/dev/null &
|
||||
child=$!
|
||||
wait $child || {
|
||||
[ "$killed" = 1 ] && exit 0
|
||||
current_time=$(date '+%s')
|
||||
elapsed=$(($current_time-$start_time))
|
||||
. /lib/netifd/netifd-proto.sh
|
||||
proto_notify_error "$config" "Failed to connect after $elapsed seconds."
|
||||
proto_block_restart "$config"
|
||||
exit 1
|
||||
[ "$killed" = 1 ] && exit 0
|
||||
current_time=$(date '+%s')
|
||||
elapsed=$(($current_time-$start_time))
|
||||
. /lib/netifd/netifd-proto.sh
|
||||
proto_notify_error "$config" "Failed to connect after $elapsed seconds."
|
||||
proto_block_restart "$config"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user