Added instructions to automate the installation of an addon, if you need a script let me know, its possible.
–
Bruno PereiraOct 29 '11 at 14:30

This is a great question now since im now strugling to find way to CLI way install Adblock package as previously on 10.04 with just apt-get install adblock-plus witch doesnt exist in 11.10 :( AND YES- we need script :)
–
KangaroooMar 3 '12 at 11:01

3 Answers
3

Using your method

gksudo firefox -install-global-extension addon-1865-latest.xpi seems to do the trick for you. That will install the extension to all users on your system.

To install the extension only for your user use the extension path as an argument

firefox addon-1865-latest.xpi

You still need to click the Install button tough!

Automating the installation

Firefox does not need the addon file name but the identifier from the addon as a package name. That means that if you are planning on installing an addon without user intervention you need to extract it to a folder with the name of the addon identifier string, not the name of the addon.

The identifier string can be found on the first lines of the addon install manifest file install.rdf and it looks like this: <em:id>{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}</em:id>. Everything within the {} is the identifier.

To get an addon to work you need to extract the package, rename the folder that contains the files to the addon identifier string and place it either on the global addon folder or within the user addon folder.

Global addon install

If you want to install an extension automatically to all users in your system you need to extract it, rename the folder that contains the addon to the addon's id string and copy it to the firefox global extensions folder /usr/share/mozilla/extentions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/, anything that you use there will be called up automatic when a user opens firefox.

User specific install

If you want to install an extension automatically to just one user in your system you need to extract it, rename the folder that contains the addon to the addon's id string and copy it to the firefox user extensions folder /home/user_name/.mozilla/extentions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/ (create it if it does not exist), anything that you use there will be called up automatic when a user opens firefox.

How-to prepare an addon for automatic install - Example

Make an extensions folder in your home and download the addon in to it

Read the first line in the install.rdf file to get the addon's id (in this case it will be {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}). and create a folder with that name

mkdir ~/extensions/{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}

Move all the files in your extensions folder into the newly created ~/extensions/{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d} and you are ready to install by moving the {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d} folder, as described, for a local install or for a global install.

How-to set the default home page

To change your homepage without using the preferences inside firefox you have to edit ~/.mozilla/firefox/*.default/prefs.js (where *.default is a folder inside ~/.mozilla/firefox created for your user) and add this line to the end of it