Build a Custom Firefox Application for Mac OS X

Firefox is increasingly becoming the browser of choice among end-users. This poses a challenge for system administrators. Firefox does not use the standard plist preference system that is a part of Mac OS X. It uses its own proprietary method. This makes deploying and customizing Firefox in a managed setting different from most Mac OS X applications. Fortunately there are ways to make deploying Firefox easier. One way is to use tools to build a configured and locked-down version of Firefox ready for deployment in an enterprise setting.

Using freely available tools it is easy to build a customized version of Firefox for your organization. You can bundle settings customizations, certificates, extensions, and bookmarks into your custom Firefox build and pack it into a .dmg.

Before I get to the how-to, I want to briefly explain how this customization is actually working. What you are going to generate to customize your Firefox application is an extension file (.xpi). This extension file applies all of the settings of your choosing to Firefox when it is launched. This guide will walk you through generating the .xpi file, and then packaging Firefox with this custom .xpi into a .dmg that is ready to be deployed.

Tools you will need for this guide:

Firefox 3.6.x

CCK Wizard

Firefox Release Repackager

Install Firefox on your workstation then download and install the CCK Wizard Firefox plugin from here: https://addons.mozilla.org/en-US/firefox/addon/2553. Note: I wasn’t able to get this add-on to run on Firefox 3.6, I ran it on Firefox 3.5.7. This step only generates the .xpi  file we are going to use in our custom build, and generating it with the CCK tool in 3.5.7 will still allow us to use the .xpi to deploy/customize Firefox 3.6. Turns out this doesn’t work. Will have to wait for the CCK Wizard to be compatible with 3.6. So for now this guide will only work for 3.5.7. CCK Wizard has now been updated and is compatible with Firefox 3.6.x.

Run the extension by going to the Tools menu in Firefox and select CCK Wizard. Run through the setup steps to configure your customizations (these steps are fairly self-explanatory). You can add bookmarks, extensions, etc. Once you are done the .xpi will be generated for you.

Now download and install the Firefox Release Repackager from here: http://benjamin.smedbergs.us/release-repackager/. You also need the Mac OS X developer tools installed to run the application.

I wasn’t able to get the GUI for the application to successfully run on 10.6, but luckily the application can be run from the command line and works like a charm.

Assuming you installed the Firefox Release Repackager to your applications folder, open Terminal and run the following command:

Note: Despite how this appears below this should all be one line.

/Applications/ClientKitRepackage.app/Contents/MacOS/xulrunner 
--xpi=/Users/admin/Documents/cck.xpi --platforms=mac  
--source=/Users/admin/Downloads/ --dest=/Users/admin/Documents  
--disable-migration --silent

Here is a breakdown of the command:

--xpi=/Path/To/Your/xpifile.xpi
--platforms=mac (build the application for mac)
--source=/Path/To/Directory/With/OriginalFirefox.dmg
--dest=/Path/To/Where/You/Want/Your/NewFirefox.dmg

--disable-migration (Disable profile migration)
--silent (Don't open the GUI and build the custom build)

Run the command as root (or use sudo) and you will have a custom dmg with your custom Firefox application. Awesome!

Advertisements

Create a Windows XP Boot Camp Image for all Macs

Update: 11/2/09 – Apple has released 10.6 at this point, and frequently updates the Windows drivers packaged with OS X. This guide should still be useful and applicable to newer versions of the OS, but keep in mind that you should use the latest version of your Mac OS X install disc so that you have all of the current Mac hardware drivers.

Creating images for Windows poses a challenge for system administrators because of the fact that drivers have to be incorporated into the system image in order for the target system’s hardware to function properly. Apple creates it’s own hardware and software, so all of it’s hardware drivers are incorporated into it’s installation discs making imaging an easier task in this sense.

I was tasked with building a Windows Image for a Mac lab and was curious: is there a way to create a Windows XP image for all Mac models that is hardware-independent? It turns out there is! Using some tools Microsoft and other 3rd parties provide you can build a Windows XP image that will run on any Intel-based Mac.

Before I begin, I want to mention that I wouldn’t have been able to figure this out without the help of some very talented, clever, and smart people. I will be referencing their websites in this guide.

What you need for this guide:

Step 1:

Run Boot Camp assistant and partition your Mac. Install Windows XP. Try to keep the partition as close as possible to the actually space requirements your image will need. More on why later.

Step 2:

Extract all of the Mac drivers from the Leopard Install DVD.

Insert the Leopard DVD into any Windows computer and browse to it. Inside the DVD browse to the ‘Boot Camp’ folder. Copy the ‘Drivers’ folder to your PC hard drive.

Now browse to the ‘Drivers’ folder on your PC. At this point you will need to install WinRar on your PC if you haven’t already. For convenience create a folder called ‘Drivers Extracted’ in the same folder your ‘Drivers’ folder is.  Inside your ‘Drivers Extracted’ folder create a directory structure like so:

driversfolder

This is the easiest way to organize the drivers. Now go back to your ‘Drivers’ folder.

Browse to every directory inside the drivers folder, inside each one you will find mostly .exe files. These are what you want to extract. Like so:

extract

Keep in mind these instructions are for installing 32-Bit Windows XP, so in the \Drivers\Apple folder we want to extract all of the .exe file to folders, then move these folders and the ‘AppleKeyboardInstaller’ folder to the ‘Drivers Extracted’ folder we created before. Skip the ‘x64’ folder in here.

All of the extracted driver folders that were in the ‘Apple’ folder that we extracted go to the ‘Apple’ folder in our ‘Drivers Extracted’ folder. The rest of the drivers go to their related folders. I will show you what goes where below and what Drivers are actually required for 32-Bit XP, because Apple includes 64-Bit drivers as well but there is no sense in using those for our 32-Bit install. Just make sure you have all of the folders below extracted. The organization by device type is really optional. I am just a bit anal :).

