Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/test/data/extensions/unpacker/bad_path/bad_path.sh

Issue 10868050: Remove "theme" in extension/app unpacker error messages, make those messages localizable, and add u… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied suggestions in patch set 2 comments and added paths in errors. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/bin/bash -e
2 #
3 # Purpose: Create a Chromium crx even if paths are invalid.
4 if test $# -ne 2; then
5 echo "Usage: bad_path.sh <extension dir> <pem path>"
6 exit 1
7 fi
8 dir=$1
9 key=$2
10 name=$(basename "$dir")
11 crx="$name.crx"
12 pub="$name.pub"
13 sig="$name.sig"
14 zip="$name.zip"
15 trap 'rm -f "$pub" "$sig" "$zip"' EXIT
16 # zip up the crx dir
17 cwd=$(pwd -P)
18 (cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)
19 # signature
20 openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig"
21 # public key
22 openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null
23 byte_swap () {
24 # Take "abcdefgh" and return it as "ghefcdab"
25 echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}"
26 }
27 crmagic_hex="4372 3234" # Cr24
28 version_hex="0200 0000" # 2
29 pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}')))
30 sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}')))
31 (
32 echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p
33 cat "$pub" "$sig" "$zip"
34 ) > "$crx"
35 echo "Wrote $crx with possibly invalid path"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698