Revision fbf0503f
Added by jahoti almost 2 years ago
build.sh | ||
---|---|---|
21 | 21 |
echo " -b, build=[LOC]: set file/directory to use for building" |
22 | 22 |
echo " -h, help: print usage information and exit" |
23 | 23 |
echo " -o, output=[LOC]: set output file/directory" |
24 |
echo " -k, key=[LOC]: select a key to use in building and" |
|
25 |
echo " signing a CRX" |
|
24 | 26 |
echo " -s, safe: don't delete existing directories;" |
25 |
echo " throw an error instead."
|
|
27 |
echo " throw an error instead" |
|
26 | 28 |
echo " -z, zip: pack the extension as a file" |
27 | 29 |
echo |
28 | 30 |
echo "environment variables (optional)" |
... | ... | |
46 | 48 |
-b | --build) BUILDDIR="$2"; shift;; |
47 | 49 |
build=*) BUILDDIR="$(echo "$1" | cut -c 7-)";; |
48 | 50 |
-h | --help | help) print_usage;; |
51 |
-k | --key) KEY="$2"; shift;; |
|
52 |
key=*) KEY="$(echo "$1" | cut -c 5-)";; |
|
49 | 53 |
-o | --output) OUTPUT="$2"; shift;; |
50 | 54 |
output=*) OUTPUT="$(echo "$1" | cut -c 8-)";; |
51 | 55 |
-s | --safe | safe) FORCE=0;; |
... | ... | |
57 | 61 |
|
58 | 62 |
if [ "x$BROWSER" = x ]; then |
59 | 63 |
print_usage 1 No browser was specified. |
64 |
elif [ "x$KEY" != x ]; then |
|
65 |
if [ $BROWSER != chromium ]; then |
|
66 |
print_usage 4 The "'key'" option applies only to builds 'for' Chromium. |
|
67 |
elif [ $MAKEZIP = 0 ]; then |
|
68 |
print_usage 4 The "'key'" option must be used in conjunction with the "'zip'" option. |
|
69 |
elif [ ! -e "$KEY" ]; then |
|
70 |
print_usage 5 The specified key file "'$KEY'" does not exist. |
|
71 |
fi |
|
72 |
KEY="$(realpath "$KEY")" |
|
60 | 73 |
fi |
61 | 74 |
|
62 |
|
|
63 |
if [ $MAKEZIP = 1 ]; then |
|
75 |
if [ "x$KEY" != x ]; then |
|
76 |
PACKDIR="${BUILDDIR:-build_$BROWSER}" |
|
77 |
BUILDDIR="$PACKDIR"/inner |
|
78 |
OUTPUT="${OUTPUT:-build.crx}" |
|
79 |
|
|
80 |
mkdir "$PACKDIR" |
|
81 |
elif [ $MAKEZIP = 1 ]; then |
|
64 | 82 |
BUILDDIR="${BUILDDIR:-build_$BROWSER}" |
83 |
PACKDIR="$BUILDDIR" |
|
65 | 84 |
|
66 | 85 |
if [ "x$OUTPUT" = x ]; then |
67 | 86 |
case $BROWSER in |
68 |
chromium) OUTPUT=build.zip;; |
|
69 |
mozilla) OUTPUT=build.xpi;; |
|
87 |
chromium) OUTPUT=build.zip;;
|
|
88 |
mozilla) OUTPUT=build.xpi;;
|
|
70 | 89 |
esac |
71 | 90 |
fi |
72 | 91 |
else |
... | ... | |
99 | 118 |
main |
100 | 119 |
if [ $MAKEZIP = 1 ]; then |
101 | 120 |
make_zip |
102 |
mv "$BUILDDIR"/build.zip "$OUTPUT"
|
|
103 |
rm -rf "$BUILDDIR"
|
|
121 |
mv "$PACKDIR"/build.zip "$OUTPUT"
|
|
122 |
rm -rf "$PACKDIR"
|
|
104 | 123 |
elif [ "$BUILDDIR" != "$OUTPUT" ]; then |
105 | 124 |
mv "$BUILDDIR" "$OUTPUT" |
106 | 125 |
fi |
Also available in: Unified diff
Support building CRXs
Chromium now builds CRXs rather than ZIPs when given a key.