-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetproxy
More file actions
executable file
·27 lines (23 loc) · 854 Bytes
/
setproxy
File metadata and controls
executable file
·27 lines (23 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
PROXY=10.1.101.150
PORT=3128
USERNAME=111403023
echo -n Password for 111403023@10.1.101.150:3128:
read -s PASSWORD
echo
gsettings set org.gnome.system.proxy mode manual
gsettings set org.gnome.system.proxy.http host "$PROXY"
gsettings set org.gnome.system.proxy.http port "$PORT"
gsettings set org.gnome.system.proxy.https host "$PROXY"
gsettings set org.gnome.system.proxy.https port "$PORT"
gsettings set org.gnome.system.proxy use-same-proxy true
sudo sed -i.bak '/http[s]::proxy/Id' /etc/apt/apt.conf
sudo tee -a /etc/apt/apt.conf <<EOF
Acquire::http::proxy "http://$USERNAME:$PASSWORD@$PROXY:$PORT/";
Acquire::https::proxy "http://$USERNAME:$PASSWORD@$PROXY:$PORT/";
EOF
sudo sed -i.bak '/http[s]_proxy/Id' /etc/environment
sudo tee -a /etc/environment <<EOF
http_proxy="http://$PROXY:$PORT/"
https_proxy="http://$PROXY:$PORT/"
EOF