Skip to content

Instantly share code, notes, and snippets.

@roskoff
Created September 19, 2012 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save roskoff/3749633 to your computer and use it in GitHub Desktop.
Save roskoff/3749633 to your computer and use it in GitHub Desktop.
Script para configurar proxy en Ubuntu 12.04
#/bin/bash
echo 'Removiendo las configuraciones actuales del proxy en:'
sudo sh -c '(echo "g/^Acquire::http::proxy/d"; echo "wq") | ex -s /etc/apt/apt.conf'
sudo sh -c '(echo "g/^Acquire::https::proxy/d"; echo "wq") | ex -s /etc/apt/apt.conf'
sudo sh -c '(echo "g/^Acquire::ftp::proxy/d"; echo "wq") | ex -s /etc/apt/apt.conf'
echo '/etc/apt/apt.conf'
sudo sh -c '(echo "g/^http_proxy/d"; echo "wq") | ex -s /etc/environment'
sudo sh -c '(echo "g/^https_proxy/d"; echo "wq") | ex -s /etc/environment'
sudo sh -c '(echo "g/^ftp_proxy/d"; echo "wq") | ex -s /etc/environment'
echo '/etc/environment'
sudo sh -c '(echo "g/^http_proxy/d"; echo "wq") | ex -s /etc/wgetrc'
sudo sh -c '(echo "g/^https_proxy/d"; echo "wq") | ex -s /etc/wgetrc'
sudo sh -c '(echo "g/^ftp_proxy/d"; echo "wq") | ex -s /etc/wgetrc'
echo '/etc/wgetrc'
echo -n
echo 'Usuario del proxy: '
read usuario
echo 'Contraseña: '
read pass
echo -n
echo 'Estableciendo configuraciones de proxy en:'
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http enabled true
gsettings set org.gnome.system.proxy.http use-authentication true
gsettings set org.gnome.system.proxy.http authentication-user $usuario
gsettings set org.gnome.system.proxy.http authentication-password $pass
gsettings set org.gnome.system.proxy.http host 'myproxy.mywork.com'
gsettings set org.gnome.system.proxy.http port 6789
gsettings set org.gnome.system.proxy.https host 'myproxy.mywork.com'
gsettings set org.gnome.system.proxy.https port 6789
gsettings set org.gnome.system.proxy.ftp host 'myproxy.mywork.com'
gsettings set org.gnome.system.proxy.ftp port 6789
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.1/8', '*.pol.una.py']"
gsettings set org.gnome.system.proxy use-same-proxy false
echo 'Gnome System'
sudo sh -c "(echo 'Acquire::http::proxy \"http://$usuario:$pass@myproxy.mywork.com:6789/\";') >> /etc/apt/apt.conf"
sudo sh -c "(echo 'Acquire::https::proxy \"https://$usuario:$pass@myproxy.mywork.com:6789/\";') >> /etc/apt/apt.conf"
sudo sh -c "(echo 'Acquire::ftp::proxy \"ftp://$usuario:$pass@myproxy.mywork.com:6789/\";') >> /etc/apt/apt.conf"
echo '/etc/apt/apt.conf'
sudo sh -c "(echo 'http_proxy=\"http://$usuario:$pass@myproxy.mywork.com:6789/\"') >> /etc/environment"
sudo sh -c "(echo 'https_proxy=\"https://$usuario:$pass@myproxy.mywork.com:6789/\"') >> /etc/environment"
sudo sh -c "(echo 'ftp_proxy=\"ftp://$usuario:$pass@myproxy.mywork.com:6789/\"') >> /etc/environment"
echo '/etc/environment'
sudo sh -c "(echo 'http_proxy = http://$usuario:$pass@myproxy.mywork.com:6789/') >> /etc/wgetrc"
sudo sh -c "(echo 'https_proxy = https://$usuario:$pass@myproxy.mywork.com:6789/') >> /etc/wgetrc"
sudo sh -c "(echo 'ftp_proxy = ftp://$usuario:$pass@myproxy.mywork.com:6789/') >> /etc/wgetrc"
echo '/etc/wgetrc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment