Custom Firefox Install: Part 2
In the last article we started with the Firefox setup basics. We downloaded the Firefox setup file and extracted its contents. We also found all of the Add-ons that we need to have as part of our basic Firefox install. We also started to customize Firefox. Finally, we found the files that we need to include in our Firefox setup to make sure that those customizations get installed as part of our custom install.
In this article we will continue finding the files that we need to include in our custom Firefox install. We will also talk about how to sliently install Firefox and our favorite Add-ons.
Lets jump right in where we left off:
There are a few bookmarks that want everyone to have. Here is how you can include them as part of the default install:
- Setup your bookmarks exactly how you like them. This includes bookmarks on the "Bookmarks Toolbar"
- If you go to Bookmarks >> Organize Bookmarks you can easily arrange the bookmarks the way you like
- You can delete any of the default bookmarks that come with Firefox if you like
- When you are all done, close Firefox and navigate to the following path: "C:\Documents and Settings\user account\Application Data\Mozilla\Firefox\Profiles\profile name"
- Find the file named "places.sqlite", and copy that file
- Paste "places.sqlite" in the following location "Firefox Setup 3.0.1\localized\defaults\profile"
Now the bookmarks that you just configured are going to be part of our tweaked Firefox install. In previous versions of Firefox the bookmarks were kept in a html file. In this version it is stored in a database (hence the .sqlite extension).
Import IE Settings/Favorites?:
After you are done installing Firefox, and you run it for the first time, it asks you if you want to import settings and favorites from Internet Explorer. If this is going to truely be a scripted install, we don't want to click anything. Also, I have done tons of prep work so I don't have to import any settings from IE. It is really simple to bypass this screen. Here is how you do it:
- Create a file named "override.ini" in the "Firefox Setup 3.0.1\nonlocalized"
- To do this right click, and go to New >> Text Document
- A text document named "New Text Document.txt" will appear
- Rename that document to "override.ini"
- Right click on "override.ini" and go to "Open"
- Paste the following inside:
- Click File >> Save
Now, you will never get that annoying window asking you if you want to import settings from IE. Just make sure that this file is saved in the right path ("Firefox Setup 3.0.1\nonlocalized"), and you should be good to go.
Other files to include:
There are some other files that I include. I am not exactly sure why I include them, but they seem to resolve some issues. They are all found in the following location: "C:\Documents and Settings\user account\Application Data\Mozilla\Firefox\Profiles\profile name".
Here they are:
- content-prefs.sqlite: I think this one prevents the Add-ons window from appearing when open Firefox (I am not sure about that).
- localstore.rdf: I am not sure what this file does
- mimeTypes.rdf: See above comment
Here is a look at the files I include "Firefox Setup 3.0.1\localized\defaults\profile"
Now all of the files that customize Firefox in place it is time to install Firefox. As with most things, there are several ways to install Firefox. Here is the first:
Silent Install Firefox:
If you open a command prompt and navigate to the extracted Firefox setup files, you can type in: "setup.exe /S" (it is case sensitive) and Firefox will install. This will place the install files in "C:\Program Files\Mozilla Firefox", and it will place Firefox icons on your Desktop, Start Menu, and in the Quicklaunch toolbar.
I found a few web pages that show you how to further customize the install. Here is the first: Installer:Command Line Arguments
On this site we learn that you can create an INI file that will change some of the default settings. Here is how you do it:
- Navigate to the "Firefox Setup 3.0.1" folder
- Right click in the empty space, and go to New >> Text Document
- Name the file "FirefoxSetup.ini"
- Right click on the file named "FirefoxSetup.ini" and go to Open
- Paste the following inside:
[Install] ; The name of the directory where the application will be installed in the ; system's program files directory. The security ; context the installer is running in must have write access to the ; installation directory. Also, the directory must not exist or if it exists ; it must be a directory and not a file. If any of these conditions are not met ; the installer will abort the installation with an error level of 2. If this ; value is specified then InstallDirectoryPath will be ignored. ; InstallDirectoryName=Mozilla Firefox ; The full path to the directory to install the application. The security ; context the installer is running in must have write access to the ; installation directory. Also, the directory must not exist or if it exists ; it must be a directory and not a file. If any of these conditions are not met ; the installer will abort the installation with an error level of 2. ; InstallDirectoryPath=c:\firefox\ ; Close the application without prompting the user when installing into a ; location where the application is already installed and the file is in use ; (e.g. it is already running). If this value is not specified the installer ; will prompt the user to close the application. ; CloseAppNoPrompt=true ; By default all of the following shortcuts are created. To prevent the ; creation of a shortcut specify false for the shortcut you don't want created. ; ; Create a shortcut for the application in the current user's QuickLaunch ; directory. ; QuickLaunchShortcut=false ; ; Create a shortcut for the application on the desktop. This will create the ; shortcut in the All Users Desktop directory and if that fails this will ; attempt to create the shortcuts in the current user's Start Menu directory. ; DesktopShortcut=false ; ; Create shortcuts for the application in the Start Menu. This will create the ; shortcuts in the All Users Start Menu directory and if that fails this will ; attempt to create the shortcuts in the current user's Start Menu directory. ; StartMenuShortcuts=false ; The directory name to use for the StartMenu folder. ; note: if StartMenuShortcuts=false is specified then this will be ignored. ; StartMenuDirectoryName=Mozilla Firefox
Notes: By tweaking this file you can do the following
- Change the install path and folder name, decide what icons are installed (and where they are installed), and choose what Start Menu folder Firefox is installed into
- Click File >> Save
- Now you can tweak this file. I want Firefox to install to "C:\Program Files\Firefox 3" and I want it to be in the "Internet Applications" folder in the start menu. Here is my tweaked file:
[Install] InstallDirectoryName=Mozilla Firefox 3 StartMenuDirectoryName=Internet Applications
Note: I only have a few changes so I listed them above. All of the other text was commented out, so it does not have to be included.
To use the "FirefoxSetup.ini" file, you will need to type the following into a command prompt:
At first I could not get the script to work. I discovered that you have to include the entire path to the INI file. That is why I started to use the %CD% variable. The %CD% variable stands for "Current Directory". No matter where you install Firefox from, the variable will always insert the correct information. Now this script works perfectly.
I usually create an BAT or CMD file to run scripts like this. Here is an example:
You can use this info to create a layer without lifting a finger, or to create your own custom EXE installer of Firefox. If you need to, you can even do both!
Silent Install Firefox Add-ons:
Before I mentioned that you could create an "Addon" folder and place all of the Addons that you want to install. Here is how you can install them:
- Install Firefox 3
- Open a command prompt (Start >> Run >> cmd.exe)
- Navigate to your "Firefox Setup 3.0.1" folder
- Type in the following:
firefox.exe -install-global-extension "C:\path\to\extension\extension.xpi"
"C:\Program FIles\Mozilla Firefox 3\firefox.exe" -install-global-extension "%CD%\Addons\google_bookmarks_button-0.3.6-fx.xpi"
You can use the following script to install Firefox and the Add-ons:
@ECHO OFF ECHO Installing Firefox 3.0.1... setup.exe /INI="%CD%\FirefoxSetup.ini" ECHO Installing Add-ons... "C:\Program FIles\Mozilla Firefox 3\firefox.exe" -install-global-extension "%CD%\Addons\ie_tab-1.5.20080618-fx-win.xpi" "C:\Program FIles\Mozilla Firefox 3\firefox.exe" -install-global-extension "%CD%\Addons\ie_view_lite-1.3.3-fx.xpi" EXIT
This is an easy way to both update an existing version of Firefox, or to install a new one. It is nice that Mozilla has made it so easy to customize Firefox. You could even use this script to create a layer of an Add-on.
Why on earth would you do this?
Now that we have figured out how to silently install a configured version of Firefox you might ask "Why would I do it this way?" It boils down to the way that Firefox works. Before you open Firefox it has no settings. Once it is opened a your settings are created in the "Application Data" folder of your profile. Normally you would have to figure out how to distribute those settings and Firefox.
Using this guide you make sure that even before Firefox is opened it is configured the way you want it (this config includes your bookmarks, preferences, and Add-ons). That means that all the users on your computer will get Firefox the way you want it. Even if a new account is created on the computer the user will get a pre-configured Firefox.
I also think that using this guide gives a system admin way more options. You can use this guide to create a layer (which we will do later). You can also use it to distribute via a script (like in Deployment Console). You could also pop this into Wise Package Studio and get it packaged in there. Finally, you can easily get this to work in SVS Pro. I don't like to lock myself into on solution, that is why this guide is great.
In the next few articles I will talk about how to update an existing install of Firefox from one version to another. I will also talk about how to lock the browser down to secure users information. In the coming articles I will talk about how to add Firefox into SVS Pro, so stay tuned.