Difference between revisions of "Firefox"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Remove the huge section on installing FF3 extensions using the deprecated install-global-extension method)
(Extensions: Remove duplicate package snippet for IETab that uses deprecated -install-global-extension method)
Line 207: Line 207:
 
     <exit code="1" />
 
     <exit code="1" />
 
     </upgrade>
 
     </upgrade>
    <upgrade cmd='cmd /C copy /Y "%SETTINGS%\ietab.js" "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\defaults\preferences"' />
 
    <upgrade cmd='taskkill /F /IM firefox.exe'>
 
        <exit code="0" />
 
        <exit code="128" />
 
    </upgrade>
 
 
    <remove cmd='cmd /c rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%"' />
 
</package>
 
</source>
 
 
 
==== IETab ====
 
<source lang="xml">
 
<package id="firefox3-ext-ietab"
 
    name="Firefox Extension IETab"
 
    revision="1"
 
    reboot="false"
 
    priority="0">
 
 
    <depends package-id="firefox3" />
 
 
    <variable name='fxext' value='ie_tab-1.5.20090525-fx-win.xpi' />
 
    <variable name='fxdir' value='{77b819fa-95ad-4f2c-ac7c-486b356188a9}' />
 
 
    <check type="file" condition="exists" path="%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\chrome.manifest" />
 
 
    <install cmd='taskkill /F /IM firefox.exe'>
 
        <exit code="0" />
 
        <exit code="128" />
 
    </install>
 
    <install cmd='cmd /C copy /Y "%SOFTWARE%\packages\%FXEXT%" "%PROGRAMFILES%\Mozilla Firefox"' />
 
    <install cmd='"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -install-global-extension "%PROGRAMFILES%\Mozilla Firefox\%FXEXT%"' />
 
    <install cmd='cmd /C del /q "%PROGRAMFILES%\Mozilla Firefox\%FXEXT%"' />
 
    <install cmd='cmd /C copy /Y "%SETTINGS%\ietab.js" "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\defaults\preferences"' />
 
    <install cmd='taskkill /F /IM firefox.exe'>
 
        <exit code="0" />
 
        <exit code="128" /
 
    </install>
 
 
    <upgrade cmd='taskkill /F /IM firefox.exe'>
 
        <exit code="0" />
 
        <exit code="128" />
 
    </upgrade>
 
    <upgrade cmd='cmd /c rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%"' />
 
    <upgrade cmd='cmd /C copy /Y "%SOFTWARE%\packages\%FXEXT%" "%PROGRAMFILES%\Mozilla Firefox"' />
 
    <upgrade cmd='"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -install-global-extension  "%PROGRAMFILES%\Mozilla Firefox\%FXEXT%"' />
 
    <upgrade cmd='cmd /C del /q "%PROGRAMFILES%\Mozilla Firefox\%FXEXT%"' />
 
 
     <upgrade cmd='cmd /C copy /Y "%SETTINGS%\ietab.js" "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\defaults\preferences"' />
 
     <upgrade cmd='cmd /C copy /Y "%SETTINGS%\ietab.js" "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\defaults\preferences"' />
 
     <upgrade cmd='taskkill /F /IM firefox.exe'>
 
     <upgrade cmd='taskkill /F /IM firefox.exe'>

Revision as of 17:55, 3 August 2010

This page is for Mozilla Firefox, available from GetFirefox.com.

Installation

Note the high priority - Firefox should be installed before plugins, like Adobe Flash Player or Adobe Authorware Player etc (or this could be achieved with dependencies). Command-line options for the installer are documented here, which also describes how to use a config.ini file for basic configuration of the Firefox install.

Firefox 3.6 series

The 'revision' is left for you to change to the version of Firefox WPKG packaging within your own system.

In this series the silent install command line switch must be "-ms" because "/S" is broken (bug 506867, except for the uninstall, it seems), even though Installer:Command_Line_Arguments says "-ms" is deprecated.

<package 
	id="firefox"
	name="Mozilla Firefox 3.6.8"
	revision="1"
	reboot="false"
	priority="10">
 
	<check
		type="uninstall"
		condition="exists"
		path="Mozilla Firefox (3.6.8)" />

	<install cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
		<exit code="-1073741515" />
	</install>
	<install cmd='"%SOFTWARE%\firefox\Firefox Setup 3.6.8.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 3.6.8.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>

Firefox 3.5 series

In this series the silent install command line switch must be "-ms" because "/S" is broken (bug 506867, except for the uninstall, it seems), even though Installer:Command_Line_Arguments says "-ms" is deprecated.

