Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
snail007
GitHub Repository: snail007/goproxy
Path: blob/master/install_auto_commercial.sh
684 views
1
#!/bin/bash
2
MIRROR=""
3
if [ "$1" == "cn" ]; then
4
MIRROR="https://mirrors.goproxyauth.com/"
5
fi
6
F="proxy-linux-amd64_commercial.tar.gz"
7
set -e
8
if [ -e /tmp/proxy ]; then
9
rm -rf /tmp/proxy
10
fi
11
mkdir /tmp/proxy
12
cd /tmp/proxy
13
echo -e "\n>>> downloading ... $F\n"
14
manual="https://snail007.goproxyauth.com/goproxy/manual/zh/"
15
LAST_VERSION=$(curl --silent "${MIRROR}https://api.github.com/repos/snail007/goproxy/releases/latest" | grep -Po '"tag_name": *"\K.*?(?=")')
16
wget -t 1 "${MIRROR}https://github.com/snail007/goproxy/releases/download/${LAST_VERSION}/$F"
17
18
echo -e ">>> installing ... \n"
19
# #install proxy
20
tar zxvf $F >/dev/null 2>&1
21
set +e
22
killall -9 proxy >/dev/null 2>&1
23
set -e
24
cp -f proxy /usr/bin/
25
chmod +x /usr/bin/proxy
26
if [ ! -e /etc/proxy ]; then
27
mkdir /etc/proxy
28
cp blocked /etc/proxy
29
cp direct /etc/proxy
30
fi
31
if [ ! -e /etc/proxy/proxy.crt ]; then
32
cd /etc/proxy/
33
proxy keygen -C proxy >/dev/null 2>&1
34
fi
35
rm -rf /tmp/proxy
36
version=`proxy --version 2>&1`
37
echo -e ">>> install done, thanks for using snail007/goproxy $version\n"
38
echo -e ">>> install path /usr/bin/proxy\n"
39
echo -e ">>> configuration path /etc/proxy\n"
40
echo -e ">>> uninstall just exec : rm /usr/bin/proxy && rm -rf /etc/proxy\n"
41
echo -e ">>> How to using? Please visit : $manual\n"
42
43