Installer for the latest version of Firefox 3.6 en-US
Posted: Sun 09 Jan 2011, 15:14
I wrote this script to update Firefox if you happen to have a version older than Firefox 3.6 and want the latest one, if the firefox updater is not working or if you don't have it installed at all.
I've added captions for the different process's for those who might be interested, it took me a few days to write figuring out the one liners for converting the html to a filename, as far as I can tell it should be ok for the whole series of firefox 3.6 unless the page format changes.
It also creates a script /usr/local/bin/roxuri so when you download a file and select open containing folder, in the window that opens navigate to roxuri and select it then roxfiler will be used to view the downloads.
I hope it's useful
I've added captions for the different process's for those who might be interested, it took me a few days to write figuring out the one liners for converting the html to a filename, as far as I can tell it should be ok for the whole series of firefox 3.6 unless the page format changes.
It also creates a script /usr/local/bin/roxuri so when you download a file and select open containing folder, in the window that opens navigate to roxuri and select it then roxfiler will be used to view the downloads.
I hope it's useful
Code: Select all
#!/bin/bash
#Firefox 3.6.xx latest en-US version Downloader, Installer, Updater
#This is a install only script no uninstall, to remove delete /usr/lib/firefox, /usr/share/applications/firefox.desktop, /usr/bin/firefox
#If the setting eg. profiles, bookmarks, cache and addon aren't needed then delete /root/.mozilla/firefox
#Author Geoffrey
#Check if Firefox installed and Version
#Download Firefox index.html
yaf-splash -placement center -bg yellow -fontsize large -text "Checking For Latest Version Of Firefox-3.6.xx" &
wget -P /tmp/firefox_install http://pv-mirror01.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.6/linux-i686/en-US/
killall yaf-splash
cd /tmp/firefox_install
# Check for existing version
existing_version=`/usr/lib/firefox/firefox --version `
echo $existing_version > ver1; tr -s ' ' '\012' < ver1 > ver2;
sed '0,/Mozilla/d' ver2 > ver3; sed '3,10d' ver3 > ver4; sed 's/$/-/g' ver4 > ver5;
tr -d '\n ' < ver5 > ver6; sed -ie 's/,-$//' ver6 > ver6e
for ver in `cut -f 2 -d "=" ver6 `
do existing_ver="$ver";done
# Filter out filename of new version
perl -0ne 'print "$1\n" while (/a href=\"(.*?)\">.*?<\/a>/igs)' index.html > html.data
sed '1,/firefox/d' html.data > tmp.data; sed '2,3d' tmp.data > file.data
for firefox in `cut -f 2 -d "=" file.data `
do
# Retrieve Firefox version name
# Remove suffix from filename
ff="${firefox%%.tar.bz2*}"
# Change first character to uppercase
u=$(tr '[a-z]' '[A-Z]'<<<"${ff:0:1}")
latest_firefox="${u}${ff:1}"
# Compare versions
if [ "$existing_ver" == "$latest_firefox" ]
then
yaf-splash -timeout 5 -placement center -bg yellow -fontsize large -text "$latest_firefox Is Already Installed"; rm -r /tmp/firefox_install; exit
else
# Download Firefox
yaf-splash -placement center -bg yellow -fontsize large -text "Downloading $latest_firefox Please Wait" &
wget -P /tmp/firefox_install http://pv-mirror01.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.6/linux-i686/en-US/"$firefox"
killall yaf-splash
fi
#Install
yaf-splash -placement center -bg yellow -fontsize large -text "Installing $latest_firefox" &
tar -xvjf "$firefox";done
rm -r /usr/lib/firefox
mv firefox /usr/lib/
#Create Symbolic link
ln -s /usr/lib/firefox/firefox /usr/bin/firefox
#Create New and replace existing Menu entry
rm /usr/share/applications/firefox.desktop
echo "[Desktop Entry]" > /usr/share/applications/firefox.desktop
echo "Encoding=UTF-8
Name=$latest_firefox
Comment=$latest_firefox Web Browser
Categories=Internet;WebBrowser;
Exec=firefox
Icon=/usr/lib/firefox/icons/mozicon128.png
Terminal=false
Type=Application" >> /usr/share/applications/firefox.desktop
killall yaf-splash
#Create roxuri script to associate downloaded files with Rox
echo "#!/bin/sh" > /usr/local/bin/roxuri
echo 'exec rox -U "$@" ' >> /usr/local/bin/roxuri
chmod a+x /usr/local/bin/roxuri
#Remove Temp Files
rm -r /tmp/firefox_install
#Check Firefox Version
new_version=`/usr/lib/firefox/firefox --version `
yaf-splash -timeout 10 -placement center -bg yellow -fontsize large -text " Installed... $new_version
Updating Menu, Screen Will Flicker
Go To Menu Internet $latest_firefox"
#Refresh Menu
fixmenus
jwm -restart