Mozilla / Thunderbird Update Service

Thunderbird and Firefox are updating very frequently with their new policy. Since we need a a few special addons for SOGo, it was quite hard to make sure our users didn’t use the automatic update to a newer version. To make the update to Thunderbird 10.0 ESR smoother and make sure we control future updates, I wanted to have an update server for Thunderbird. (Works with Firefox and other Mozilla products as well.) Since the documentation was quite thin and there wasn’t an easy ready solution, I’ll try to provide ours. We are going to use only Mozillas long term releases (ESR), so we only need to add security updates and every year a new Thunderbird version. I’m not sure how comfortable this is going to be if you need to manage a lot of updates.

Sources are a lot of googling and especially the following links:

To setup the Thunderbird update service, I wrote a simple PHP script. I setup an apache virtual host for this task, but a sub directory surely works as well. Make sure that in the apache config for this directory the following settings are set, either in the config or in the .htaccess:

ForceType application/x-httpd-php
php_flag short_open_tag off

Now you need to change a config setting in Thunderbird (Preferences -> Advanced -> Config Editor) to let it know where to get the updates. Create the new setting „app.update.url.override“ (don’t just change app.update.url, it gets ignored) and set it to the following URL (adapt to your circumstances of course):

http://mozilla-updates.yourdomain.com/update/3/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml

If you have an SSL certificate that is recognized by Thunderbird, best use a secure connection, but if it is self signed, you need to rely on http.

If you want using it company wide, the configuration of the client is surely better done automatically. We are using the SOGo-plugins that already include this possibility, but there should be other ways to do that. (If you know a good one, a comment would be nice as I didn’t research into that direction.)

Now put this script as „update“ (not update.php!) onto your web server. Read it and adapt it to your circumstances, the comments should be thoroughly enough.

<!--?php <br ?--> /* Script to manage a small count of Thunderbird update files.
* Author: Jakob Lenfers &lt;jakob@drss.de&gt;
* This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
*/


header("Content-type: text/xml");
// set 'php_flag short_open_tag off' for this to work
echo '<!--?xml version="1.0"?-->';

// set this to the URL where the updates can be found, ideally the same web
// server as this script
$update_host = "http://mozilla-updates.yourdomain.com";
// where the files lie in the filesystem. Important so the hash can be generated.
$updates_path = "/opt/mozilla-updates/";

// get all the vars out of the URL
$url_params=explode("/",$_SERVER["REQUEST_URI"]);
$product=$url_params[3];
$version=$url_params[4];
$build_id=$url_params[5];
$build_target=$url_params[6];
$locale=$url_params[7];
$channel=$url_params[8];
$os_version=$url_params[9];
$dist=$url_params[10];
$dist_version=$url_params[11];
$filename=$url_params[12];

//
// default values
//
// no update until we found a valid version
$update = false;
// per default use this version, usually the newest
$update_ver = "10.0.2";
// not sure where this is used in TB
$update_type = "major";
// is it a complete install file or a diff. If its a diff, set
// it to "partial".
$update_patchType = "complete";
// A simple HTML page that is shown during the update process. Usually
// contains new features or relevant information for the update.
$update_detailsURL = "http://yourwebserver/tb-update10.html";
// default lang. Will be pushed regardless of the client language
// if not changed below.
$update_lang = "en-us";

// we have only german and english language files. Remove or change
// this if you only plan to have the english update files or if you
// want to support other languages.
if($locale == "de"){
$update_lang = $locale;
}

// In the following block are the definitions for the update. We usually want to
// update straight to the newest version and don't have partial updates, because
// bandwidth isn't an issue in the internal network.
// You can change any setting that was set above as default here. If you want a
// different detailsURL on a partial update for example.
//
// we don't update firefox atm, only thunderbird
if($product=="Thunderbird"){
// example for a partial update
/* if(version_compare($version, "10.0.1", "=")){
$update = true;
$update_patchType = "partial";
// filename changes with the settings
}
*/

// if there are no more specific rules, upgrade all version to the
// current complete ESR version (default settings defined above)
if(version_compare($version, "10.0.2", "&lt;")){
$update = true;
}
}

// set the update filename
$update_file = strtolower("$product-$update_ver-$update_patchType-$build_target-update_lang.mar");

// if an update should be done and the file is readable, print the xml
// otherwise print just the empty update element
if($update &amp;&amp; is_readable($updates_path . $update_file)){
// $update_file_hash = hash_file("sha512", $updates_path . $update_file); // doesn't work with TB2
$update_file_hash = hash_file("sha256", $updates_path . $update_file);
$update_file_size = filesize($updates_path . $update_file);
echo "

"
;
}
else{
echo "";
}
?&gt;

Finally you need the actual .mar (Mozilla Archive) files. They can contain diffs between two Thunderbird versions or the complete installation. We are pushing only the full installations since bandwidth isn’t an issue, but the partial updates are just as easy. Only generating them myself seemed quite tricky, so I copied the ones from mozilla. Find a mirror here, the mar files are in update subdirectories (like for example here.) Put all the different systems (Win/Linux/Mac) and languages you want to support to your webserver and rename them into this naming schema in lower case: „$product-$update_ver-$update_patchType-$build_target-update_lang.mar“. It looks like this on our web server:

root@maunaloa:/opt/mozilla-updates# ls -1
thunderbird-10.0.2-complete-darwin_ppc-gcc3-de.mar
thunderbird-10.0.2-complete-darwin_ppc-gcc3-en-us.mar
thunderbird-10.0.2-complete-linux_x86_64-gcc3-de.mar
thunderbird-10.0.2-complete-linux_x86_64-gcc3-en-us.mar
thunderbird-10.0.2-complete-linux_x86-gcc3-de.mar
thunderbird-10.0.2-complete-linux_x86-gcc3-en-us.mar
thunderbird-10.0.2-complete-winnt_x86-msvc-de.mar
thunderbird-10.0.2-complete-winnt_x86-msvc-en-us.mar
update
root@maunaloa:/opt/mozilla-updates#

I hope this was helpful, please leave a comment if you have questions or ideas. In the next days I’m going to put together another article on our way to update our SOGo-Installations with Thunderbird2 and Thunderbird3 to Thunderbird10 including the addons.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

What do you think of this post?
  • Interesting (5)
  • Useful (3)
  • Awesome (1)
  • Sucks (0)
  • Boring (0)

3 Antworten auf „Mozilla / Thunderbird Update Service“

  1. Thks for this good topic.
    We trie it with success !

    But how to change the setting „app.update.url.override“ for all users?
    This setting seem stored in user profile.

    1. I think there was a plugin you could let all users install that you could setup to push settings. We are using plugins of the groupware SOGo, that can set the settings, so I sadly don’t know a way to push them otherwise.

      If you find a good way, please leave another comment.

  2. I think I find :

    In the file
    C:Program Files (x86)Mozilla Thunderbirddefaultspref

    Add on the bottom :
    pref(„app.update.url.override“, „http://10.245.64.14/mozilla/update/3/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml“);

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.