forked from gdfsnhsw/AutoClash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
40 lines (36 loc) · 1.44 KB
/
install
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
36
37
38
39
40
#!/bin/bash
#======================================================
# System Required: Debian 10+
# Description: Manage clash
# Author: 2022.01.01
#======================================================
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
# echo "199.232.68.133 raw.githubusercontent.com" >> /etc/hosts
webget(){
#参数【$1】代表下载目录,【$2】代表在线地址
#参数【$3】代表输出显示,【$4】不启用重定向
if curl --version > /dev/null 2>&1;then
[ "$3" = "echooff" ] && progress='-s' || progress='-#'
[ -z "$4" ] && redirect='-L' || redirect=''
result=$(curl -w %{http_code} --connect-timeout 5 $progress $redirect -ko $1 $2)
else
if wget --version > /dev/null 2>&1;then
[ "$3" = "echooff" ] && progress='-q' || progress='-q --show-progress'
[ "$4" = "rediroff" ] && redirect='--max-redirect=0' || redirect=''
certificate='--no-check-certificate'
timeout='--timeout=3'
fi
[ "$3" = "echoon" ] && progress=''
[ "$3" = "echooff" ] && progress='-q'
wget $progress $redirect $certificate $timeout -O $1 $2
[ $? -eq 0 ] && result="200"
fi
}
echo -----------------------------------------------
echo -e "${green}开始从服务器获取安装文件!${plain}"
webget /usr/local/bin/autoclash https://mirror.ghproxy.com/https://raw.githubusercontent.com/gdfsnhsw/AutoClash/master/scripts/autoclash
chmod +x /usr/local/bin/autoclash >> /dev/null 2>&1
autoclash install