Created
March 24, 2015 01:34
-
-
Save marcoceppi/75b10e084e86722430a2 to your computer and use it in GitHub Desktop.
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 | |
| proxy=10.0.1.2:8000 | |
| if [ "$1" == "disable" ]; then | |
| rm -f ~/.ecorc | |
| sudo rm -f /etc/apt/apt.conf.d/99-eco-sprint | |
| sed -i -e 's/\. \$HOME\/\.ecorc//' ~/.profile ~/.bashrc | |
| exit 0 | |
| fi | |
| echo "Creating ~/.ecorc with all the proxy information" | |
| cat > ~/.ecorc <<END | |
| export http_proxy="http://$proxy/" | |
| export https_proxy="http://$proxy/" | |
| export ftp_proxy="http://$proxy/" | |
| export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" | |
| export HTTP_PROXY="http://$proxy/" | |
| export HTTPS_PROXY="http://$proxy/" | |
| export FTP_PROXY="http://$proxy/" | |
| export NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com" | |
| END | |
| echo "Creating /etc/apt/apt.conf.d/99-eco-sprint" | |
| sudo tee /etc/apt/apt.conf.d/99-eco-sprint > /dev/null <<EOF | |
| Acquire::http::proxy "http://$proxy/"; | |
| Acquire::ftp::proxy "ftp://$proxy/"; | |
| Acquire::https::proxy "https://$proxy/"; | |
| EOF | |
| echo "Adding ~/.ecorc to ~/.profile and ~/.bashrc" | |
| echo '. $HOME/.ecorc' >> ~/.profile | |
| echo '. $HOME/.ecorc' >> ~/.bashrc | |
| echo "Now run '. ~/.ecorc' to get some proxy love. If you need to, update your browser to use $proxy as an HTTP, HTTPS, or FTP proxy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment