Browse Source

Build chrome extension

release/v0.1
Mayur Nagekar 9 years ago
parent
commit
6d0bbc4197
  1. 61
      chrome_extension.sh
  2. 28
      pnacl.pem

61
chrome_extension.sh

@ -0,0 +1,61 @@
#!/bin/bash
echo About to create a chrome extension
rm -rf pnacl_${BUILD_NUMBER}.zip
mkdir -p pnacl_${BUILD_NUMBER}
cp -rf iguana/manifest.json pnacl_${BUILD_NUMBER}/
cp -f iguana/pnacl/Release/iguana.pexe pnacl_${BUILD_NUMBER}/
cp -rf confs/* pnacl_${BUILD_NUMBER}/
cp -rf iguana/icon128.png pnacl_${BUILD_NUMBER}/
cp -rf *.html pnacl_${BUILD_NUMBER}/
cp -rf LEGAL/** pnacl_${BUILD_NUMBER}/
cp -rf css/** pnacl_${BUILD_NUMBER}/
cp -rf js/** pnacl_${BUILD_NUMBER}/
echo Listing the contents of pnacl_${BUILD_NUMBER}
ls -al pnacl_${BUILD_NUMBER}/
#echo Zipping now
#zip -r pnacl_${BUILD_NUMBER}.zip pnacl_${BUILD_NUMBER}/
# Purpose: Pack a Chromium extension directory into crx format
cp pnacl.pem pnacl_${BUILD_NUMBER}.pem
dir=pnacl_${BUILD_NUMBER}
key=pnacl_${BUILD_NUMBER}.pem
name=$(basename "$dir")
crx="$name.crx"
pub="$name.pub"
sig="$name.sig"
zip="$name.zip"
trap 'rm -f "$pub" "$sig" "$zip"' EXIT
# zip up the crx dir
cwd=$(pwd -P)
(cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)
# signature
openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig"
# public key
openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null
byte_swap () {
# Take "abcdefgh" and return it as "ghefcdab"
echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}"
}
crmagic_hex="4372 3234" # Cr24
version_hex="0200 0000" # 2
pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}')))
sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}')))
(
echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p
cat "$pub" "$sig" "$zip"
) > "$crx"
echo "Wrote $crx"

28
pnacl.pem

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC++PHum0OTWhCq
BzxrN45qmab9bEyNC4VVOCGGCwp8xK0ar2Y524KRL5wAaGH/OYNw9T+2qjUWBdG0
nXHdS3eWm0SC7xS+X4HcxCpn8O7lB19mjL2bEeHuAl+twvndd0XxpN+8x1h/9CtA
Pbl3R1XRagRyEjSISyB3JxUc5napQ5UfuswN+hsdHZ+19wBve/GWzqiNlsTdIwJS
a7OGr1w9v9x83ombMbKa0UdkgSjuro9SlB7zRseEU89MR9V5jv2dpu3dSmbqX9a8
nBPs1NjlGdUp5/AJ69MBhToXlOHZrTO5rTQEMdGJk1kNx8BWFqDMFP6X9qotOnO/
Z2xHw77dAgMBAAECggEAHvJAYiYO4UXrBWJ+y/EIxwV3JgHytbh0NscNx6bqYCWO
15AsxJtpoRVR9k7z8mPjhN55IKScTaFLxjTtSqr8Cg/HHmCXv/HCHYA8TvOgAsUb
FIciAor3TZZc4s+Bpf25+9p31yOGl9V9XL+j2kxY/8JqTgHdOWjTLfvLVA+UkwD0
5MRr+gKS0lPZS+txXPF0CBOFBZmb5fFGl4CqmnzRS4OY/Xmhjza4qLKbJMeJ97uS
gWlqK18Xe/6vm9Aatcq47H7y42s4qaGaL/bJsrScUfnxJuCvCINZSGPNWV+Wxc0o
h2YmxPnA+P6zGqpjvkLA+wRyUUhfVKkFXPzlpoeiAQKBgQDmYskvj31L2DiOP0xx
Mb+Dcw4Gm3Np5oOnhwJUDCw9nr2Cs/RjinRm5NG8dBqQewd5Bxrj8rfHPyEajWDt
Rjta2rUIFfm+Kdlt1vECvkdtmo+QwBcIAgrivyFDeLjLqWltkoMF4lS+9bbFgemY
Sd2tQ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