source: dass-tools/usr/bin/xpi-extract.sh@ 1256

Last change on this file since 1256 was 1192, checked in by joergs, on Aug 18, 2015 at 1:10:01 PM

added xpi-extract.sh

  • Property svn:executable set to *
File size: 787 bytes
Line 
1#!/bin/bash
2
3usage() {
4 echo "$0 <FILENAME.xpi>"
5}
6
7
8# Retrieve the extension id for an addon from its install.rdf
9get_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
17XPI_FILE="$1"
18
19if ! [ -r "$XPI_FILE" ]; then
20 echo "failed to read file $XPI"
21 usage
22 exit 1
23fi
24
25XPI_ID=`get_extension_id $XPI_FILE`
26
27if [ -z "$XPI_ID" ]; then
28 echo "failed to determine XPI ID from file $XPI_FILE"
29 exit 1
30fi
31
32echo "ID: $XPI_ID"
33#mkdir $XPI_ID && cd $XPI_ID && unzip $XPI_FILE || {
34unzip $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.