The section below called [[firefox#Adding_the_settings_to_your_package_definition]] contains the extra lines you'll need to supply Firefox with a specific configuration.
=== Firefox 1X.0 / 2X.0 series (20) 19 - 26 (For current versions of WPKG) ===
This package is for versions of Firefox 19 and higher but works the same for versions of Firefox 19to 4.
</source>
=== Firefox 8 (Requires WPKG 1.2.1-RC20 or higher) ===
This package is for Firefox 8 but works the same for Firefox 7, 6, 5 and 4.
This package works without modification for 32-bit and 64-bit architectures.
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<packages:packages
xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >
<package
id="firefox"
name="Mozilla Firefox"
revision="%PKG_VERSION%-20111111"
reboot="false"
priority="10">
<variable name="PKG_VERSION" value="8.0" />
<variable name="PKG_EXE_VERSION" value="8.0.0.4325" />
<variable name="PKG_DESTINATION" value="%ProgramFiles%\Mozilla Firefox" architecture="x86"/>
<variable name="PKG_DESTINATION" value="%ProgramFiles(x86)%\Mozilla Firefox" architecture="x64"/>
<!-- default language is English -->
<variable name="PKG_LANGUAGE" value="en-us"/>
<!-- overwrite default language for German systems -->
<variable name="PKG_LANGUAGE" value="de" lcid="407,c07,1407,1007,807"/>
<!-- overwrite default language for Dutch systems -->
<variable name="PKG_LANGUAGE" value="nl" lcid="813,413"/>
<check type="uninstall" condition="versiongreaterorequal" path="Mozilla Firefox .+" value="%PKG_VERSION%" />
<check type="file" condition="versiongreaterorequal" path="%PKG_DESTINATION%\firefox.exe" value="%PKG_EXE_VERSION%" />
<install cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="1" />
</install>
<install cmd='"%SOFTWARE%\Firefox\Firefox Setup %PKG_VERSION% %PKG_LANGUAGE%.exe" /S' />
<upgrade include="install" />
<remove cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="1" />
</remove>
<remove cmd='"%PKG_DESTINATION%\uninstall\helper.exe" /s' />
</package>
</packages:packages>
</source>
=== Firefox 3.6 series ===
The silent install switch -ms is no longer considered deprecated.
<source lang="xml">
<package
id="firefox"
name="Mozilla Firefox 3.6"
revision="%version%"
reboot="false"
priority="10">
<variable name="version" value="3.6.24" />
<check
type="uninstall"
condition="exists"
path="Mozilla Firefox (%version%)" />
<install cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</install>
<install cmd='"%SOFTWARE%\firefox\Firefox Setup %version%.exe" -ms' />
<upgrade cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</upgrade>
<upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup %version%.exe" -ms' />
<remove cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</remove>
<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /s' />
</package>
</source>
=== Firefox 3.5 series ===
In this series the silent install command line switch must be "-ms" because "/S" is broken ([https://bugzilla.mozilla.org/show_bug.cgi?id=506867 bug 506867], except for the uninstall, it seems), even though [https://wiki.mozilla.org/Installer:Command_Line_Arguments Installer:Command_Line_Arguments] says "-ms" is deprecated.
<source lang="xml">
<package
id="firefox35"
name="Mozilla Firefox 3.5.19"
revision="1"
reboot="false"
priority="10">
<check type="uninstall" condition="exists" path="Mozilla Firefox (3.5.19)" />
<install cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</install>
<install cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.5.19.exe" -ms' />
<upgrade cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</upgrade>
<upgrade cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.5.19.exe" -ms' />
<remove cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</remove>
<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /s' />
</package>
</source>
=== Firefox 3.0 series ===
As the Firefox installer now nicely upgrades and doesn't leave the old one in the registry, there is no need to differentiate versions in "package id".
<source lang="xml">
<package
id="firefox3"
name="Mozilla Firefox 3"
revision="1"
reboot="false"
priority="10">
<check type="uninstall" condition="exists" path="Mozilla Firefox (3.0.19)" />
<install cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
</install>
<install cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.0.19.exe" /S' />
<upgrade cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
</upgrade>
<upgrade cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.0.19.exe" /S' />
<remove cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
</remove>
<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /S' />
</package>
</source>
=== Firefox 2.0 series ===
<source lang="xml">
<package
id="firefox"
name="Mozilla Firefox 2.0"
revision="1"
reboot="false"
priority="10">
<check type="logical" condition="or">
<check type="uninstall" condition="exists" path="Mozilla Firefox (2.0)" />
<check type="uninstall" condition="exists" path="Mozilla Firefox (2.0.0.20)" />
</check>
<check type="file" condition="exists" path="%PROGRAMFILES%\Mozilla Firefox\firefox.exe"/>
<install cmd='"%SOFTWARE%\firefox\Firefox Setup 2.0.0.20.exe" -ms' />
<upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup 2.0.0.20.exe" -ms' />
<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" -ms' />
</package>
</source>
=== Firefox 1.5 series ===
<source lang="xml">
<package
id="firefox"
name="Mozilla Firefox 1.5"
revision="1"
reboot="false"
priority="10">
<check type="uninstall" condition="exists" path="Mozilla Firefox (1.5)" />
<install cmd='"%SOFTWARE%\firefox\Firefox Setup 1.5.0.12.exe" -ms' />
<upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup 1.5.0.12.exe" -ms' />
<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\uninstall.exe" -ms' />
</package>
</source>
== Extensions ==
</source>
==== Firefox 3.6 Series Extensions ====
Starting in 3.6, the -install-global-extension command-line parameter is deprecated and the new official procedure to install a global extension is: extract the extension and copy the folder to the %ProgramFiles%\Mozilla Firefox\extensions folder with a folder name matching the extension GUID.
If you have a large number of extensions to manage, consider using the Extension Templates described in the next section.
In your repository under the firefox folder, create a folder for each extension you want to package. Save the downloaded XPI to that folder. To download and extension from addons.mozilla.org, right-click on the Add to Firefox button and choose Save Link As. Create a folder in the extension folder for each new version of the extension. Extract the extension to its respective version folder. Extensions can be extracted as ZIP files, either by appending a .zip extension or using your preferred archive utility. See below for an example of the recommended directory structure.
<source lang="dos">
%SOFTWARE%\
firefox\
Firefox Setup 3.6.7.exe
Firefox Setup 3.6.8.exe
adblock\
adblock_plus-1.2-fx+sm+tb+fn.xpi
adblock_plus-1.2.1-fx+sm+tb+fn.xpi
1.2\
<extracted extension files>
1.2.1\
<extracted extension files>
</source>
After you have extracted the extension, open the install.rdf file to retrieve the extension's GUID. The extension GUID shouldn't change between versions. This is also a good opportunity to double-check the version number. Look for the line near the top, like this one from Adblock Plus:
<source lang="xml">
<em:id>{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}</em:id>
</source>
Now that you have extracted the extension and retrieved the extension GUID you can create the package. The following is an example for Adblock Plus:
<source lang="xml">
<package
id="firefox-adblock"
name="Adblock+"
revision="%version%"
priority="10">
<variable name="version" value="1.2.1" />
<variable name="extid" value="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}" />
<check
type="file"
condition="exists"
path="%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\chrome.manifest" />
<install cmd='%COMSPEC% /C xcopy /E /Y "%SOFTWARE%\apps\firefox\adblock\%version%" "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\"' />
<upgrade cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</upgrade>
<upgrade cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%"' />
<upgrade cmd='%COMSPEC% /C xcopy /E /Y "%SOFTWARE%\apps\firefox\adblock\%version%" "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\"' />
<remove cmd="taskkill /F /IM Firefox.exe">
<exit code="0" />
<exit code="128" />
<exit code="-1073741515" />
</remove>
<remove cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%"' />
</package>
</source>
If your extension requires additional configuration you can install it manually, make your changes, and then save the <extension>.js file from %AppData%\Mozilla\Firefox\Profiles\<random>\extensions\<extension GUID>\defaults\preferences. This file can then either be copied into your extracted copy of the extension, or it can be copied over with an additional install/upgrade action in the package definition from another location.
Note that there is no easy way to check the installed version of an extension. Also note that non-admin users will not be able to upgrade extensions which are installed globally. It's important to monitor extensions installed this way for updates.
=== Firefox 3.6 Series Extension Templates ===
As stated in: [[Firefox#Firefox_3.0_Series_Extensions]] the "install-global-extension" switch doesn't work starting with Firefox 3.6.
So, there is a better and much smoother way deploying extensions. And: it makes adding a new extension to a WPKG repo about 80 percent easier: '''templating'''.
Here are some examples:
''packages/firefox-ext-adblock_plus.xml''
<source lang="xml">
<!DOCTYPE firefoxextension [ <!ENTITY ext-name "adblock_plus"> <!ENTITY ext-key "1.1.3-fx+sm+tb+fn"> <!ENTITY ff-extension SYSTEM "../templates/ff-extension.xml"> ]>
<packages>&ff-extension;</packages>
</source>
''packages/firefox-ext-ie_view.xml''
<source lang="xml">
<!DOCTYPE firefoxextension [ <!ENTITY ext-name "ie_view"> <!ENTITY ext-key "1.4.5.1-fx+sm-win"> <!ENTITY ff-extension SYSTEM "../templates/ff-extension.xml"> ]>
<packages>&ff-extension;</packages>
</source>
''packages/firefox-ext-screengrab.xml''
<source lang="xml">
<!DOCTYPE firefoxextension [ <!ENTITY ext-name "screengrab"> <!ENTITY ext-key "0.96.3-fx"> <!ENTITY ff-extension SYSTEM "../templates/ff-extension.xml"> ]>
<packages>&ff-extension;</packages>
</source>
What we see here: creating a new extension package is just as easy as putting the extension name and version key in, so that the variables "ext-name" and "ext-key" build together with "-" the name of the xpi file: ''screengrab-0.96.3-fx.xpi''.
And updates? Updates have never been easier: Save the xpi to packages/mozilla/fx_extensions/ and change the "ext-key" variable in firefox-ext-(extname).xml.
The following template is used together with install-extensions.cmd and remove-extensions.cmd. For your convenience, you can find all needed files here: [[Firefox_ext_install_downloads]].
''templates/ff-extension.xml''
<source lang="xml">
<package id='firefox-ext-&ext-name;' name='Firefox Extension &ext-name;' revision='&ext-key;' priority='15'>
<variable name='fxext' value='&ext-name;-&ext-key;'/>
<check type="file" condition="exists" path="%CommonProgramFiles%\Mozilla Shared\Extensions\%FXEXT%\install.rdf" />
<depends package-id="firefox-check" />
<install cmd='"%SOFTWARE%\packages\mozilla\install-extensions.cmd" Firefox %FXEXT% >nul'/>
<upgrade cmd='"%SOFTWARE%\packages\mozilla\install-extensions.cmd" Firefox %FXEXT% >nul'/>
<downgrade cmd='"%SOFTWARE%\packages\mozilla\install-extensions.cmd" Firefox %FXEXT% >nul'/>
<remove cmd='"%SOFTWARE%\packages\mozilla\remove-extensions.cmd" Firefox %FXEXT% >nul'/>
</package>
</source>
=== Firefox 2.0 Series Extensions ===
See [[Firefox2 extensions]]
==== New limitations on -install-global-extension parameter in version 2.0.0.7 ====
Be aware that, for security reasons, Mozilla Firefox 2.0.0.7 will no longer allow global extensions or global themes to be installed from HTTP or UNC paths via the -install-global-extension or the -install-global-theme command line parameters:
http://larholm.com/2007/09/
You must copy your XPI on local drive before install this. (for example)
<source lang="xml">
<install cmd='cmd /C copy /Y "%SOFTWARE%\mozilla\fx_extensions\firebug-1.05-fx+fl.xpi" c:\NETINST' />
<install cmd='"%PROGRAMFILES%\Mozilla Firefox\FIREFOX.EXE" -install-global-extension c:\NETINST\firebug-1.05-fx+fl.xpi' />
<install cmd='cmd /C del /q /S c:\NETINST\firebug-1.05-fx+fl.xpi'/>
</source>
== Customization ==