-
Notifications
You must be signed in to change notification settings - Fork 739
Expand file tree
/
Copy pathv2_update.sh
More file actions
76 lines (76 loc) · 2.44 KB
/
v2_update.sh
File metadata and controls
76 lines (76 loc) · 2.44 KB
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
#!/bin/bash
#只能在x86-64的openwrt系统上更lean大佬的XXXPLUS和passwall的v2插件!
# bash -c "$(wget -O- https://git.io/JvTVT)"
#Version: v2.0.2 By Len yu.
cd /tmp/tmp
rm -rf *
echo
clear
echo
echo
echo -e " $green Version: v2.0.2 By Len yu.$none"
echo
echo -e " $green 只能x86-64的openwrt系统上,可更新lean大佬的XXXPLUS和passwall的v2插件!$none"
sleep 2
clear
echo
echo -e " $green 正在获取网络v2ray最新版信息..$none"
echo
#judgment
v2ray_latest_ver="$(curl -H 'Cache-Control: no-cache' -s https://api.github.com/repos/v2ray/v2ray-core/releases/latest | grep 'tag_name' | cut -d\" -f4)"
sleep 2
v2ray_ver="v$(/usr/bin/v2ray/v2ray -version | grep "V2" | awk '{print $2}')" &> /dev/null
if [ "$v2ray_ver" != "$v2ray_latest_ver" ]; then
clear
echo
echo -e " $green 咦...发现新版本耶....正在拼命更新.......$none"
echo
v2ray_download_link="https://github.com/v2ray/v2ray-core/releases/download/$v2ray_latest_ver/v2ray-linux-64.zip"
echo
echo
wget "$v2ray_download_link"
unzip -o v2ray-linux-64.zip &> /dev/null
echo
else
clear
echo
echo -e " $green 木有发现新版本....$none"
echo
exit 0
fi
##install
st="`ps | grep "passwall" | awk '{print $8}' | cut -d/ -f4`" &> /dev/null
sr="`ps -ef | grep "ssr-retcp" | awk '{print $9}' | echo ${sr: 13:5}`" &> /dev/null
if [[ "$st" = "passwall" && -e /tmp/tmp/v2ray ]]; then
mv -f /tmp/tmp/v2ctl /usr/bin/v2ray
mv -f /tmp/tmp/v2ray /usr/bin/v2ray
chmod 755 /usr/bin/v2ray/v2ctl
chmod 755 /usr/bin/v2ray/v2ray
/etc/init.d/passwall restart
echo
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${cyan}$v2ray_latest_ver$none"
echo
echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题..V2Ray路由端的版本最好和服务器的版本保持一致$none"
echo
echo
exit 0
elif [[ "$sr" = "retcp" && -e /tmp/tmp/v2ray ]]; then
mv -f /tmp/tmp/v2ctl /usr/bin/v2ray
mv -f /tmp/tmp/v2ray /usr/bin/v2ray
chmod 755 /usr/bin/v2ray/v2ctl
chmod 755 /usr/bin/v2ray/v2ray
/etc/init.d/shadowsocksr restart
echo
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${cyan}$v2ray_latest_ver$none"
echo
echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题...V2Ray路由端的版本最好和服务器的版本保持一致$none"
echo
echo
exit 0
else
echo
echo -e "$red 下载 V2Ray 失败[需要连接科学]...请重试...$none"
echo
echo
exit 0
fi