For Debian Linux, I have a post-installation script in which I would like to make a few local settings for a newly created user account in the file ~/.mozilla/firefox/<profile-directory>/user.js. However, before the user has launched Firefox there is no ~/.mozilla directory. Knowing that the default profile directory name ends with .default-esr I tried creating a new profile with the command
firefox -CreateProfile default-esr
but when Firefox is launched it creates another profile directory which ends with .default-esr-1. Is there a way to create a new profile which is actually used by Firefox? How can I create local settings from a script before Firefox has been launched?
I run Debian 12.1 and Mozilla Firefox 102.13.0esr (from the standard repository).
Edit:
If I run the command firefox -CreateProfile default-esr I get a ~/.mozilla/firefox/profiles.ini containing
[Profile0]
Name=default-esr
IsRelative=1
Path=1gbetm4q.default-esr
[General]
StartWithLastProfile=1
Version=2
On the other hand, if I launch Firefox with no .mozilla directory i get this profile.ini:
[Profile1]
Name=default
IsRelative=1
Path=gfro0v2o.default
Default=1
[Profile0]
Name=default-esr
IsRelative=1
Path=0715l0wk.default-esr
[General]
StartWithLastProfile=1
Version=2
[Install3B6073811A6ABF12]
Default=0715l0wk.default-esr
Locked=1
Apparently, Firefox creates two profiles the first time it's launched i.e when there is no .mozilla directory. Confusingly, the option Default refers to both profiles.