summaryrefslogtreecommitdiffstats
path: root/release-utils/make-signed-xpi.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:55:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:55:34 +0000
commit75417f5e3d32645859d94cec82255dc130ec4a2e (patch)
tree5fd46925c6b4a881c9208772ed8e5cc0588bc164 /release-utils/make-signed-xpi.sh
parentInitial commit. (diff)
downloadprivacybadger-75417f5e3d32645859d94cec82255dc130ec4a2e.tar.xz
privacybadger-75417f5e3d32645859d94cec82255dc130ec4a2e.zip
Adding upstream version 2020.10.7.upstream/2020.10.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'release-utils/make-signed-xpi.sh')
-rwxr-xr-xrelease-utils/make-signed-xpi.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/release-utils/make-signed-xpi.sh b/release-utils/make-signed-xpi.sh
new file mode 100755
index 0000000..cf3fe73
--- /dev/null
+++ b/release-utils/make-signed-xpi.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+set -e
+
+cd "$(dirname "$0")"
+
+LATEST_SDK_VERSION=5.2.0
+WEB_EXT=../node_modules/.bin/web-ext
+
+# Auto-generated XPI name from 'web-ext sign'
+PRE_XPI_NAME=privacy_badger_by_eff-$TARGET-an+fx.xpi
+XPI_NAME="privacy-badger-eff-$1.xpi"
+AMO_ZIP_NAME="privacy_badger-$1.amo.zip"
+
+if ! type $WEB_EXT > /dev/null; then
+ echo "Please install web-ext before running this script."
+ exit 1
+fi
+
+if ! $WEB_EXT --version | grep -q "$LATEST_SDK_VERSION"; then
+ echo "Please use the latest stable web-ext version or edit this script to the current version."
+ exit 1
+fi
+
+if [ $# -ne 1 ]; then
+ echo "Usage: $0 <version to release>"
+ exit 1
+fi
+
+echo "changing author value"
+sed -i -e '/eff.software.projects@gmail.com/,+1d' -e 's/"author": {/"author": "privacybadger-owner@eff.org",/' ../checkout/src/manifest.json
+
+echo "removing Chrome's update_url"
+# remove update_url
+sed -i -e '/"update_url": "https:\/\/clients2.google.com\/service\/update2\/crx"/,+0d' ../checkout/src/manifest.json
+# fix the trailing comma
+# TODO fragile! at least we validate the JSON below
+# https://unix.stackexchange.com/a/26288
+# https://unix.stackexchange.com/a/26290
+sed -i -e '/"storage": {/{
+ n
+ n
+ s/},/}/
+}' ../checkout/src/manifest.json
+
+# lint the checkout folder
+$WEB_EXT lint -s ../checkout/src
+
+echo "making zip file for AMO"
+
+(cd ../checkout/src && rm -f ../../pkg/"$AMO_ZIP_NAME" && zip -q -r ../../pkg/"$AMO_ZIP_NAME" ./*)
+
+echo "insert self hosting package id"
+# Insert self hosted package id
+sed -i 's,"id": "jid1-MnnxcxisBPnSXQ@jetpack","id": "jid1-MnnxcxisBPnSXQ-eff@jetpack"\,\n "update_url": "https://www.eff.org/files/privacy-badger-updates.json",' ../checkout/src/manifest.json
+
+# lint checkout again as our modification above could have broken something
+# disable AMO-specific checks to allow applications.gecko.update_url
+$WEB_EXT lint -s ../checkout/src --self-hosted
+
+#"update_url": "https://www.eff.org/files/privacy-badger-updates.json"
+# Build and sign the XPI
+echo "Running web-ext sign"
+$WEB_EXT sign -s ../checkout/src --api-key "$AMO_API_KEY" --api-secret "$AMO_API_SECRET" -a ../pkg
+mv "../pkg/$PRE_XPI_NAME" "../pkg/$XPI_NAME"