forked from skullkey/FBReaderJ
-
Notifications
You must be signed in to change notification settings - Fork 3
/
packageTool.sh
executable file
·54 lines (46 loc) · 1.13 KB
/
packageTool.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
#!/bin/sh
updateVersionArg="--updateVersion"
buildSourceArchiveArg="--buildSourceArchive"
printUsage() {
echo "usages:\n $0 $updateVersionArg [version]\n $0 $buildSourceArchiveArg [version]";
exit;
}
if [ $# -ne 1 -a $# -ne 2 ]; then
printUsage;
fi
updateVersion() {
major=`echo $version | cut -d . -f 1`
minor=`echo $version | cut -d . -f 2`
micro=`echo $version | cut -d . -f 3`
intversion=$((10000*$major+100*$minor+$micro))
sed "s/@INTVERSION@/$intversion/" AndroidManifest.xml.pattern | sed "s/@VERSION@/$version/" > AndroidManifest.xml
}
buildSourceArchive() {
updateVersion
ant clean
rm -rf $dir $archive
mkdir $dir
cp -r data icons src jni build.xml AndroidManifest.xml* res *.properties createRawResources.py libs HowToBuild $0 VERSION ChangeLog $dir
rm -rf `find $dir -name .svn`
zip -rq $archive $dir/*
rm -rf $dir
}
if [ $# -eq 2 ]; then
version=$2;
echo $version > VERSION
else
version=`cat VERSION`
fi
dir=FBReaderJ-sources-$version
archive=FBReaderJ-sources-$version.zip
case $1 in
$updateVersionArg)
updateVersion;
;;
$buildSourceArchiveArg)
buildSourceArchive;
;;
*)
printUsage;
;;
esac