Deploying Firefox 2 within the Enterprise: Part 3

Creating a Firefox installer

Continuing where we left off…

Now that we have built Firefox, our next step is to build the installer. Before we do that, however, we need to place our custom extensions in our build so that they get packaged with Firefox.

There are three ways that extensions can be installed in Firefox: user extensions, application extensions, and registry-install extensions. When a user installs an extension from a web page, it is installed in their profile directory and is called a user extension. If the user switches profiles, that extension is no longer available to them. Alternatively, extensions can be installed in the extensions directory where the firefox executable is located. If extensions are installed here, they are called application extensions. These extensions essentially become a part of the application install, so they are available to any profile that is created. (Note that when an application extension is upgraded, the upgrade is done as a user extension, so if you switch to another profile, the extension needs to be upgraded again.)

We want to package our extensions as application extensions, so we need to place them in the extensions directory under the executable so that the installer packages them as a part of Firefox. In our build, this directory is located at mozilla/obj/dist/bin/extensions, so let’s go there and install our extensions.

If you look in the extensions directory, you’ll see one or more directories. Each of these directories represents an extension. The names of the extension directories are determined by the ID of the extension. These IDs can either be UUIDs like {972ce4c6-7e08-4474-a285-3208198ce6fd} or they can be an email format like name@extensions.domainname.tld. When we first place the extensions we want to install into this directory, we won’t know the ID of the extension, so we’ll have to create a temporary directory in which to unzip the extension. Once we’ve unzipped the extension, we’ll be able to find out the ID of the extension and then we can rename the directory appropriately.

To install an extension, create a temporary directory under the extensions directory and unzip the XPI that corresponds to the extension into the temporary directory. Once you have unzipped the XPI file, you should see a file called install.rdf in the temporary directory. If you edit this file, you will see a line that looks like this:

name@extensions.domainname.tld

or this

{972ce4c6-7e08-4474-a285-3208198ce6fd}

The value in the middle is the extension ID. We will need to rename the temporary directory to match this ID. Note that when you rename the directory, you might need to enclose the ID in quotation marks.

You should follow the above process for all extensions you want to preinstall, including the CCK you created in Step 2.

There’s one other small change we might want to make before we build the installer. This step is needed if there are files we want to remove as part of our install. For instance, when we deployed Firefox originally inside of IBM, we used a version of the CCK that wasn’t as self contained as the current version. We can use this method to cleanup any files that might be left behind. The file that we want to change is removed-files.in in the mozilla/browser/installer directory. The format of this file is very simple. Just add any files you want to remove during installation to the list. Make sure you use forward slashes. Also note that the top level directory for anything referenced in this file is the directory where the firefox executable is located.

The build system maintains a list of all files that should be a part of the Firefox package. Because our files aren’t in that list, we’re going to have to make a small change to the build system before we build the installer. First go to the directory mozilla/toolkit/mozapps/installer. Then download the patch file. Save it in the directory mozilla/toolkit/mozapps/installer. Now go to a command line and type patch < packager.mk.patch. What this change does is cause the build process to copy all the files we just placed in the extensions directory before it builds the installer.

Now we are ready to actually build our installer. Go to the mozilla/obj/browser/installer directory and type:

make installer

After this process completes, your installer executable will be in:

mozilla/obj/dist/install/sea

If you need to do an unattended install you can invoke the executable with the parameter /S. You can get more information on customizing the installer from the Mozilla Wiki.

Next time we’ll talk about creating an update server and producing update files for Firefox.

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 *

6 thoughts on “Deploying Firefox 2 within the Enterprise: Part 3

  1. Hi Mike,

    Thanks for linking to my comment on the UK Web Focus blog in your previous post.

    This stuff is a really interesting read.

    I was wondering, did anything ever come of bugzilla #337679?

  2. > I was wondering, did anything ever come of bugzilla #337679?

    Unfortunately not. Because ADM is technology we don’t use inside IBM, it was hard to justify my work on it.

    My understanding is that someone at Mozilla Corp is investigating doing ADM stuff inside Firefox. I have no idea where that is going.

  3. Hello Mike,

    I try to deploying firefox 4 within the enterprise. There is a link “patch file” in your part 2. What kind of patch file is it?