Skip to content

Instantly share code, notes, and snippets.

@igorferreira
Last active April 9, 2018 14:50
Show Gist options
  • Save igorferreira/ecd3aa588e56fe62aef2f1e13de6e80c to your computer and use it in GitHub Desktop.
Save igorferreira/ecd3aa588e56fe62aef2f1e13de6e80c to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "config: git config proxy..."
git config --global http.proxy 127.0.0.1:3128
git config --global https.proxy 127.0.0.1:3128
echo "config: yum proxy..."
sudo sed -i 's/#proxy=http:\/\/127.0.0.1:3128/proxy=http:\/\/127.0.0.1:3128/g' /etc/yum.conf
echo "restart cntlm..."
sudo service cntlm restart
echo "config: docker server proxy..."
$meu-sub-dominio="novedade.br"
file="/etc/systemd/system/docker.service.d/http-proxy.conf.bkp"
if [ -f "$file" ]
then
echo "$file found."
sudo mv /etc/systemd/system/docker.service.d/http-proxy.conf.bkp /etc/systemd/system/docker.service.d/http-proxy.conf
else
echo "$file not found."
sudo echo $'\n [Service] \n Environment="HTTP_PROXY=http://127.0.0.1:3128" "NO_PROXY=localhost,127.0.0.1,*.$meu-sub-dominio" \n' > /etc/systemd/system/docker.service.d/http-proxy.conf
echo "print $file"
echo /etc/systemd/system/docker.service.d/http-proxy.conf
fi
file="/etc/systemd/system/docker.service.d/https-proxy.conf.bkp"
if [ -f "$file" ]
then
echo "$file found then reload backupt"
sudo mv /etc/systemd/system/docker.service.d/https-proxy.conf.bkp /etc/systemd/system/docker.service.d/https-proxy.conf
else
echo "$file not found then creating..."
sudo echo $'\n [Service] \n Environment="HTTPS_PROXY=https://127.0.0.1:3128" "NO_PROXY=localhost,127.0.0.1,*.$meu-sub-dominio" \n' > /etc/systemd/system/docker.service.d/http-proxy.conf
echo "print $file"
echo /etc/systemd/system/docker.service.d/https-proxy.conf
fi
sudo systemctl daemon-reload
sudo systemctl restart docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment