Skip to content

Instantly share code, notes, and snippets.

@njh
Created July 25, 2011 14:44
Show Gist options
  • Save njh/1104285 to your computer and use it in GitHub Desktop.
Save njh/1104285 to your computer and use it in GitHub Desktop.
# Use Fink (if available)
test -r /sw/bin/init.sh && . /sw/bin/init.sh
# In Mac OS X, what network location is set?
if [ -f "/usr/sbin/scselect" ]; then
export LOCATION=$(/usr/sbin/scselect 2>&1 | perl -ne 'if (m/^\s+\*\s+(\S+)\s+\((.+)\)$/) { print "$2\n"; }')
echo "Network Location: $LOCATION"
fi
# Location-specific settings
if [ ! -z "$LOCATION" -a "$LOCATION" = "Internal" ]; then
export http_proxy=http://www-cache.foobar.com:80
export HTTP_PROXY=http://www-cache.foobar.com:80
export HTTPS_PROXY=http://www-cache.foobar.com:80
export CVS_PROXY=http://www-cache.foobar.com:80
export FTP_PROXY=http://www-cache.foobar.com:80
export GOPHER_PROXY=http://www-cache.foobar.com:80
export NO_PROXY=*.core.foobar.com,*.sandbox.dev.foobar.com,localhost,127.0.0.1
export no_proxy=$NO_PROXY
export MAVEN_OPTS="$MAVEN_OPTS \
-Dhttp.proxyHost=www-cache.foobar.com -Dhttp.proxyPort=80 \
-Dhttps.proxyHost=www-cache.foobar.com -Dhttps.proxyPort=80 \
-Dhttp.nonProxyHosts=localhost|national.core.foobar.com|*.sandbox.dev.foobar.com \
-Dhttps.nonProxyHosts=localhost|national.core.foobar.com|*.sandbox.dev.foobar.com \
"
# ssh
cp "$HOME/.ssh/config.int" "$HOME/.ssh/config"
# subversion
cp "$HOME/.subversion/servers.int" "$HOME/.subversion/servers"
# hosts file
cat /etc/hosts.int > /etc/hosts
else
unset HTTP_PROXY http_proxy
unset HTTPS_PROXY https_proxy
unset FTP_PROXY ftp_proxy
unset GOPHER_PROXY
unset NO_PROXY no_proxy
# ssh
cp "$HOME/.ssh/config.ext" "$HOME/.ssh/config"
# subversion
cp "$HOME/.subversion/servers.ext" "$HOME/.subversion/servers"
# hosts file
cat /etc/hosts.ext > /etc/hosts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment