Repackage the Mozilla Firefox installer the friendly way

Why this blog…

During one of my previous projects in a role as a VMware Application Deployment specialist the customer had the requirement that all applications (if available) were multi-language in at least Dutch and English, so a user can decide by themselves. A couple of years ago the browser application “Mozilla Firefox” was really hard to manage in an enterprise environment. The installers they provide are single language and there were no (official) ADMX Group Policies available.

A couple of years ago the support of user friendly ADMX Group Policies was introduced, but they still provide only single language installers. What I did at customers was using that ADMX Group Policy to install extensions during startup, but when you have more than lets say five, then the user profile will grow exponentially and this is not desirable in a non-persistent virtual desktop environment.

What I’ve found recently is the following site (link) were Mozilla describes to process of repackaging the Windows installer, but in my opinion this process is very basic written and not always clear. That why I wanted to make this blog to make the repackaging of Mozilla Firefox more clear to all people that are responsible for Application Packaging or Deployment.

Step 1) Pre-requisites

Before you begin there is one pre-requisites: Install (the latest) 7-Zip version on the machine where you want to repackage on. Download the latest 7-Zip version from here.

Step 2) Download the Mozilla Firefox installer

Download the installer that you want to repackage. Make sure you download a full installer and not a stub installer. The stub installer is typically named “Firefox Installer.exe” whereas the full installer is named “Firefox Setup %VERSION%.exe.” You can download full installer of Firefox Extended Support Release (ESR) and of rapid release from here.

Step 3) Unzip the installer file

There are two ways of doing this. In my opinion we start with the easiest one.
Option 1) (my way)
Unzip the installer into a directory (right-mouse click on Firefox Setup %VERSION%.exe –> 7-Zip –> Extract to “Firefox Setup VERSION”.  For example copy the directory to C:\Temp\.

extract the installer

Option 2) (Mozilla’s way)
7z x "C:\Temp\Firefox Setup %VERSION%.exe".
Of course you first need to open a command prompt, browse to the Z-zip installation directory and then run above command.

alternative to extract the installer

Step 4) Creating required directories

In the Firefox ESR installation directory, you will need create some required directories.
First, create a directory called “distribution“. Inside of distribution directory, create another called “extensions“.

create required directories

Step 5) Download the extensions that you want to be installed after installation

Within Firefox (not another browser) go to the extensions page. Download your specific extension you want to slipstream in your repackaged Firefox installer do not add the package, but first right mouse click on the “Add to Firefox” button and choose for “Save Link As”. Save it to the extracted installer location in the extensions directory you created in the previous step. In my example case it will be the Dutch (NL) Language Pack.

download the extension

Step 6) Lookup the extension-id

Now install/add the extension(s) to Firefox. Only via this way you can lookup the extension-id. In Firefox addressbar type: “about:debugging” and search the extension and note the extension-id.

note the extension id

Step 6) Rename the extension (xpi) file name

Rename the extension (xpi) file name to the Extension ID, which you looked up in the previous step. Be careful that you keep the .xpi file extension.

rename the extension to extension id

Step 7): Repackage the installer files

Repackage Firefox first to a 7z format by running this command in the directory where you unzipped Firefox:
"C:\Program Files\7-Zip\7z.exe" a -r -t7z "C:\Temp\app.7z" -mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3
This will create a file called app.7z that contains the changes.

repackage including the extension files

Step 8) Download the utilities

Download the following two files 7zSD.Win32.sfx and app.tag and place them in your start directory (in my example C:\Temp\).

place the utilities in your firefox repackage directory

Step 9) Create the new custom Firefox installer

Run the following command to convert the 7z archive to an installer again:
copy /B 7zSD.Win32.sfx+app.tag+app.7z "Firefox Setup VERSION custom.exe"
The “/B” is very important! It tells copy command that these are binary files, so it doesn’t add extra characters to the files.

convert 7z archive to an installer

Now that everything is in place, you are able to silently install Mozilla Firefox in a Windows 10 Base Image, App Volumes AppStack, ThinApp or other deployment or virtualization tool you use. Example of the silent installation command is:
"Firefox Setup VERSION custom.exe" /TaskbarShortcut=false /DesktopShortcut=false /StartMenuShortcut=true /MaintenanceService=false /PreventRebootRequired=true

A special thanks to my co-worker Ariel Cabral for sorting things out.