Apple:

appledrivers

Network:

network

Audio:

audio

Chipset*:

chipset

* The Intel Chipset drivers are located in this folder: \Drivers\Intel\Chipset\Vista. I just moved all these files into the ‘Intel’ folder above.

Video*:

video

* There are more video drivers for NVidia GPU’s, but we are going to get the latest ones from their website. Just make sure you have the ones above for now.

Next download the latest NVidia Desktop and Mobile video drivers.

Currently the latest Desktop release:

http://www.nvidia.com/object/winxp_186.18_whql.html

Currently the latest Mobile release:

http://www.nvidia.com/object/geforce_notebook_winvista_186.03_whql.html

Once you download them extract the .exe’s the same way we did before and create two new folders inside the Drivers Extracted\Video folder called: NVidiaXPSetup and NVidiaMobileXPSetup.

Then move the extracted files from before to their corresponding folders.

Step 3:

Setup your XP machine.

I won’t get into the details of installing software on and configuring an XP machine, that is beyond the scope of this guide. For details and a good instructions on setting up a computer prior to running sysprep (which we will be doing later) see here: http://www.vernalex.com/guides/sysprep/general.shtml

Step 4:

Setup SysPrep answer file and move our drivers over to the source system from our image.

If you are unfamiliar with SysPrep I encourage you to watch/go through this excellent guide:

http://www.vernalex.com/guides/sysprep/video.shtml

This guide gave me a great understanding of SysPrep and how to properly execute and utilize it’s features, many of which we will be using.

Download SysPrep from MS, see the link at the beginning of the guide. You only need 3 files from the .cab file. These:

sysprepfiles

Create a folder called: ‘sysprep’ on the computer you are going to image. Make sure it is located here: C:\sysprep

Move the 3 files you extracted from the .cab file to C:\sysprep

Download the SysPrep Driver Scanner – Available here: http://www.vernalex.com/tools/spdrvscn/… and place the .exe in C:\sysprep

Insert your XP installation CD and copy the ‘i386’ directory to C:\sysprep.

Create the folder C:\sysprep\drivers: Copy the contents of the ‘Extracted Drivers’ folder we made earlier to the C:\sysprep\drivers folder.

Use setupmgr.exe GUI to help you create a sysprep.inf answer file or better yet modify mine and place it in C:\sysprep.

This is what my sysprep.inf answer file looks like:

http://pastebin.com/f1dc04cec

If you notice in my file there is a line that says: [GuiRunOnce]

This executes a .bat file on startup.

Under this a .bat file is referenced. Basically this .bat file does a couple things. Most importantly it fies an issue with the Apple Trackpad drivers. The problem is that if you install the Apple Trackpad driver before the MS USB drivers the device fails to work properly. I found this fix and the solution here: http://www.projectappletree.org/page17/page23/page23.html. This page also helped me develop this entire guide. I made a .bat file that uses the devcon tool from Microsoft. Essentially this tool allows you to change/update drivers from the command line. I pulled the various Apple Trackpad Device ID’s from the Apple drivers .inf file, and then placed those into the script. Then I took this input.inf file: http://www.mediafire.com/file/2iamlme2ztg/input.inf. You may actually have this input.inf file on your XP system, do a search. You need to move this file to C:\WINDOWS\System32. The .bat file should be placed in C:\Windows\System32. You can download it here: http://www.mediafire.com/file/5htzjzzdjnb/fixtrackpad.bat. The .bat file also deletes the C:\sysprep folder which ends up sticking around even though it should be deleted for some reason. You also need to download the DevCon utility from MS and place it in C:\Windows\System32. The download DevCon here: http://support.microsoft.com/kb/311272.

Step 5:

Run the SysPrep Driver Scanner.

The sysprep driver scanner scans the driver directory we populated before and puts the paths to all of the driver files into the registry. Then when the image is pushed out to computer and sysprep runs on first boot the system know where to look when it installs drivers. A detailed explanation on how to use the driver scanner is here and you should read it. http://www.vernalex.com/tools/spdrvscn/index.shtml#download

Step 6:

Take an initial image.

You should take an image of your system before you run syspre and image again. This is so if you mess something up or want to build another image off of this one you will save yourself from having to build the whole thing. To image the XP partition boot back into Mac OS X and use WinClone and take an image. WinClone is here: http://www.macupdate.com/info.php/id/25932.

Step 7:

Run SysPrep and take another image.

Run C:\sysprep\sysprep.exe. Make sure ‘Use mini-setup’ is checked and click ‘reseal’.

It should only take a few seconds to run and then the computer will shut down. Make sure not to boot back into Windows again until you take an image. Again boot into Mac OS X and take an image with WinClone.

Now you should have a working image .winclone image you can restore to other Macs. You can also take an image using another utility such as DeployStudio for network imaging.

So far I have tested this image on a Mac Pro and an older 2.16GHz Macbook and it has worked. I will update this guide with anymore issues or tips. Let me know if you encounter any! Good luck and happy imaging!