<package 
	id="firefox35"
	name="Mozilla Firefox 3.5.8"
	revision="1"
	reboot="false"
	priority="10">
	
	<check type="uninstall" condition="exists" path="Mozilla Firefox (3.5.8)" />
	<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.8.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.8.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>

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".

When a new version comes out, replace every occurrence of the version number in the installer file from, e.g. 1.5.0.4, with, e.g. 1.5.0.5 and then increment the package revision number.

Note that the Add/Remove Programs string of Firefox 1.5 is used for all subversions (1.5.0.4, 1.5.0.5 etc). We don't bump the package version number assuming that minor version upgrade works from Firefox itself. If we did, we would force reinstall on the people who already have Firefox automatically updated.

<package 
	id="firefox3"
	name="Mozilla Firefox 3"
	revision="1"
	reboot="false"
	priority="10">
	
	<check type="uninstall" condition="exists" path="Mozilla Firefox (3.0.13)" />
	<install cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
	</install>
	<install cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.0.13.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.13.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>

Firefox 2.0 series

<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>

Firefox 1.5 series

<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.4.exe" -ms' />
    <upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup 1.5.0.4.exe" -ms' />
    <remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\uninstall.exe" -ms' />

</package>

Extensions

Firefox 3.0 Series Extensions

Note: With Firefox 3.6, the "-install-global-extension" command line switch has been disabled.

To install extensions globally: Install the extension by hand, this will (for IETab) create a directory "{77b819fa-95ad-4f2c-ac7c-486b356188a9}" in your %userprofile%\Mozilla\Extensions. Copy this folder to a reasonable place within your %SOFTWARE% share. To install the application, you will have to xcopy or robocopy it to your "%PROGRAMFILES%\Mozilla Firefox\extensions" directory. You will need to get robocopy or xcopy for this. xcopy comes with WinXP, Robocopy is part of the Windows Resource Kit. Copy the *copy.exe file to your %SOFTWARE%-share, a "tools"-folder might be a good place for that. Don't be confused, the exit code "1" of robocopy means success! (don't ask me why...)


IETab with Firefox 3.6

<package id="firefox3-ext-ietab"
    name="Firefox Extension IETab"
    revision="1"
    reboot="false"
    priority="0">

    <depends package-id="firefox3" />

    <variable name='fxdir' value='{77b819fa-95ad-4f2c-ac7c-486b356188a9}' />

    <check type="file" condition="exists" path="%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\chrome.manifest" />

    <install cmd='taskkill /F /IM firefox.exe'>
        <exit code="0" />
        <exit code="128" />
    </install>
   <install cmd='%COMSPEC% /C "%SOFTWARE%\Tools\robocopy.exe" /E "%SOFTWARE%\Internet\Firefox\Extensions\%FXDIR%" "%PROGRAMFILES(x86)%\Mozilla Firefox\extensions\%FXDIR%"'>
     <exit code="0" />
     <exit code="1" />
    </install>
    <install cmd='cmd /C copy /Y "%SETTINGS%\ietab.js" "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\defaults\preferences"' />
    <install cmd='taskkill /F /IM firefox.exe'>
        <exit code="0" />
        <exit code="128" />
    </install>

    <upgrade cmd='taskkill /F /IM firefox.exe'>
        <exit code="0" />
        <exit code="128" />
    </upgrade>
    <upgrade cmd='cmd /c rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%"' />
    <upgrade cmd='%COMSPEC% /C "%SOFTWARE%\Tools\robocopy.exe" /E "%SOFTWARE%\Internet\Firefox\Extensions\%FXDIR%" "%PROGRAMFILES(x86)%\Mozilla Firefox\extensions\%FXDIR%"'>
     <exit code="0" />
     <exit code="1" />
    </upgrade>
    <upgrade cmd='cmd /C copy /Y "%SETTINGS%\ietab.js" "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%\defaults\preferences"' />
    <upgrade cmd='taskkill /F /IM firefox.exe'>
        <exit code="0" />
        <exit code="128" />
    </upgrade>

    <remove cmd='cmd /c rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%FXDIR%"' />
</package>

Firefox 3.6 Series Extension Templates

As stated in: Firefox#Firefox_3_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

<!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>

packages/firefox-ext-ie_view.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>

packages/firefox-ext-screengrab.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>

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

<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>

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)

 
<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'/>

Customization

Make Firefox the Default Browser

Option 1

Use the uninstall helper to set Firefox as the default browser. Add these lines to your package definition after the lines that install or upgrade Firefox.

<install cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal'>
  <exit code="2" />
</install>

<upgrade cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal'>
  <exit code="2" />
</upgrade>

Option 2

