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 184.108.40.206. Create a directory and then download Firefox Setup 220.127.116.11.exe. Execute the following command to extract the contents of the file:
7z x "Firefox Setup 18.104.22.168.exe"
This will unpack the contents into the directory. After you have unpacked the file, move “Firefox Setup 22.214.171.124.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:
Title="Our New Name"
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.