http://www.politiker-stopp.de/gfx/politiker-stopp-print.png

Benjamin Schieder

[TECH] INSTALLING FIREFOX ADDONS 'OFFLINE'

2007 June 07 | 0 comments

If you are a package maintainer for Firefox and want to package some add-ons with FF automatically without having to start Firefox, here's how you do it.

First, download the .xpi file. It's actually just a ZIP archive. Create a temporary directory and extract it there. You will find a file called install.rdf which contains all the necessary information. Here an example from AdBlock:


<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">

<Description about="urn:mozilla:install-manifest">

<em:id>{34274bf4-1d97-a289-e984-17e546307e4f}</em:id>
<em:version>0.5.3.043</em:version>

<!-- Target Application this extension can install into,
with minimum and maximum supported versions. -->

<!-- FireFox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.7</em:minVersion>
<em:maxVersion>2.0a3</em:maxVersion>
</Description>
</em:targetApplication>

<!-- Mozilla -->
<em:targetApplication>
<Description>
<em:id>{86c18b42-e466-45a9-ae7a-9b95ba6f5640}</em:id>
<em:minVersion>1.4</em:minVersion>
<em:maxVersion>1.8</em:maxVersion>
</Description>
</em:targetApplication>
<... some more stuff omitted ...>


What you need are the two bold parts. First, take the first bold part (the global em:id, NOT the one within a em:targetApplication block!). Rename the directory you extracted the .xpi to to that (in this case, we would rename it to {34274bf4-1d97-a289-e984-17e546307e4f}.
Then check if your Firefox version is newer than the second bold part. If it is, and you are sure that they are compatible, change the part to your Firefox version. In my example, I changed 2.0a3 to 2.0.0.3.

Now, move the folder {34274bf4-1d97-a289-e984-17e546307e4f} to the global extensions directory of Firefox. Here it was /usr/lib/firefox-2.0.0.3/extensions/.

Et voila, the next time a user starts Firefox, he will have AdBlock preinstalled :-)


EOF

Category: blog

Tags: Tech


Post a comment

All comments are held for moderation; basic HTML formatting is accepted.

Name: (required)
E-mail: (required, not published)
Website: (optional)
Comment: