I'm working on Arch Linux OS where I use Firefox 91.10.0esr (so, Firefox ESR) and I'm looking for a way to install silently Firefox addons by using terminal. I'm aware of methods to install them by calling the downloaded addon .xpi as
firefox-esr <addon-name>.xpi but it opens Firefox and asks for a further confirmation of the installation.
My purpose is to perform the installation of the .xpi file only by command line without interact with the browser GUI and avoid the further install confirmation (the "Add" button on the popup opened by the browser).
According to several sources (i.e., https://askubuntu.com/questions/73474/how-to-install-firefox-addon-from-command-line-in-scripts) where the process is explained for addons that contain install.rdf file, it is easy to manage this case.
My issue is related to those .xpi files that don't include a install.rdf file containing the ID of the application.
For example, if we consider FoxyProxy addon and we download it and extract it:
mkdir foxyproxy && cd foxyproxy
wget https://addons.mozilla.org/firefox/downloads/file/3611407/foxyproxy_standard-7.5.1.xpi
unzip foxyproxy_standard-7.5.1.xpi
among the extracted files, there is not a install.rdf file containing the usual hexadecimal ID of the extension.
The only ID I can see is inside the manifest.json file that does not have the hexadecimal format. Taking for example FoxyProxy, I tried to use its ID [email protected] by making the process like:
mkdir -p /usr/share/mozilla/extensions/[email protected]
or
mkdir -p /home/user/.mozilla/extensions/[email protected]
and then copy all the unzipped content of.xpi in one of these directories, but with no luck.
Is it possible to install by CLI this kind of addons with no install.rdf file?
TL;DR
Run this
config_firefox.shscript:Which copies (the following
policies.jsonfile that you have to put in the same folder as theconfig_firefox.shscript):into: `/etc/firefox/policies/policies.json and restart Firefox. (You don't have to click "accept" anything anymore, they are automatically installed.
Answers XY-problem of question, doesn't work:
This script gets the extension ID from the
manifest.jsonfiles inside the.xpifiles: (However, Firefox does not automatically install the.xpifiles if I export them to:/home/<username>/snap/firefox/common/.mozilla/firefox/<profilename>.default/extensions.