-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
101 lines (95 loc) · 2.92 KB
/
install.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
CHINAIP=$(curl -s https://api.ip.sb/geoip | grep China)
if [ ! -n "$CHINAIP" ]; then
UDP2RAW_URL=https://github.com/wangyu-/udp2raw/releases/download/20230206.0/udp2raw_binaries.tar.gz
UDPSPEEDER_URL=https://github.com/wangyu-/UDPspeeder/releases/download/20230206.0/speederv2_binaries.tar.gz
else
UDP2RAW_URL=https://soft.huayizhiyun.com/network/udptools/udp2raw/udp2raw_20230206.tar.gz
UDPSPEEDER_URL=https://soft.huayizhiyun.com/network/udptools/udpspeeder/speederv2_20230206.tar.gz
fi
#判断系统和决定BIN名
if [[ `getconf WORD_BIT` = '32' && `getconf LONG_BIT` = '64' ]] ; then
Is_64bit='y'
UDP2RAW_BIN='udp2raw_amd64'
UDPSPEEDER_BIN='speederv2_amd64'
else
Is_64bit='n'
UDP2RAW_BIN='udp2raw_x86'
UDPSPEEDER_BIN='speederv2_x86'
fi
if uname -m | grep -Eqi "arm|aarch64"; then
Is_ARM='y'
UDP2RAW_BIN='udp2raw_arm'
UDPSPEEDER_BIN='speederv2_arm'
fi
#安装程序
Get_udp2raw()
{
#下载并提取相关文件
if [ ! -d "/usr/local/udptools" ]; then
mkdir /usr/local/udptools
fi
if [ ! -d "/usr/local/udptools/bin" ]; then
mkdir /usr/local/udptools/bin
fi
if [ ! -d "/usr/local/udptools/src" ]; then
mkdir /usr/local/udptools/src
fi
cd /usr/local/udptools/src
if [ ! -f "/usr/local/udptools/src/$UDP2RAW_BIN" ]; then
if [ ! -f "/usr/local/udptools/src/udp2raw.tar.gz" ]; then
wget -O udp2raw.tar.gz $UDP2RAW_URL --no-check-certificate
fi
tar -zxvf udp2raw.tar.gz
fi
if [ ! -f "/usr/local/udptools/src/$UDP2RAW_BIN" ]; then
echo "下载udp2raw失败;"
exit
fi
cp /usr/local/udptools/src/$UDP2RAW_BIN /usr/local/udptools/bin/udp2raw
}
Get_udpspeeder()
{
#下载并提取相关文件
if [ ! -d "/usr/local/udptools" ]; then
mkdir /usr/local/udptools
fi
if [ ! -d "/usr/local/udptools/bin" ]; then
mkdir /usr/local/udptools/bin
fi
if [ ! -d "/usr/local/udptools/src" ]; then
mkdir /usr/local/udptools/src
fi
cd /usr/local/udptools/src
if [ ! -f "/usr/local/udptools/src/$UDPSPEEDER_BIN" ]; then
if [ ! -f "/usr/local/udptools/src/udpspeeder.tar.gz" ]; then
wget -O udpspeeder.tar.gz $UDPSPEEDER_URL --no-check-certificate
fi
tar -zxvf udpspeeder.tar.gz
fi
if [ ! -f "/usr/local/udptools/src/$UDPSPEEDER_BIN" ]; then
echo "下载udpspeeder失败;"
exit
fi
cp /usr/local/udptools/src/$UDPSPEEDER_BIN /usr/local/udptools/bin/udpspeeder
}
if [ ! -f "/usr/local/udptools/bin/udp2raw" ]; then
Get_udp2raw
fi
if [ ! -f "/usr/local/udptools/bin/udpspeeder" ]; then
Get_udpspeeder
fi
if [ ! -d "/usr/local/udptools/pid" ]; then
mkdir /usr/local/udptools/pid
fi
if [ ! -d "/usr/local/udptools/log" ]; then
mkdir /usr/local/udptools/log
fi
if [ ! -d "/usr/local/udptools/conf" ]; then
mkdir /usr/local/udptools/conf
fi
echo "安装完成,请使用udptools脚本添加服务"
echo "Udp2Raw BIN: /usr/local/udptools/bin/udp2raw"
echo "UdpSpeeder BIN:/usr/local/udptools/bin/udpspeeder"