forked from scriptish/scriptish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·62 lines (52 loc) · 1.46 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
55
56
57
58
59
60
61
62
#!/bin/sh
# Set up variables
if [ "amo" = "$1" ]; then
# For official builds, use the version in install.rdf.
VER=`grep -Go 'em:version\>\(.*\)\<' extension/install.rdf | grep -Go '>\(.*\)<' | sed -e 's/[><]*//g'`
elif [ "test" = "$1" ]; then
VER=`echo test`
else
# For beta builds, generate a version number.
VER=`date +"%Y.%m.%d.beta"`
fi
XPI="scriptish-$VER.xpi"
# Copy base structure to a temporary build directory and change to it
if [ "test" != "$1" ]; then
echo "Creating working directory ..."
fi
rm -rf build
mkdir build
cp LICENSE.txt build/
cd extension
cp -r \
chrome.manifest components content defaults install.rdf license \
locale modules skin \
../build/
cd ../build
sed -e 's/extension\/license/license/g' LICENSE.txt > LICENSE.txt.$$
mv LICENSE.txt.$$ LICENSE.txt
if [ "amo" = "$1" ]; then
(sed -e 's/<em\:update.*//g' install.rdf > install.rdf.$$ &&
mv install.rdf.$$ install.rdf)
fi
(sed -e 's/<!--.*//g' install.rdf > install.rdf.$$ &&
mv install.rdf.$$ install.rdf)
if [ "test" != "$1" ]; then
find . -depth -name '*~' -exec rm -rf "{}" \;
find . -depth -name '#*' -exec rm -rf "{}" \;
find . -depth -name '.DS_Store' -exec rm "{}" \;
if [ "amo" = "$1" ]; then
rm -rf content/tests
rm -rf content/js/third-party/qunit
fi
fi
echo "Creating $XPI ..."
zip -qr9XD "../$XPI" *
if [ "test" != "$1" ]; then
echo "Cleaning up temporary files ..."
fi
cd ..
rm -rf build
if [ "amo" = "$1" ]; then
openssl sha1 "$XPI"
fi