-
Notifications
You must be signed in to change notification settings - Fork 8
/
pack.sh
72 lines (54 loc) · 1.36 KB
/
pack.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
#!/bin/sh
# $1 = src dir
# $2 = binary dir
NAME=app
BINARY=self_o_mat.app
FILES="$BINARY settings/* i18n/* assets/* libs/* camlibs/* firmware.hex version app/* self_o_mat"
TAR=update.tar
BIN_DIR=$2
CAMLIBS_DIR="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22"
clean() {
echo "Cleaning in $BIN_DIR"
# to to build dir
cd $BIN_DIR
# clean libs
rm -rf ./libs
rm -rf ./camlibs
# clean settings and assets
rm -rf ./assets
rm -rf ./settings
rm -rf ./i18n
rm -rf ./firmware.hex
rm -rf ./version
rm -rf ./app
rm -rf $TAR
}
echo "Packing files in $1"
clean
cd $2
rm -f selfomat.update
rm -f selfomat.tar.gz
# get the settings and assets from src dir into the build dir
cp -r $1/assets .
cp -r $1/settings .
cp -r $1/i18n .
cp $1/firmware.hex .
cp -r $1/web/www ./app
cp $1/start.sh ./self_o_mat
#get the camlibs
cp -r $CAMLIBS_DIR ./camlibs
# write version info
echo -n "v_`date +'%s'`" > version
# get libs
if [ ! -d libs ]; then
mkdir -p libs
fi
ldd $BINARY | grep "=> /" | while read a b c d; do cp "$c" libs/; done
# pack and sign
tar cfz $NAME.tar.gz $FILES
cp $NAME.tar.gz selfomat.tar.gz
gpg --quiet --batch --yes --output $NAME.sig --detach-sig $NAME.tar.gz
tar cf $TAR $NAME.tar.gz $NAME.sig
rm $NAME.tar.gz $NAME.sig
gpg --batch --yes --output selfomat.update --encrypt --recipient [email protected] $TAR
clean