forked from moetaku/fancyss_arm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
62 lines (54 loc) · 1.45 KB
/
build.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
#!/bin/sh
MODULE=shadowsocks
VERSION=`cat ./shadowsocks/ss/version|sed -n 1p`
TITLE=科学上网
DESCRIPTION=科学上网
HOME_URL=Main_Ss_Content.asp
cp_rules(){
cp -rf ./rules/gfwlist.conf shadowsocks/ss/rules/
cp -rf ./rules/chnroute.txt shadowsocks/ss/rules/
cp -rf ./rules/cdn.txt shadowsocks/ss/rules/
cp -rf ./rules/version1 shadowsocks/ss/rules/version
}
sync_v2ray_binary(){
v2ray_version=`cat ./v2ray_binary/latest.txt`
md5_latest=`md5sum ./v2ray_binary/$v2ray_version/v2ray | sed 's/ /\n/g'| sed -n 1p`
md5_old=`md5sum shadowsocks/bin//v2ray | sed 's/ /\n/g'| sed -n 1p`
if [ "$md5_latest"x != "$md5_old"x ]; then
echo update v2ray binary!
cp -rf ./v2ray_binary/$v2ray_version/v2ray shadowsocks/bin/
cp -rf ./v2ray_binary/$v2ray_version/v2ctl shadowsocks/bin/
fi
}
do_build() {
if [ "$VERSION" = "" ]; then
echo "version not found"
exit 3
fi
rm -f ${MODULE}.tar.gz
rm -f $MODULE/.DS_Store
rm -f $MODULE/*/.DS_Store
tar -zcvf ${MODULE}.tar.gz $MODULE
md5value=`md5sum ${MODULE}.tar.gz|tr " " "\n"|sed -n 1p`
cat > ./version <<-EOF
$VERSION
$md5value
EOF
cat version
DATE=`date +%Y-%m-%d_%H:%M:%S`
cat > ./config.json.js <<-EOF
{
"build_date":"$DATE",
"description":"$DESCRIPTION",
"home_url":"$HOME_URL",
"md5":"$md5value",
"name":"$MODULE",
"tar_url": "https://raw.githubusercontent.com/moetaku/fancyss_arm/master/shadowsocks.tar.gz",
"title":"$TITLE",
"version":"$VERSION"
}
EOF
}
cp_rules
sync_v2ray_binary
do_build