5

I have downloaded a Thunderbird extension as a.xpi file.

I know, I can install it in Thunderbird by going to

Tools
  -> Addons
     -> Install Add-on from file

However, I am using several Thunderbird profiles and I would have to do this for each of them.

How can I install this addon globally (presumably somewhere in /usr/share/xul-ext)? Do I have to unpack this .xpi extension file there?

4
  • 1
    I think if you copy xpi file in /usr/lib/thunderbird/extensions/ or /usr/lib64/thunderbird/extensions/ it will be available for all users, however no automatic updates are performed.
    – taliezin
    Mar 15, 2015 at 12:58
  • there are some extensions in /usr/lib/thunderbird/extensions/ but not as .xpi` files. They have names such as: {972aa4c6-7e44-0174-a132-3208198ae6fd}. I don't think I can just copy the .xpi file there. Mar 15, 2015 at 13:15
  • Those shoul be extracted extensions. See in you ~./thunderbird/extensions there should have xpi and extracted if I want to be global I copy either xpi or folder {id} in /isr/lib64/thunderbird/extensions, because for some extenseions I have only xpi
    – taliezin
    Mar 15, 2015 at 13:23
  • 1
    See if global installation section helps, especially uncompress the .xpi file yourself (as a ZIP file) to an appropriately named (extension's ID) folder. Mar 15, 2015 at 13:35

1 Answer 1

4

Seemingly, the extension dir has a different location on different unices. On Ubuntu, it is /usr/lib/thunderbird-addons/extensions. This answer keeps your dir of /usr/lib/thunderbird/extensions/

  1. unzip the xpi file (it is a zip)

    unzip addon.xpi
    
  2. retrieve the add-on id from the install.rdf file:

    ID=$(grep em:id install.rdf  | head -1 | cut -d '>' -f 2 | cut -d '<' -f 1)
    
  3. create directory of id-name under extensions:

    mkdir /usr/lib/thunderbird/extensions/$ID
    
  4. move the unzipped files

    mv $(ls | grep -v addon.xpi)) /usr/lib/thunderbird/extensions/$ID
    

Be aware that these are not auto-updated. The question (by me) at update-global-firefox-addons-automatically is waiting ...

EDIT: with the advent of webextensions, getting the ID is a bit harder. Try the following script

#! /bin/bash
if [ $(id -u) -ne 0 ]; then echo 'needs to run as root'; exit; fi
D=$(mktemp -d)
unzip $1 -d $D
[ -f $D/manifest.json ] && ADDON_ID=$(openssl asn1parse -inform DER -in $D/META-INF/mozilla.rsa | grep -A 1 commonName | grep -E '{|@' | cut -d ':' -f 4)
[ -f $D/install.rdf ] && ADDON_ID=$(grep "em:id" $D/install.rdf  | head -1 | cut -d ">" -f 2 | cut -d "<" -f 1)
if [ x$ADDON_ID == x ]; then
    echo "ADDON_ID retrieval failed"
    exit
else
    echo ID: $ADDON_ID
fi
chmod 755 $D
chmod -R a+r $D
rm -rf /usr/lib/thunderbird-addons/extensions/$ADDON_ID
mv $D /usr/lib/thunderbird-addons/extensions/$ADDON_ID

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.