From 1b483bb48a316bb634a84db5b33c00f9b8883b61 Mon Sep 17 00:00:00 2001 From: Nick White Date: Sat, 13 Nov 2010 21:06:41 +0000 Subject: Add crx creation script (untested) --- Makefile | 5 ++--- TODO | 6 +----- chromium/makecrx.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 chromium/makecrx.sh diff --git a/Makefile b/Makefile index 0564ee6..f754f33 100644 --- a/Makefile +++ b/Makefile @@ -42,9 +42,8 @@ crx: simplyread.js chromium/icon.svg chromium/manifest.json chromium/background. @cp COPYING simplyread.js chromium/background.html chromium-build/ @rsvg chromium/icon.svg chromium-build/icon.png @sed "s/VERSION/$(VERSION)/g" < chromium/manifest.json > chromium-build/manifest.json - @chromium-browser --pack-extension=chromium-build - @mv chromium-build.crx $(NAME)-$(VERSION).crx - @rm -r chromium-build chromium-build.pem + @sh chromium/makecrx.sh chromium-build chromium/private.pem > $(NAME)-$(VERSION).crx + @rm -r chromium-build @gpg -b < $(NAME)-$(VERSION).crx > $(NAME)-$(VERSION).crx.sig @echo $(NAME)-$(VERSION).crx $(NAME)-$(VERSION).crx.sig diff --git a/TODO b/TODO index 20edcf8..d875f8d 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,2 @@ -chromium extension http://code.google.com/chrome/extensions/index.html - use a simple script to create crx rather than chromium-browser - http://code.google.com/chrome/extensions/crx.html - is the script src=simplyread in background.html necessary? - handle signing extension properly +chromium: is the script src=simplyread in background.html necessary? make tests, which process sample html files and check the output diff --git a/chromium/makecrx.sh b/chromium/makecrx.sh new file mode 100755 index 0000000..ca97835 --- /dev/null +++ b/chromium/makecrx.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Purpose: Pack a Chromium extension directory into crx format +# +# Based on bash script at: +# http://code.google.com/chrome/extensions/crx.html +# Licensed under the BSD license + +test $# -ne 2 && echo "Usage: $0 dir pem" && exit 1 + +dir=$1 +key=$2 +pub="pubkey" +sig="sig" +zip="tmp.zip" +trap 'rm -f "$pub" "$sig" "$zip"' EXIT + +wd=`pwd` && cd "$dir" && zip -qr -9 -X "$wd/$zip" . ; cd "$wd" + +openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig" +openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null + +crmagic_hex="4372 3234" # Cr24 +version_hex="0200 0000" # 2 +pub_len_hex=`stat -c %s "$pub" | xargs printf '%08x\n' | rev | dd conv=swab 2>/dev/null` +sig_len_hex=`stat -c %s "$sig" | xargs printf '%08x\n' | rev | dd conv=swab 2>/dev/null` + +echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p +cat "$pub" "$sig" "$zip" -- cgit v1.2.3