Narnie
May 17, 2010, 12:32pm
1
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.
I'm using the Lucid UNE to write this and note that it has these extensions installed for every user:
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
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.
1 Like
Thanks,
This looks like just what I'm looking for.
Narnie
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
echo $PATH
My system is set up to look in $HOME/bin, so I put mine there.
make it executable with:
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.
#! /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