12 February 2011

This should be an easy task (push install Mozilla Firefox 3.6.x)

Not while ago one of our partners gave me, what was supposed to be an easy task. He said: “Please help us install Mozilla Firefox on all our computers”. No problemo, I said. You have Script Logic Desktop Authority which is great for these kinds of tasks and Firefox also shouldn’t be a problem. How wrong could I be? 

My objectives were:
- Preconfigure Firefox homepage to predefined web site
- Preconfigure Firefox so it won’t use proxy
- Do not configure Firefox as default browser. Do not ask to become default browser.
- Disable automatic updates Firefox.

After Googling for a while I found numerous blogs, notes and hints how to accomplish this task but no complete solution. The most useful links I found are Mike’s Musings, Glen Bettridge, Chris Ilias and Shivanand Sharm’s blogs.  Mozilla Firefox turned out to be quite difficult to roll out and preconfigure.

For these task to accomplish I had one virtual Windows 7 to test on, Windows 2008 R2 AD servers, Windows 2008 R2 member server with Script Logic Desktop Authority. I also installed 7zip on test computer and added 7zip install folder to Windows PATH.

1. Prepare batch file to install Firefox
To script Firefox installation we need three files:
- FirefoxDeploy.ini
- Install_Firefox.cmd and
- Later also FirefoxSalus.exe

All these files should be copied to network share from where you’ll push installation.

- In FirefoxDeploy.ini is:
[Install]
InstallDirectoryName=Mozilla
FirefoxCloseAppNoPrompt=true
QuickLaunchShortcut=false
DesktopShortcut=true
StartMenuShortcuts=true
StartMenuDirectoryName=Firefox

- In Install_Firefox.cmd is:
REM x32 install Mozilla FireFox
IF NOT EXIST "C:\Program Files\Mozilla\firefox.exe" (
pushd \\SALFS\InstallPoint\FireFox
FirefoxSalus.exe /INI=\\SALFS\InstallPoint\FireFox\FirefoxDeploy.ini
popd
)

2. Preconfigure Firefox home page and proxy
- Unpack Firefox installer to some temp folder

- Change folder previously unpacked installer folder .\Firefox Setup 3.6.13\nonlocalized\ and cerate file named mozilla.txt.

- Open mozilla.txt and put these lines in it:
//
lockPref("network.proxy.type", 0);
lockPref("browser.startup.homepage", http://www.Hoponbike.com/);

- Download program ByteShifter and encode Mozilla.txt to Mozilla.cfg by simple “byte-shifting” with an offset of 13.


- Copy Mozilla.cfg to unpacked installer folder where Firefox.exe is.

- At the end of file named all.js located in unzipped installer folder ".\Firefox Setup 3.6.13\nonlocalized\greprefs\" add this line:
pref("general.config.filename", "mozilla.cfg");

Preconfigure Firefox to skip default browser checking and automatic updating

- Find file named firefox.js in unzipped installer folder ".\Firefox Setup 3.6.13\nonlocalized\defaults\pref\” and change these:
pref("browser.shell.checkDefaultBrowser", false);
pref("app.update.enabled", false);

3. Repackage Firefox and create installer
- Repackage installer by first zipping changes you made. To do this open command line and change directory to the root of unzipped installer folder. Enter these command to create a file called app.7z:
7z a -r -t7z app.7z -mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3

- Download file 7zSD.sfx needed to repackage installer and save it to the root of unzipped installer folder.

- Create file named app.tag, also in the root of unzipped installer folder and put in it these lines:
;!@Install@!UTF-8!
Title="Mozilla Firefox"
RunProgram="setup.exe"
;!@InstallEnd@!

- Repackage installer by executing this command:
copy /B 7zSD.sfx+app.tag+app.7z FirefoxSalus.exe

- Copy newly created installer FirefoxSalus.exe to your install point folder.

So this is it, now you’re ready to test your Mozilla Firefox deployment on small group of computers with a help of Group policy or some other method. I personally did it with Script Logic Desktop Authority.

This is it for today. Have fun!