I want to improve my unattended script adding some Firefox addon, however I cant find the way,
Can someone help to find out how to?
Example: (Want to install adblockPlus plugin and set a new default webpage)
wget https://addons.mozilla.org/firefox/downloads/latest/1865/addon-1865-latest.xpi
firefox -silent -install-global-extension addon-1865-latest.xpi -setDefaultBrowser www.google.es
Thanks in advance.
Best Answer
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
You still need to click the
Install
button though!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{}
(including the curly braces) 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/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/
, anything that you use there will be called up automatic when a user opensfirefox
.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/extensions/{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 opensfirefox
.How-to prepare an addon for automatic install - Example
Make an
extensions
folder in your home and download the addon in to itExtract it and delete the original
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 nameMove 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 itor using this command
You need to do it after closing
firefox
or the program will overwrite the setting on exit.If your user has not used
firefox
yet and you want to set the homepage for all new users (set homepage globally) use this commandComments about your question
-silent
does not exist, you will be prompted to install thatxpi
extension anyways and you have to click the button to install it;-setDefaultBrowser
will not set your homepage, it will makefirefox
your default browser