This one will set Firefox as the default browser for all users - it will try to start Firefox in the background, which will set itself as the default browser. After 10 seconds, we kill the Firefox process, as it's no longer needed, and repeat the process again to make sure we really did set the default browser to Firefox (it's needed to do it like this in some circumstances). Note the "taskkill" command exists in Windows XP Pro (and probably Windows Server 2003) but not Windows 2000 or XP Home.

<package
     id="firefox-default"
     name="Make Firefox the default browser"
     revision="1"
     priority="0"
     execute="once">
 
  <install timeout="10" cmd='"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -silent -nosplash -setDefaultBrowser' >
   <exit code="-1" />
   <exit code="0" />
  </install>
 <install cmd='ping 127.0.0.1 -n 10>NUL' />
 <install cmd='taskkill /F /IM Firefox.exe' >
   <exit code="0" />
   <exit code="128" />
 </install>
  <install timeout="10" cmd='"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -silent -nosplash -setDefaultBrowser' >
   <exit code="-1" />
   <exit code="0" />
  </install>
 <install cmd='ping 127.0.0.1 -n 10>NUL' />
 <install cmd='taskkill /F /IM Firefox.exe' >
   <exit code="0" />
   <exit code="128" />
 </install>
 
</package>

See also Mozillazine on Default Browser.

Locking user preferences / Firefox settings for all users (like proxy etc.)

Add this to the end of all.js file (you will find this file in "%ProgramFiles%\Mozilla Firefox\greprefs\"):

 pref("general.config.filename", "mozilla.cfg");

NOTE: all.js file will be overwritten whenever you make Firefox update - don't forget to re-add the above line to all.js after you upgrade Firefox.

Then, create a file called mozilla.txt (yes, mozilla.txt, not mozilla.cfg), and put your custom settings there (NOTE: this file has to begin with //, as the first line of this config file seem to be ignored):

//
lockPref("network.proxy.backup.ftp", "your.proxy");
lockPref("network.proxy.backup.ftp_port", 3128);
lockPref("network.proxy.backup.gopher", "your.proxy");
lockPref("network.proxy.backup.gopher_port", 3128);
lockPref("network.proxy.backup.socks", "your.proxy");
lockPref("network.proxy.backup.socks_port", 3128);
lockPref("network.proxy.backup.ssl", "your.proxy");
lockPref("network.proxy.backup.ssl_port", 3128);
lockPref("network.proxy.ftp", "your.proxy");
lockPref("network.proxy.ftp_port", 3128);
lockPref("network.proxy.gopher", "your.proxy");
lockPref("network.proxy.gopher_port", 3128);
lockPref("network.proxy.http", "your.proxy");
lockPref("network.proxy.http_port", 3128);

lockPref("network.proxy.no_proxies_on", "192.168.*,localhost,127.0.0.1, glpi, glpi.your.domain");

lockPref("network.proxy.share_proxy_settings", true);
lockPref("network.proxy.socks", "your.proxy");
lockPref("network.proxy.socks_port", 3128);
lockPref("network.proxy.ssl", "your.proxy");
lockPref("network.proxy.ssl_port", 3128);
lockPref("network.proxy.type", 1);

Next, convert this file into mozilla.cfg, and copy this file to "%PROGRAMFILES%\Mozilla Firefox". You can do conversion here:

http://alain.knaff.linux.lu/howto/MozillaCustomization/cgi/byteshf.cgi


If you don't care about encoding the mozilla.cfg file, append this config to all.js instead:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

The file mozilla.cfg must be located in "%ProgramFiles%\Mozilla Firefox\".


You can find more details on locking preferences here:

http://kb.mozillazine.org/Locking_preferences

and here:

http://developer.mozilla.org/en/docs/Automatic_Mozilla_Configurator:Locked_config_settings:

You can find a complete autoconfiguration with bookmarks and permission of popup, cookies and images here:

http://www.baby-gnu.org/~nebu/firefox-autoconfiguration.cfg

Disable Automatic Update

If Firefox is started by a user without administrative powers, automatic Firefox update will fail - which is harmless, but can confuse some users. To disable Firefox auto updates, read locking user preferences above first - add this line to your mozilla.cfg file:

 lockPref("app.update.enabled", false);

Firefox Client Customization Kit

The Firefox Client Customization Kit makes it easy for administrators to customize Firefox with home page settings, proxies, extensions, etc. Also, you can lock preferences so that you users cannot change them. Version 1.2 has introduced support for Firefox 3.x, version 1.2.5 has dropped support for Firefox 2.x and only works for Firefox 3.x and later.

Links

 * Automated deployment of Firefox with extensions, themes, and pre-configuration