Rev | Line | |
---|
[1192] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | usage() {
|
---|
| 4 | echo "$0 <FILENAME.xpi>"
|
---|
| 5 | }
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | # Retrieve the extension id for an addon from its install.rdf
|
---|
| 9 | get_extension_id() {
|
---|
| 10 | unzip -qc $1 install.rdf | xml sel \
|
---|
| 11 | -N rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# \
|
---|
| 12 | -N em=http://www.mozilla.org/2004/em-rdf# \
|
---|
| 13 | -t -v \
|
---|
| 14 | "//rdf:Description[@about='urn:mozilla:install-manifest']/em:id"
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | XPI_FILE="$1"
|
---|
| 18 |
|
---|
| 19 | if ! [ -r "$XPI_FILE" ]; then
|
---|
| 20 | echo "failed to read file $XPI"
|
---|
| 21 | usage
|
---|
| 22 | exit 1
|
---|
| 23 | fi
|
---|
| 24 |
|
---|
| 25 | XPI_ID=`get_extension_id $XPI_FILE`
|
---|
| 26 |
|
---|
| 27 | if [ -z "$XPI_ID" ]; then
|
---|
| 28 | echo "failed to determine XPI ID from file $XPI_FILE"
|
---|
| 29 | exit 1
|
---|
| 30 | fi
|
---|
| 31 |
|
---|
| 32 | echo "ID: $XPI_ID"
|
---|
| 33 | #mkdir $XPI_ID && cd $XPI_ID && unzip $XPI_FILE || {
|
---|
| 34 | unzip $XPI_FILE -d $XPI_ID && chmod -R a+x $XPI_ID || {
|
---|
| 35 | echo "failed to extract file $XPI_FILE to $PWD/$XPI_ID"
|
---|
| 36 | exit 1
|
---|
| 37 | }
|
---|
| 38 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.