-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sh
executable file
·54 lines (46 loc) · 1.22 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
#!/bin/bash
#
# Build script for add-on resulting in zip formmated file
# todotxt_$version$.xpi
function show_help {
echo "usage: build.sh [-d | -h]"
echo "Options and arguments"
echo "-d : Enabling debugging, will show debug messages in Thunderbird [NOT FOR PRODUCTION]"
echo "-h : Show this help"
}
while getopts "dh" opt; do
case $opt in
d)
echo "Building add-on with DEBUGGING enabled!"
DEV=true
;;
h)
show_help
exit 0
;;
\?)
show_help
exit 1
;;
esac
done
if [ -e manifest.json ]; then
VERSION=$(sed -n 's/.*version": "\(.*\)",/\1/p' manifest.json)
FILE="todotxt_${VERSION}.xpi"
else
echo '[ERROR] build.sh not executed from add-on directory, exiting!'
exit 1
fi
echo "Building version [$VERSION]"
PREV_BUILDS="$(ls todotxt_* 2>/dev/null)"
if [ -n "$PREV_BUILDS" ]; then
echo "Removing old builds [$PREV_BUILDS]"
rm $PREV_BUILDS
fi
# Ensure that debugMode is set to false
if [ ! $DEV ]; then
sed -i 's/ mDebugMode = true;/ mDebugMode = false;/g' modules/logger.jsm
fi
zip -qr $FILE chrome* manifest.json components defaults icon.png modules
sed -i 's/ mDebugMode = false;/ mDebugMode = true;/g' modules/logger.jsm
echo "Finished build [$FILE]"