Browse Source

Update mac.sh

MoeClub 5 years ago
parent
commit
013f13006e
1 changed files with 7 additions and 4 deletions
  1. 7 4
      AnyConnect/mac.sh

+ 7 - 4
AnyConnect/mac.sh

@@ -1,9 +1,12 @@
 #!/bin/bash
 
-CSET_PWD=""
-CSET_URL=""
+[[ $# -eq 2 ]] || exit 1
+CRET_URL="$1"
+CRET_PWD="$2"
+
 
 # DO NOT EDIT
+[[ -n "${CRET_URL}" ]] && [[ -n "${CRET_PWD}" ]] || exit 1
 USER_Home=`echo "$HOME"`
 [[ "$(sudo whoami)" == "root" ]] || exit 1
 
@@ -31,8 +34,8 @@ cat >"${USER_Home}/.anyconnect"<<EOF
 </AnyConnectPreferences>
 EOF
 
-curl -sSL -H "User-Agent: wget/1.0" -o "/tmp/MacOS.p12" "${CSET_URL}"
-[ -f "/tmp/MacOS.p12" ] && security import "/tmp/MacOS.p12" -P "${CSET_PWD}"
+[[ -f "${CRET_URL}" ]] && cp -f "${CRET_URL}" "/tmp/MacOS.p12" || curl -sSL -H "User-Agent: wget/1.0" -o "/tmp/MacOS.p12" "${CRET_URL}"
+[ -f "/tmp/MacOS.p12" ] && security import "/tmp/MacOS.p12" -P "${CRET_PWD}"
 [ -f "/tmp/MacOS.p12" ] && rm -rf "/tmp/MacOS.p12"