]> code.delx.au - osx-proxyconf/blob - proxyconf.sh
5c49ada1e56f8c7e63e17ef7aa5ff3900e0c67dd
[osx-proxyconf] / proxyconf.sh
1 #!/bin/bash
2
3 if [ "$(sysconfig -q "HTTPEnable")" = "1" ]; then
4 host="$(sysconfig -q "HTTPProxy")"
5 port="$(sysconfig -q "HTTPPort")"
6 echo "export http_proxy=\"http://${host}:${port}\""
7 else
8 echo "unset http_proxy"
9 fi
10 if [ "$(sysconfig -q "HTTPSEnable")" = "1" ]; then
11 host="$(sysconfig -q "HTTPSProxy")"
12 port="$(sysconfig -q "HTTPSPort")"
13 echo "export https_proxy=\"http://${host}:${port}\""
14 else
15 echo "unset https_proxy"
16 fi
17 if [ "$(sysconfig -q "FTPEnable")" = "1" ]; then
18 host="$(sysconfig -q "FTPProxy")"
19 port="$(sysconfig -q "FTPPort")"
20 echo "export ftp_proxy=\"http://${host}:${port}\""
21 else
22 echo "unset ftp_proxy"
23 fi
24 if [ -n "${host}" ]; then
25 no_proxy="$(sysconfig ExceptionsList | tr '\n' ',' | sed 's/,$//g')"
26 echo "export no_proxy=\"${no_proxy}\""
27 else
28 echo "unset no_proxy"
29 fi