Determine extension ID

From MozillaZine Knowledge Base

Each extension has a unique extension ID which is contained in the extension's install.rdf file. When you want to determine an extension ID (e.g. to install an extension globally), you can do so by unzipping the extension .xpi and then manually inspecting its install.rdf or you can use one of the following, scripted approaches.

Linux/Unix platforms

This approach requires "unzip" and "xmlstarlet" to be installed on your system. Copy and paste the following bash function in your shell (or integrate it into one of your scripts).

# Retrieve the extension id for an addon from its install.rdf
get_extension_id() {
  unzip -qc $1 install.rdf | xmlstarlet sel \
    -N rdf= \
    -N em= \
    -t -v \

Then determine an extension's ID (Greasemonkey extension taken as an example).

$ get_extension_id greasemonkey-0.8.20100408.6-fx.xpi