How to install firefox extensions for all users


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to install firefox extensions for all users
# 1  
Old 05-17-2010
[SOLVED] How to install firefox extensions for all users

Hello,

I am wondering the "new way" to install firefox extensions for all users.

From https://developer.mozilla.org/En/Command_Line_Options we can see that the "old way" is no longer available.

Quote:
-install-global-extension and -install-global-theme have been removed from Gecko 1.9.2 and upwards.
I'm using the Lucid UNE to write this and note that it has these extensions installed for every user:

Quote:
Ubuntu Firefox Modifications
webfav
I have several users on many computers and would like to have certain extensions installed for them, such as xmarks, add bookmark here, coolpreview, etc.

I searched the entire root filesystem and didn't find any .xpi files.

Can someone give me an idea on how to do this? How does Ubuntu do it?

With thanks,
Narnie

Last edited by Narnie; 05-22-2010 at 06:27 PM..
# 2  
Old 05-17-2010
See https://developer.mozilla.org/en/Installing_extensions

If you want silent installation, unzip any jar you find in the extension. Otherwise the first user will be prompted to install the extension.

Last edited by fpmurphy; 05-17-2010 at 09:05 PM.. Reason: Typo
This User Gave Thanks to fpmurphy For This Post:
# 3  
Old 05-17-2010
Quote:
Originally Posted by fpmurphy
See https://developer.mozilla.org/en/Installing_extensions

If you want silent installation, unzip any jar you find in the extension. Otherwise the fist user will be prompted to install the extension.
Thanks,

This looks like just what I'm looking for.

Smilie

Narnie
# 4  
Old 05-22-2010
Attached (at the bottom) is a script I wrote to install extensions for all users.

Save the script (or just untarball the attachment) to a file (I called it add_firefox_extensions).

Place it in a directory found with

Code:
echo $PATH

My system is set up to look in $HOME/bin, so I put mine there.

make it executable with:

Code:
chmod +x add_firefox_extensions

now run it for the instructions (all you need to do is pass the xpi file) and it will do all the grunt work.
Hope it helps some.

Yours,
Narnie

ps, let me know if you run into any problems.

Code:
#! /bin/bash
#


USAGE () {
    USG=\
"
___________________________________________________________________

${0##*/} [-h] XPI_FILE_TO_INSTALL

installs the xpi file to /usr/lib/firefox-addons/extensions which
will inable installation the next time the user runs firefox

-h    print help
___________________________________________________________________
"
    LC=1
    echo "$USG"
    exit
}

if [ $# -lt 1 -o "$1" = -h ] ; then USAGE ; fi 

setUp () {
    if [ ! -f $EXT ] ; then
        echo "File doesn't exist"
        exit 1
    fi
    umask 0022
    if [ -d $TMPDIR ] ; then
        (cd $TMPDIR ; sudo rm -rf *)
    else
        sudo mkdir -p "$TMPDIR"
    fi
    echo -e "\n\nworking . . .\n\n"
    sudo unzip "$EXT" -d "$TMPDIR" &> /dev/null
}

getID () {
    local IFS="
"
    FILE="`cat $TMPDIR/install.rdf`"
    for i in $FILE ; do
        if echo "$i"|grep "urn:mozilla:install-manifest" &> /dev/null ; then
            GET=true
        fi
        if [ "$GET" = true ] ; then
            if echo "$i"|grep "<em:id>" ; then
                ID=`echo "$i" | sed 's#.*<em:id>\(.*\)</em:id>.*#\1#'`
            elif echo "$i"|grep "em:id=\"" ; then
                ID=`echo "$i" | sed 's/.*em:id="\(.*\)".*/\1/'`
            fi
            if [ -n "$ID" ] ; then
                return
            fi
        fi
    done
    return 1
}

installExtention () {
    if [ -d "$EXTDIR/$ID" ] ; then
        sudo rm -rvf "$EXTDIR/$ID"
    fi
    sudo mv -vv "$TMPDIR" "$EXTDIR/$ID"
    if [ $? = 0 ] ; then
        echo -e "\n\nExtension was installed\n\n"
    else
        echo -e "\n\nError installing extension\n\n"
    fi
}

getPath () {
    (
    cd ${1%%/*}
    pwd
    )
}

cleanUp () {
    if [ -d $TMPDIR ] ; then
        sudo rm -rf $TMPDIR
    fi
    exit $1
}

EXT="$1"

EXTDIR="/usr/lib/firefox-addons/extensions"
TMPDIR="/tmp/ext"

trap "cleanUp 1" 1 2 3 15

setUp

getID

installExtention

cleanUp


Last edited by Narnie; 05-22-2010 at 06:24 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question