One of the questions I get asked a lot is how to customize the Firefox installer on Windows and how to bundle extensions with it. I’ve spent the past few days learning a great deal about this subject, so I thought I would take this opportunity to provide a refresher on working with the Firefox installer on Windows. I’m going to do it as a Q&A so hopefully folks will get answers to the common questions they have.
Standard disclaimer: Under no circumstances should you use this information to create a custom Firefox install and redistribute it to anyone outside your organization. If you want more information, you can consult the Mozilla Foundation Trademark Policy.
What tools do I need to work with the Firefox installer?
The primary tool you need is 7-Zip. I install the MozillaBuild package which gives me all the tools I need. Even though the Firefox Installer is NSIS based, we will not need to use NSIS for most customizations. I’ll talk a little bit about the end about what kinds of things you would need NSIS to do.
How do I unpack the Firefox installer?
The Firefox installer is created using 7-Zip. So you can grab any of the Windows installers that end in EXE and unpack them. Any of the Windows installers on the Firefox download page will work. Once you’ve downloaded the EXE, create a temporary directory and type:
7z x "Firefox Setup 3.6.3.exe"
This will unpack the contents of the installer so we can modify it.
How do I bundle my extension with the Firefox installer?
Bundling your extension with the Firefox installer is just a matter of putting it in the right place. Then when we package up the installer at the end, it will get installed along with Firefox. For most extensions, the right place is
nonlocalized/extensions. Inside that directory, create a subdirectory that corresponds to the ID of the extension you want to preinstall with Firefox. Then unzip the XPI into that directory. You can find the ID by looking at the install.rdf file inside the XPI. You can add as many extensions as you want into the installer.
What are some useful extensions I can bundle with Firefox
I’ve created two extensions that create interesting things to bundle with Firefox. The first is the CCK Wizard. The CCK Wizard can be used to change various defaults in Firefox so that you can customize it for deployment in your organization. The second is Rebrand. Rebrand allows you to change the internal branding used in Firefox.
Can I change the names used in the installer?
Yes, you can change the names used in the installer. To do this, you need to create a directory called
distribution inside the
localized directory that was created when you unpacked the installer. Create a file called
setup.ini in this directory. Here’s what it looks like:
[Branding] BrandFullName=Mike's Browser BrandShortName=Browser
BrandFullName will be used to replace “Mozilla Firefox” and BrandShortName will be used to replace “Firefox”.
Can I change the images used in the installer?
Yes, you can change the images used in the installer. In that same directory where you put the setup.ini, you can put two files,
modern-header.bmp. The first images corresponds to the large image on the first page of the installer. The second image corresponds to the small image that is used on later pages of the installer. You can use the linked images as a reference to know what size to make these images.
How do I repackage the installer?
To repackage the installer, first you need to zip up the changes that you made. Type:
7z a -r -t7z 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 has all the changes we made. Now we need to package that file with some other files to create the final EXE. We’ll need the file 7zSD.sfx which you can download from Mozilla. And we’ll need a file called app.tag which you can create. It looks like this:
;!@Install@!UTF-8! Title="Mozilla Firefox" RunProgram="setup.exe" ;!@InstallEnd@!
Once we have these files, we can run the command:
copy /B 7zSD.sfx+app.tag+app.7z our_new_installer.exe
to package them all as an EXE. Don’t forget the /B. It indicates that the files are binary so Windows won’t put an EOF marker on them.
Can I change the defaults that are set in the installer like the install directory or the checkboxes?
At this time, there is no way to change the defaults in the installer without rebuilding the installer. There’s a bug open on this with a patch, so hopefully this will be fixed for Firefox 4.
Can I make my totally rebranded Firefox coexist nicely with an existing Firefox?
There are a couple ways to do this. The easiest way is to use the
-no-remote parameter when you start Firefox. This causes the Firefox you are starting to not connect to the Firefox that is currently running. When you do this, you have to specify a different profile using the
-P parameter. Alternatively, you can change the internal identifiers that Firefox uses. Then it will be considered to be a completely different browser. If you choose to do this, you should be aware that you will not receive updates and there will be other side effects. This is not a decision that should be taken lightly. Also, your profiles will be stored in different locations as well. If you want to do this, check out the file
application.ini in the nonlocalized directory. The variables you want to change are Vendor and Name. Again, you do this at your own risk.
What can I do if I’m willing to rebuild the installer with NSIS?
If you are willing to rebuild the installer, you can change things like the name of the entry in the Add/Remove programs list, as well as the install directory and other defaults. This is a nontrivial exercise because some of the required files are built as part of the Mozilla build proces and are not available in the build tree. If you’re really interested in doing this, you can contact Kaply Consulting and we can talk about it.
I hope this answered some questions folks have. If anyone has any more questions, please don’t hesistate to ask.
- Top 10 Build Management Tools updated 2020 - July 27, 2021
- DevOps Certification Explained – Don’t get trapped!! - July 26, 2021
- How to become a Site Reliability Engineer – SRE Engineer? - July 22, 2021