-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·145 lines (114 loc) · 4.27 KB
/
release.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/sh
#############################
# V2ray for Android插件发布脚本
#############################
V2RAY_CORE_RELEASE_URL="https://github.com/v2fly/v2ray-core/releases"
V2MANAGER_RELEASE_URL="https://github.com/yatsuki/v2manager/releases"
V2RULES_RELEASE_URL="https://github.com/Loyalsoldier/v2ray-rules-dat/releases"
download_v2ray_core(){
# 检查最新版本
latest_ver=`curl -k -s -I "${V2RAY_CORE_RELEASE_URL}/latest" | grep -i location | grep -o "tag.*" | grep -o "v[0-9.]*"`
if [ "${latest_ver}" = "" ] ; then
echo "Error: Connect official V2Ray download link failed."
exit 1
fi
# 下载最新arm32版本V2ray
arm32_link="${V2RAY_CORE_RELEASE_URL}/download/${latest_ver}/v2ray-linux-arm32-v7a.zip"
curl "${arm32_link}" -k -L -o ./tmp/v2ray-core-arm32.zip >&2
if [ "$?" != "0" ] ; then
echo "Error: Download V2Ray core[arm32] failed."
exit 1
fi
# 下载最新arm64版本V2ray
arm64_link="${V2RAY_CORE_RELEASE_URL}/download/${latest_ver}/v2ray-android-arm64-v8a.zip"
curl "${arm64_link}" -k -L -o ./tmp/v2ray-core-arm64.zip >&2
if [ "$?" != "0" ] ; then
echo "Error: Download V2Ray core[arm64] failed."
exit 1
fi
}
download_v2manager(){
# 检查最新版本
manager_ver=`curl -k -s -I "${V2MANAGER_RELEASE_URL}/latest" | grep -i location | grep -o "tag.*" | grep -o "v[0-9.]*"`
if [ "${manager_ver}" = "" ] ; then
echo "Error: Connect v2manager download link failed."
exit 1
fi
# 下载最新armeabi-v7a版本v2manager
m32_link="${V2MANAGER_RELEASE_URL}/download/${manager_ver}/app-armeabi-v7a-release.apk"
curl "${m32_link}" -k -L -o ./tmp/v2manager-v7a.apk >&2
if [ "$?" != "0" ] ; then
echo "Error: Download v2manager[armeabi-v7a] failed."
exit 1
fi
# 下载最新arm64-v8a版本V2ray
m64_link="${V2MANAGER_RELEASE_URL}/download/${manager_ver}/app-arm64-v8a-release.apk"
curl "${m64_link}" -k -L -o ./tmp/v2manager-v8a.apk >&2
if [ "$?" != "0" ] ; then
echo "Error: Download v2manager[arm64-v8a] failed."
exit 1
fi
}
download_dat_file(){
latest_ver=`curl -k -s -I "${V2RULES_RELEASE_URL}/latest" | grep -i location | grep -o "tag.*" | grep -o "[0-9.]*"`
if [ "${latest_ver}" = "" ] ; then
echo "Error: Connect official V2Ray rules dat download link failed."
exit 1
fi
geoip_link="${V2RULES_RELEASE_URL}/download/${latest_ver}/geoip.dat"
curl "${geoip_link}" -k -L -o ./tmp/geoip.dat >&2
if [ "$?" != "0" ] ; then
echo "Error: Download geoip.dat failed."
exit 1
fi
geosite_link="${V2RULES_RELEASE_URL}/download/${latest_ver}/geosite.dat"
curl "${geosite_link}" -k -L -o ./tmp/geosite.dat >&2
if [ "$?" != "0" ] ; then
echo "Error: Download geosite.dat failed."
exit 1
fi
}
zip_files(){
# 创建32位版本zip文件
zip -q -r v2ray-magisk-android32.zip META-INF v2ray customize.sh README.md service.sh uninstall.sh
# 创建64位版本zip文件
zip -q -r v2ray-magisk-android64.zip META-INF v2ray customize.sh README.md service.sh uninstall.sh
# 移动可能被覆盖的文件
mv v2ray v2ray.bk
mv module.prop module.prop.bk
# 整理32位打包文件
mkdir v2ray
mkdir v2ray/bin
cp tmp/geoip.dat v2ray/bin/geoip.dat
cp tmp/geosite.dat v2ray/bin/geosite.dat
cp tmp/v2manager-v7a.apk v2ray/bin/v2manager.apk
unzip -j -o tmp/v2ray-core-arm32.zip "v2ray" -d v2ray/bin/
cp module.prop.bk module.prop
echo "updateJson=https://yatsuki.github.io/v2ray-release/release32.json" >> module.prop
zip -q -r -u v2ray-magisk-android32.zip v2ray/bin module.prop
rm -rf v2ray module.prop
# 整理64位打包文件
mkdir v2ray
mkdir v2ray/bin
cp tmp/geoip.dat v2ray/bin/geoip.dat
cp tmp/geosite.dat v2ray/bin/geosite.dat
cp tmp/v2manager-v8a.apk v2ray/bin/v2manager.apk
unzip -j -o tmp/v2ray-core-arm64.zip "v2ray" -d v2ray/bin/
cp module.prop.bk module.prop
echo "updateJson=https://yatsuki.github.io/v2ray-release/release64.json" >> module.prop
zip -q -r -u v2ray-magisk-android64.zip v2ray/bin module.prop
rm -rf v2ray module.prop
# 还原文件
mv v2ray.bk v2ray
mv module.prop.bk module.prop
}
# 检查代码是否检出
mkdir tmp
# 下载V2ray二进制文件
download_v2ray_core
# 下载v2manager管理应用
download_v2manager
# 下载增强路由规则文件
download_dat_file
# 打包文件
zip_files