Last active
August 29, 2015 14:07
-
-
Save alicraigmile/7704067b43c552a5fa7e to your computer and use it in GitHub Desktop.
Switch between BBC (Reith) Network and Direct Connection on a BBC Desktopped Mac OS X machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Switch between BBC (Reith) Network and Direct Connection on a BBC Desktopped Mac OS X machine | |
| function bbc-on-network() { | |
| scselect "BBC On Network" | |
| } | |
| function bbc-off-network() { | |
| scselect "BBC Off Network" | |
| } | |
| function network-location() { | |
| network_location="$(/usr/sbin/scselect 2>&1 | egrep '^ \* ' | sed 's:.*(\(.*\)):\1:')" | |
| } | |
| function reithproxies() { | |
| onoroff=$1 | |
| if [[ $onoroff == "on" ]]; then | |
| #proxy to get from reith network to internet | |
| bbc-on-network | |
| export http_proxy=http://www-cache.reith.bbc.co.uk:80/ | |
| export https_proxy=http://www-cache.reith.bbc.co.uk:80/ | |
| export socks_proxy=socks-gw.reith.bbc.co.uk:1085 | |
| export ftp_proxy=ftp://ftp-gw.reith.bbc.co.uk:21/ | |
| elif [[ $onoroff == "off" ]]; then | |
| #proxy to direct connect to internet | |
| bbc-off-network | |
| export http_proxy= | |
| export https_proxy= | |
| export socks_proxy= | |
| export ftp_proxy= | |
| elif [[ $onoroff == "-q" ]]; then | |
| network-location | |
| echo "network_location=$network_location" | |
| echo "http_proxy=$http_proxy" | |
| echo "https_proxy=$https_proxy" | |
| echo "socks_proxy=$socks_proxy" | |
| echo "ftp_proxy=$ftp_proxy" | |
| else | |
| echo "usage: reithproxies [-h] [-q] [on|off]" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment