Home and office have different network configuration, most lies in proxy setup. A simple script as follow is used to switch configuration. Hope it is useful for someone else too.
#!/bin/bash
prog=$(basename $0)
usage()
{
echo "Usage: $prog <home|work>"
}
if [ $# -ne 1 ]; then
usage
exit -1
fi
tnet=$1
if [ $tnet != "home" -a $tnet != "work" ]; then
usage
exit -1
fi
if [ "$tnet" == "work" ]; then
sudo cp /etc/apt/apt.conf.avail/99proxy /etc/apt/apt.conf.d
gconftool-2 -s -t string /system/proxy/mode auto
else
sudo rm -f /etc/apt/apt.conf.d/99proxy
gconftool-2 -s -t string /system/proxy/mode none
fi
No comments:
Post a Comment