-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·68 lines (55 loc) · 1.21 KB
/
build.sh
File metadata and controls
executable file
·68 lines (55 loc) · 1.21 KB
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
#!/bin/bash
FILENAME=manifest.json
PLATFORM=${1:-chromium}
KEEP_MANIFEST=NO
# parse arguments
for i in "$@"
do
case $i in
--keep-manifest)
KEEP_MANIFEST=YES
shift
;;
--platform=*)
PLATFORM="${i#*=}"
shift
;;
*)
# unknown option
;;
esac
done
MANIFEST_PATH=platform/$PLATFORM
# Get version from manifest
if [ -f "$MANIFEST_PATH/$FILENAME" ]; then
while read line; do
IFS=':';
split=($line);
unset IFS;
key=${split[0]}
value=${split[1]}
# get version number from line 'version'
tag=\"version\"
if [ "$key" == "$tag" ]; then
# delete old zip files
if [ -f build/DuoExplained_*.${PLATFORM}.zip ]; then
rm build/DuoExplained_*.${PLATFORM}.zip
fi
# format version string from '"0.0.1",' to '001'
formated=$(echo "$value" | sed 's/[\,\ "]//g')
# create zip
ZIPNAME="build/DuoExplained_${formated}.${PLATFORM}.zip"
# put manifest outside temporarily
cp $MANIFEST_PATH/manifest.json .
# pick files and folders to zip
zip -r "$ZIPNAME" manifest.json images scripts styles popup docs lib locales
if [ "$KEEP_MANIFEST" == "NO" ]; then
# remove manifest
rm manifest.json
fi
break
fi
done < $MANIFEST_PATH/$FILENAME
else
echo "File $MANIFEST_PATH/$FILENAME seems to be missing!"
fi