3 .
/usr
/lib
/network
/network
6 local CMD_FLAGS PID_FILE AUTH_GROUP PASSWORD URL USER VPNC_SCRIPT
10 if [[ -z $URL ]]; then
11 report_fail
"No url specified in profile"
15 VPNC_SCRIPT
=${VPNC_SCRIPT:-/etc/vpnc/vpnc-script}
16 if [[ ! -e $VPNC_SCRIPT ]]; then
17 report_fail
"vpnc script does not exists: $VPNC_SCRIPT"
21 PASSWORD
=${PASSWORD:-""}
22 [[ -n $USER ]] && CMD_FLAGS
+=" --user=$USER"
23 [[ -n $PASSWORD ]] && CMD_FLAGS
+=" --passwd-on-stdin"
24 [[ -n $AUTH_GROUP ]] && CMD_FLAGS
+=" --authgroup=$AUTH_GROUP"
26 PID_FILE
="/run/openconnect-$1.pid"
28 /usr
/sbin
/openconnect
--background --quiet --script "$VPNC_SCRIPT" $CMD_FLAGS "$URL" <<<"$PASSWORD"
30 if [[ $?
-ne 0 ]]; then
31 report_fail
"openconnect connection failed"
35 /usr
/bin
/pgrep
-n ^openconnect$
> "$PID_FILE"
39 local CMD_FLAGS PID_FILE AUTH_GROUP PASSWORD URL USER VPNC_SCRIPT
42 PID_FILE
="/run/openconnect-$1.pid"
51 # vim: ft=sh ts=4 et sw=4: