forked from Magic-Xin/mips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
53 lines (47 loc) · 1.19 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
#!/bin/sh
MODULE=shadowsocks
VERSION=`cat ./shadowsocks/ss/version|sed -n 1p`
TITLE=shadowsocks
DESCRIPTION=shadowsocks
HOME_URL=Main_Ss_Content.asp
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://github.com/Magic-Xin/ssr_mips/blob/master/shadowsocks.tar.gz",
"title":"$TITLE",
"version":"$VERSION"
}
EOF
}
do_backup(){
HISTORY_DIR="./history"
# backup latested package after pack
backup_version=`cat version | sed -n 1p`
backup_tar_md5=`cat version | sed -n 2p`
echo backup VERSION $backup_version
cp ${MODULE}.tar.gz $HISTORY_DIR/${MODULE}_$backup_version.tar.gz
sed -i "/$backup_version/d" "$HISTORY_DIR"/md5sum.txt
echo $backup_tar_md5 ${MODULE}_$backup_version.tar.gz >> "$HISTORY_DIR"/md5sum.txt
}
do_build
do_backup