Open main menu

CDOT Wiki β

Changes

Universal Firefox on a USB Key

159 bytes added, 16:06, 26 February 2008
Version 0.1
=== Version 0.1 ===
We have approached the project from a packaging perspective as such we have been working on a proof of concept script to manage Firefox's directory structurein order to use a universal profile.
We have decided to write a script that allows firefox to read the profile from a directory on the stick USB Key instead the default folder on Windows, which is the Application Data\Mozilla folder. We decided to create our Univerisal Firefox with the following file structure:
. (root of the usb key)
.\Firefoxes\
For 0.1 we decided to start the project on the Windows platform. We installed Firefox 2 on a USB Key and comfirmed that the program is running from the Key by adding an alert box to one of the buttons on the browser. We further confirmed that Firefox is running from the key USB Key by testing it on a Windows XP image that only had the default installation and no Firefox previously installed. At this point Firefox on the Firefox program USB Key would create a default profile on the local machine hard drive.
We wanted to alter this behavior so that Firefox would read the common profile on the USB Key. We researched for ways to redirect where Firefox was looking for its profiles. We realized that Firefox looked up Profiles.ini in the Windows Application Data folder for the location of each profile. We later discovered that there is a program switch to tell firefox Firefox where to get its profile. We initially hard coded the directory and profile location used by the command line switch.as follows:
firefox.exe -profile "G:\Seneca\firefoxWindowsInstallToStick\Profiles\q928eerv.default"
Using an absolute path name we managed to have Firefox read and write the profile on the USB Key. Next we wanted to change the absolute path into a relative path via a batch script. The following script succeeding in giving us the relative path as long as it was run from the current directory of where the batch fileresided.
@echo off
set currDir=%CD%\
rem this is the concatenated command that is executed
rem %total%
The challenge was to write a script that would capture the batch file's location no matter where it was run from (e.g. executing the batch file from the C: drive). To solve this problem in the batch script, we added code to find the location of the batch file, have it execute the firefox Firefox call from there and then return to the original directory that he user was on.
@echo off
cls
for /f %%i in ("%0") do set batchpath=%%~dpi '''<font color="red"><----this line returns the current directory of the batch file</font>'''
echo Starting Firefox From USB
echo batchpath=%batchpath%
1
edit