Manually Repackaging the Firefox Installer on Windows

One of the things I’ve alluded to in a few posts but failed to actually post is how to manually repackage a Firefox 2 installer on Windows. This post will remedy that situation.

We have documented at least three different cases where we would need to manually repackage the installer (cases where the Firefox Release Repackager won’t work). These cases included packaging more than two extensions, needing to update the list of files that are removed by the installer and most recently, replacing setup.exe with a rebranded version. Let’s talk about how we can manually repackage the installer.

First thing is to download the installer we want to repackage and unzip it using 7-Zip. For our example, we’ll use Firefox 2.0.0.5. Create a directory and then download Firefox Setup 2.0.0.5.exe. Execute the following command to extract the contents of the file:

7z x "Firefox Setup 2.0.0.5.exe"

This will unpack the contents into the directory. After you have unpacked the file, move “Firefox Setup 2.0.0.5.exe” into a different directory or remove it.

Next we make the updates we want to make, such as replacing setup.exe, changing removed-files.log or adding additional extensions. After we’ve made our changes, we want to repackage the files into a 7-Zip archive.

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 contains our files. Note that I can’t tell you what all those parameters do – those are copied directly from the Firefox build scripts.

For the next step, we’ll need to download a file and create a file. We need to download 7zSD.sfx which is the self-extracting installer. You can download it here. Then we need to create a file called app.tag that looks like this:

;!@Install@!UTF-8!
Title="Our New Name"
RunProgram="setup.exe"
;!@InstallEnd@!

app.tag is used to tell the self extracting installer what file to run after the files are extracted. I’m not sure what “Title” is used for.

Now that we have all the files, we can actually create the installer:

copy /B 7zSD.sfx+app.tag+app.7z our_new_installer.exe

The “/B” is very important! It tells copy that these are binary files so it doesn’t add extra characters to the files.

And that’s it. We now have a self extracting installer with our customizations.

This entry was posted in firefox and tagged . Bookmark the permalink.

4 Responses to Manually Repackaging the Firefox Installer on Windows

  1. Robert Strong says:

    “needing to update the list of files that are removed by the installer”

    If the files are added to the non-localized or localized directories in the self extracting archive they will be automatically added to the uninstall.log and removed during uninstall. For the installer the removed-files.log can be manually modified to specify additional files to remove during install.

  2. mkaply says:

    Robert:

    Understood. In our (IBM) case for instance, we had old files lying around from our Firefox 1.0 deployments that we needed to get rid of, so we updated removed-files.log explicitly.

  3. Nice article. I just wonder if this little tutorial works on Firefox 3 also…any ideas?

  4. admin says:

    Yes, it should work on Firefox 3 as well.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">