diff options
Diffstat (limited to 'ext')
| -rwxr-xr-x | ext/installfiles/mac/get-proxy-settings.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/installfiles/mac/get-proxy-settings.sh b/ext/installfiles/mac/get-proxy-settings.sh new file mode 100755 index 00000000..873a8558 --- /dev/null +++ b/ext/installfiles/mac/get-proxy-settings.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Outputs host and port for system HTTP proxy or zeroes if none or not +# configured. + +export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin + +enabled=`system_profiler SPNetworkDataType|grep "HTTP Proxy Enabled"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` +port=`system_profiler SPNetworkDataType|grep "HTTP Proxy Port"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` +serv=`system_profiler SPNetworkDataType|grep "HTTP Proxy Server"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` + +if [ "$enabled" = "Yes" ]; then + if [ "$serv" ]; then + if [ ! "$port" ]; then + port=80 + fi + + echo $serv $port + else + echo 0.0.0.0 0 + fi +else + echo 0.0.0.0 0 +fi + +exit 0 |
