Page 1 of 1

Automatically install addons when creating new profile

Posted: 2018-06-12, 13:36
by brwno
I created a small script for 'dmenu' that allows me to open one of my existing profiles or a new one, if what I type does not match what is listed.

What I need is a way to automatically install addons (more specifically, 'pentadactyl', since it can install other addons by itself).

I have read about the 'palemoon' commandl-line switch '-install-global-extension' <viewtopic.php?t=8933>, but that does not seem to work. Besides, I don't know what "globally" means here, and would prefer to install addons or extensions only locally - that is, only for the chosen profile.

Here is the relevant part of my bash script:

Code: Select all

palemoon -profile "$profile" -install-global-extension "${addons['pentadactyl']}" --no-remote --pentadactyl " ++cmd 'exta ${addons['adblock']}' "
(Where "${addons['pentadactyl']}" is a variable that expands to <https://addons.palemoon.org/?component= ... 6a72eacf42>.)

Re: Automatically install addons when creating new profile

Posted: 2018-06-14, 18:41
by Fedor2
Sure you can install addon with the any regular script.
There is required two actions.
1. copy xpi to the extensions folder
2. add entry to the extensions.json
3. add addon settings to the prefs.js

As for the install-global-extension there is no such thing in the palemoon version 27.9.3

Re: Automatically install addons when creating new profile

Posted: 2018-06-14, 19:43
by therube
As noted, http://kb.mozillazine.org/Installing_ex ... stallation, says its been deprecated. (And then MDN also goes on to say, "restricted to only allow installing add-ons that are on local disks or mapped drives".)

Re: Automatically install addons when creating new profile

Posted: 2018-06-16, 19:46
by Lew Rockwell Fan
Haven't done it in a while, but if I remember correctly the exension FEBE will let you make a single xpi for all the extensions you have installed. Then to install it/them in a virgin installation, I believe you can open with "File, Open file" from the menu of the new installation or if PM is defaulting to the virgin profile you can right click on the xpi and open it with PM. Or, I believe you can do something like "palemoon /path/to/enormous.xpi" from a command line. If PM isn't defaulting to the virgin profile, you'll need to use an option for the profile.

Re: Automatically install addons when creating new profile

Posted: 2018-06-19, 20:21
by brwno
Thanks, Fedor2. The script now works as I modified it to do the following:

1. Create subdirectory 'extensions' in the profile directory.
2. Therein place an "extension proxy file" <https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Setting_up_extension_development_environment#Firefox_extension_proxy_file> named 'pentadactyl@addons.palemoon.org', containing the path to the previously obtained (and in my case, extracted) XPI file.
3. Start, then kill 'palemoon', in order to populate the profile directory.
4. Create, in the profile dir, the file 'user.js', to modify the value of the 'extensions.bootstrappedAddons' preference to '{\"pentadactyl@addons.palemoon.org\":{\"version\":\"1.2pre-pm-3\",\"type\":\"extension\",\"descriptor\":\"/home/bw/i/ib/var/pm/profiles/inf_pen/extensions/pentadactyl@addons.palemoon.org.xpi\",\"multiprocessCompatible\":false}}' - <https://superuser.com/questions/373276/how-to-enable-extension-when-running-firefox-for-the-first-time>.
5. Modify the file 'extensions.json' to have '"userDisabled":false' and '"active":true'. (See <superuser.com> link above.)

This is enough, though step 3 is rather ugly.

Re: Automatically install addons when creating new profile

Posted: 2018-06-20, 04:13
by therube
3. Start, then kill 'palemoon', in order to populate the profile directory.
Do you necessarily need to populate the profile directory?
(And no, I haven't actually looked at your links, yet.)

Re: Automatically install addons when creating new profile

Posted: 2018-06-24, 12:28
by brwno
therube, I need to populate the directory mostly because I wouldn't otherwise know how to create the file 'extensions.json'.

Re: Automatically install addons when creating new profile

Posted: 2018-06-24, 13:35
by therube
But do you need to actually "populate the profile directory" or is simply knowing the path/name of the Profile folder sufficient?
Knowing the path/name, you can simply drop (copy) a user.js or (pre-created, with associated pathname, as extensions.json does contain pathnames) extensions.json into there?

If you can do that, then you don't have to actually run palemoon.exe, so then no need to kill it.

Re: Automatically install addons when creating new profile

Posted: 2018-06-26, 05:52
by Tomtiger
Hi,

why not create a new profile, install what you want, tar the contents of the profile directory to a file. When creating a new profile, just untar the file to the new profile directory?

Tom