Customizing the Firefox Installer on Windows

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-wizard.bmp and 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.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

23 thoughts on “Customizing the Firefox Installer on Windows

  1. I work in systems at the Virginia Tech library and I'm trying to get an unattended firefox install for our public machines. I'm so close to making one that works, but I'm stuck on one issue. After I run the installer it does everything that I want it to, but when I run firefox from the desktop shortcut for the first time after installing it runs the add-ons compatibility check. I want to completely disable and bypass this. I want no popups on the first run. I want it only opening the homepage. I set some about:config preferences that were supposed to disable this from running, but it keeps on running anyways. Any thoughts and/or tips?

    Thanks
    Stephen

    • I think this will work. I haven't tested it myself, but looking through the code, it seems to. Please let me know.

      After you unpack the installer, go to the directory where the Firefox executable is located. You should see a file called "application.ini"

      Look for the XRE section:

      [XRE]
      EnableProfileMigrator=1
      EnableExtensionManager=1

      Setting EnableProfileMigrator to 0 will prevent it from asking to migrate IE bookmarks.
      Setting EnableExtensionManager to 0 will prevent it from asking about extension compatibility on startup.

      Note the docs (https://developer.mozilla.org/en/xul_application_packaging) say that settings EnableExtensionManager to 0 disables extensions completely, but this is not the case. Looking at the docs, the only place this is checked seems to be at startup.

  2. Hi, Thanks a lot for your post...
    I have just one question, How can I set default bookmarks? I need add about 5-6 bookmarks to the default installer. Thanks for your help.

    • If all you need to do is set custom bookmarks, you should look at the file distribution.ini.

      It's an outrageously undocumented feature, but it's the easiest way to do basic stuff to an install.

      You create a directory called "distribution" in nonlocalized and then put a distribution.ini there.

      Maybe I'll do a post in the future about that file.

  3. Mike, do you think bundling the unmodified Firefox installer with another product's installer and doing a silent install is OK? I've got a Firefox extension here, and the extension installer installs it using the registry entries, but if the computer doesn't have Firefox, the installer displays a checkbox "install Firefox". If that checkbox is checked, the bundled unmodified Firefox installer is unpacked and run in silent mode.

  4. @Bill:

    That's an interesting question. My gut says yes. You are shipping an unmodified Firefox installer. As long as you don't claim endorsement by Firefox.

    I'd suggest you run it by trademarks@mozilla.com just for fun though.

  5. This is great, thanks so much for posting it!

    I used this and the Distribution.ini to create a package with add-ons and some bookmarks...Firefox is installing fine and pulling both bookmarks and add-ons, but only when I install as an Admin. This is 64 bit W7. If I install as a user (and supply admin credentials), Firefox installs with the add-ons but not the bookmarks.

    I'm actually testing this to be working in conjunction with WPKG (wpkg.org) and as long as I log on as Admin, everything installs fine - if I log on as the user, it installs fine but without bookmarks, same as above.

    Any thoughts?

    Thanks again for this-
    Mitch

    • @Mitch:

      This sounds to me like a bug. I looked through Bugzilla and I didn't see anything that referenced this though...

  6. A further clarification...if I install as admin, or as user and supply admin credentials, or install via WPKG, The bookmarks DO install, but only show up under the admin profile, not the user's profile.

    • @Mitch

      The bookmarks should get created every time a new profile created. So you're saying if you login as admin and create a profile, you get bookmarks, but if you log in as a user you don't?

  7. Multiple Language packs/dictionary add-ons.
    I am attempting to create a custom setup with two language XPI's (Language packs & dictionaries), and as per instructions I am to rename the directories to their corresponding {IDs}, however the ID Tag of the language packs are the same, eg:
    FR -dictionary: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} FR Lang Pack: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} EN-CDN: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}...
    What do I do to merge these under the extensions directory?
    eg: there are Install.rdf and other common named files?

  8. Darren: That GUID you quote is not that of the language pack but that of the application into which it installs, i.e., Firefox. The langpack's own ID is found in its install.rdf, in an or tag which is not inside but is a direct child of the outermost . Its format could be either email-like or a string of hex digits and dashes between { and }

  9. oops: in an (less-than) em:id (greater-than) or (less-than) id (greater-than) tag which is not inside (less-than) em:targetApplication (greater-than) but is a direct child of the outermost (less-than) Description (greater-than). Its format (etc.)

  10. Hello Mike,

    I'm trying to create a customised install for version 5.

    The layout is completly different. Please can you confirm the above information is relevant, if not what has changed?

    Thanks in advance,
    Michael Raye

  11. this is what i NEED to know, glad i found it, but there still little bit question that i havent found.

    1. default profile (usually ff use "%userprofile%\Application Data\Mozilla\Firefox" or "%appdata%\Mozilla\Firefox"
    -> i need to change it to "%appdata%\myCompany\myBrowser.v3"
    how can i do that ? (also : can i change brand name ?, including logo picture ?)
    2. bookmark (Tomas June 28, 2010 at 7:12 pm # )
    3. how about setting ? like :autocheck update, check ff is default browser = off, including another options.
    4. i've my own installer (like installshield, wise installation wizard), i just put the whole extracted 7z files to %temp% and run "setup.exe" ?, no need to edit registry ?

    the truth, i use : ff 3.0.8, and ns 9.
    and new modified firefox : lolifox (ff2), and HyperSonic (ff3.6) installed.

    distributing till 5 pc (install 1 by 1) is okay for me, what if (someday) my company have more than 500 pc ? do i have to set the option manually each pc ?
    -> so i need to create this installer, your tutorial is very useful to me, please answer my question.
    Thank u thousan time sir!

  12. Hi Mike,

    Couple of questions regarding your instructions for creating a custom Firefox installer.

    You mention about bundling extensions in the right place - typically 'nonlocalized/extensions'. Do I create this entire directory structure myself? It does not exist anywhere in the temporary folder where I unpacked the latest (v18.0) Firefox setup.

    Also, you say to 'create a subdirectory that corresponds to the ID of the extension'. How and where to find extension ID's?

    Thanks for your time.

    Cheers, Ken