-
Notifications
You must be signed in to change notification settings - Fork 16
/
makexpi.sh
executable file
·52 lines (43 loc) · 1.06 KB
/
makexpi.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
#!/bin/sh
# builds a .xpi from the git repository, placing the .xpi in the root
# of the repository.
#
# invoke with no arguments to build from the current src directory.
#
# ./makexpi.sh
#
# OR, invoke with a tag name to build a specific branch or tag.
#
# e.g.:
#
# ./makexpi.sh 0.2.3.development.2
#
# Script adapted from
# https://gitweb.torproject.org/https-everywhere.git/blob/HEAD:/makexpi.sh
set -e
APP_NAME=noscript
BUILDDIR=build
cd "`dirname $0`"
rm -rf "$BUILDDIR"
mkdir "$BUILDDIR"
# If the command line argument is a tag name, check that out and build it
if [ -n "$1" ]; then
cp -a .git "$BUILDDIR"
cd "$BUILDDIR"
git reset --hard "$1"
else
cp -a xpi "$BUILDDIR"
cd "$BUILDDIR"
fi
# The name/version of the XPI we're building comes from manifest.json
VERSION=`sed -ne '/"version":/{s/^.*: *"\(.*\)" *,.*$/\1/;p}' xpi/manifest.json`
XPI_NAME="$APP_NAME-$VERSION"
if [ "$1" ]; then
XPI_NAME="$XPI_NAME.xpi"
else
XPI_NAME="$XPI_NAME~pre.xpi"
fi
../version.py --add "$VERSION" xpi
# Build the XPI!
rm -f "../$XPI_NAME"
(cd xpi && zip -q -r "../../$XPI_NAME" .)