jens.hatlak.de / About me    
Atari   Mozilla / Mozilla dualboot  
Dreamweaver Manual     Building Mozilla  
Acronyms     Installing Mozilla  
    Bookmark Indicator  
Diese Seite in deutsch Diese Seite
in deutsch
    Custom Buttons  
  MailNews Status Icons  

Installing Mozilla

Mozilla Logo Building Mozilla is one thing. Using it is simple, too. Installing as well? You might guess so at first sight. It may be true for the average user, but if you are going to use some extensions and further more want to do that on Linux or a Unix derivative you will soon find that it is just not that simple but indeed rather costly.

The following installation script which should be run as root with X access privileges sets up a Mozilla that has been built or otherwise installed correctly and finalizes it for all system users:

#!/bin/sh
XPINSTALLSCRIPT=/home/moz/installxpis.html
MOZBLOGFILE=/home/moz/nsXmlRpcClient.js

MOZDIR=`mozilla-config --libs | sed s/-L//`
[ -z $MOZDIR ] || [ ! -d $MOZDIR ] && echo "Not a directory: $MOZDIR" && exit 1
MOZILLA_FIVE_HOME=$MOZDIR
LD_LIBRARY_PATH=$MOZDIR:$LD_LIBRARY_PATH
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
cd $MOZDIR
echo ""
echo "Starting Mozilla now..."
echo ""
./mozilla-bin $XPINSTALLSCRIPT
echo ""
echo "Setting up plugins now..."
echo ""
chmod a+x components/
cd $MOZDIR/plugins
ln -s /usr/lib/mozilla/plugins/* .
ln -s /usr/java/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so
cd ..
[ -f $MOZBLOGFILE ] && cp $MOZBLOGFILE components
./regxpcom
./regchrome
chmod -fR o+r *
echo ""
echo "Done."
echo ""

Within the first two lines two files are referenced:

In addition, all plugins in /usr/lib/mozilla/plugins (containing Mozilla plugins which have been installed via Debian packets) get symlinked, as well as the Java plugin from /usr/java/jre — if you are using different paths you can change them or comment out the respective lines.

XPI Installation Script

Using the following installation script, you can easily install XPIs stored locally. Unfortunately, not all project pages offer direct downloads of their XPIs which can be saved using Shift-click. In such cases you will have to view the source code of the installation page, possibly make up the download path and get it using a download program like wget yourself.

The XPIs to be installed are expected to be located in the same directory as the XPI installation file (the following script), but they can also be kept in subdirectories relative to it.

It is important to note that you can only install real XPIs this way, no JARs like some theme authors offer (theme XPIs are no problem, however). With a little bit of knowledge about the structure of XPIs you can often make a full-grown XPI that can be installed using this script out of a theme JAR quite easily. If you need help you are welcome to contact me.

Unfortunately, there is no direct way to force a global installation of certian extensions. Thus it is important to read each and every request in order to find out whether the OK or Cancel button triggers a global installation ("in browser root", "in application directory", ...). I suggest using a test profile for installation (run Mozilla with the -ProfileManager parameter where appropriate). If you accidentally install an extension into the profile you can simply delete the test profile. Caution! It happened to me more than one time that I deleted the wrong profile! It was not that problematic with me since I am running Mozilla in dual boot mode and it only happened on Linux here... But you can also run just one profile (like I do on Windows) and simply delete everything in the chrome directory of the respective profile upon accidental installation. Mozilla automatically recreates anything that is necessary (like the chrome.rdf).

<html>
<head>
<title>Install XPIs</title>
<script language="JavaScript" type="text/javascript">
<!--//
function registerIt() {
  var XPIs = new Array();
  XPIs['MyExtension1'] = 'extension1.xpi';
  XPIs['MyExtension2'] = 'subdir/extension2.xpi';
  // ...

  if (navigator.userAgent.match(/Linux/)) {
    XPIs['MyLinuxExtension'] = 'linuxextension1.xpi';
    // ...
  } else {
    // not actually Windows in case you're using other OSs
    XPIs['MyWindowsExtension'] = 'windowsextension1.xpi';
    // ...
  }

  // Install at last: MultiZilla
  XPIs['GoogleBox'] = 'googlebox.xpi';
  XPIs['MultiZilla'] = 'multiviews.xpi';

  InstallTrigger.install(XPIs);
  document.open();
  document.write("<h2>When installation completes, exit Mozilla to proceed.</h2>");
  document.close();
}
//-->
</script>
</head>

<body>
<h3>Registering XPIs...</h3>
<button onClick="registerIt()">Install!</button>
</body>
</html>

As you can see above, Googlebox and MultiZilla get installed at last. This is due to experience with other extensions breaking when installed after MultiZilla. I don't know whether this is still a problem, but it has no disadvantages to proceed like this.

A little tip, in case an extension should ever break the whole profile: It is often enough to delete chrome/*, XUL.* and localstore.rdf (all of them get restored automatically).
If you delete the latter you will lose certian settings like window sizes and placements but I think you can get over that. It is much more important that the prefs.js stays faultless — but the Mozilla developers know that as well and automatically let Mozilla create a backup (prefs.bak).

Start Script

The following start script solves two problems the one originally supplied has: For one, it re-uses a Mozilla that is already running and opens given addresses in a new tab. Additionally, it starts the browser via aRts, the KDE sound daemon, so that playing sounds like the one when new mail has arrived does work in cooperation with other applications.

Below, the Mozilla directory is set using MOZILLA_FIVE_HOME. This path can be different according to the installation, especially the version number.

#!/bin/bash
export MOZILLA_FIVE_HOME=/usr/local/lib/mozilla-1.8b
export LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH
cd $MOZILLA_FIVE_HOME
moz_bin="$MOZILLA_FIVE_HOME/mozilla-bin"
if ! ps -f -u $(whoami) | grep -v grep | grep mozilla-bin 1>/dev/null 2>&1; then
  exec artsdsp $moz_bin "$@"
else
  exec $moz_bin -remote "openURL($@,new-tab)"
fi

The following bash script generates code matching the respective Mozilla previously built and calls the resulting script run-mozilla. It should be run as root in the directory in which the CVS checkout has been made.

MOZVER=`grep '#define MOZILLA_VERSION ' obj-*/mozilla-config.h \
| awk '{print $3}' | sed -e 's/"//g'`

cat > /usr/local/bin/run-mozilla << EOT
#!/bin/bash
export MOZILLA_FIVE_HOME=/usr/local/lib/mozilla-$MOZVER
export LD_LIBRARY_PATH=\$MOZILLA_FIVE_HOME:\$LD_LIBRARY_PATH
cd \$MOZILLA_FIVE_HOME
moz_bin="\$MOZILLA_FIVE_HOME/mozilla-bin"
if ! ps -f -u \$(whoami) | grep -v grep | grep mozilla-bin 1>/dev/null 2>&1; then
  exec artsdsp \$moz_bin "\$@"
else
  exec \$moz_bin -remote "openURL(\$@,new-tab)"
fi
EOT
chmod a+x /usr/local/bin/run-mozilla

 

Valid HTML 4.0!
Jens Hatlak
April 15, 2005