-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsquid.sh
36 lines (33 loc) · 1.16 KB
/
squid.sh
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
28
29
30
31
32
33
34
35
# initialisasi var
export DEBIAN_FRONTEND=noninteractive
OS=`uname -m`;
MYIP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
if [[ "$MYIP" = "" ]]; then
MYIP=$(wget -qO- ipv4.icanhazip.com)
fi
if [[ -e /etc/debian_version ]]; then
OSystem=debian
RCLOCAL='/etc/rc.local'
elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then
OSystem=centos
RCLOCAL='/etc/rc.d/rc.local'
chmod +x /etc/rc.d/rc.local
else
echo "Looks like you aren't running this installer on a Debian, Ubuntu or CentOS system"
exit
fi
MYIP2="s/xxxxxxxxx/$MYIP/g";
if [ $OSystem = 'debian' ]; then
apt-get -y update
apt-get -y install squid3
wget -O /etc/squid3/squid.conf "https://raw.githubusercontent.com/GegeEmbrie/autosshvpn/master/file/squid3.conf"
sed -i $MYIP2 /etc/squid3/squid.conf;
service squid3 restart
rm squid.sh
elif [ $OSystem = 'centos' ]; then
yum -y install squid
wget -O /etc/squid/squid.conf "https://raw.githubusercontent.com/GegeEmbrie/autosshvpn/master/file/squid3.conf"
sed -i $MYIP2 /etc/squid/squid.conf;
service squid restart
chkconfig squid on
fi