forked from ingomueller-net/ThunderBirthDay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·67 lines (59 loc) · 1.58 KB
/
make.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
#!/bin/bash
#
# Packages the ThunderBirthDay add-on in a xpi-file.
# Entries from .gitignore are ignored.
#
# Usage: ./make.sh
#
ROOTDIR="$(pushd `dirname $0` > /dev/null; pwd; popd > /dev/null)"
# Find install.rdf
SRCDIR="$ROOTDIR/src"
if [ ! -e "$SRCDIR/install.rdf" ]
then
echo "install.rdf not found. Exiting..."
exit
fi
# Find version
VERSION=$(grep em:version "$SRCDIR/install.rdf" | sed "s/.*<em:version>//" | sed "s/<\/.*//")
if [[ -z "$VERSION" ]]
then
echo "version number not found. Exiting..."
exit
fi
# Find output directory
GENDIR="$ROOTDIR/gen"
if [ ! -d "$GENDIR" ]
then
echo "gen directory not found. Exiting..."
exit
fi
# Remove old XPI
XPIFILE="$GENDIR/thunderbirthday-$VERSION.xpi"
rm -f "$XPIFILE"
# Create XPI (02/05/2016 Dirk Busse - Added support for 7-Zip if normal 'zip' application fails.)
cd "$SRCDIR"
zip -r "$XPIFILE" . -x@"$ROOTDIR/.gitignore"
if [ $? -eq 0 ]
then
# Using zip was successful.
cd "$ROOTDIR"
zip "$XPIFILE" README.md
else
# Using zip failed.
# Now check if 7-Zip exists.
echo "Using zip failed. Now trying 7-Zip."
if [ -f "/c/Programme/7-Zip/7z.exe" ]
then
"/c/Programme/7-Zip/7z.exe" a -tzip -r "$XPIFILE" .
cd "$ROOTDIR"
"/c/Programme/7-Zip/7z.exe" a -tzip "$XPIFILE" README.md
elif [ -f "/c/Programme (x86)/7-Zip/7z.exe" ]
then
"/c/Programme (x86)/7-Zip/7z.exe" a -tzip -r "$XPIFILE" .
cd "$ROOTDIR"
"/c/Programme (x86)/7-Zip/7z.exe" a -tzip "$XPIFILE" README.md
else
echo "No zip application found. Exiting..."
exit
fi
fi