Compatibilizer Update

My Compatibilizer extension, in dire need of an update, has gotten it! My bad bash skills when I made the first script are now better, so it works a lot better.

The big change is that now it accepts a filename as a parameter. Multiple .xpi files will not affect it at all.

Also I made the temp directory have a random name so as not to interfere with any existing ‘temp’ directories.

Usage:

compatibilizer2 extension-name0.02.xpi

That’s all. The script now even installs the extension for you! Note that this requires root priveleges, it runs gksudo to get them. Then it will open up a fresh firefox (technically it belongs to root) and install the extension. The extension is global, so it will be visible in your profile.

Download it here.

Source code (GPL):

#!/bin/bash
#Daniel's Firefox extension compatibilizer!
#Version 2 adds features!
#Warning! This script is untested on anything but my computer.

filename=$1
tempdir=compat_temp$RANDOM
echo 'Starting extension compatibilizer.'
echo 'Unzipping to temporary directory.'
mkdir $tempdir
unzip -q $filename -d $tempdir/
rm $filename
cd $tempdir/
cp install.rdf install.rdf.backup
echo 'Replacing max version number...'
sed 's|.*|5.0|' install.rdf.step
sed 's|em:maxVersion=".*"|em:maxVersion="5.0"|' install.rdf
echo 'Done replacing max version number'
zip -q -r temp.xpi *
echo 'Remade extension.'
echo 'Moving extension.'
mv temp.xpi ../[compatibilized]$filename
echo 'Extension moved. Deleting temp dirs.'
cd ../
rm -r $tempdir
gksudo firefox-3.0 -install-global-extension $filename
echo 'Done! Installed globally in Firefox.'

Thanks for getting me to do this, Tyler!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: