Installer for the latest version of Firefox 3.6 en-US

Browsers, email, chat, etc.
Post Reply
Message
Author
User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Installer for the latest version of Firefox 3.6 en-US

#1 Post by Geoffrey »

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

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
Attachments
firefox-3.6.xx-installer-updater.tar.gz
This updated script checks the installed version, if the same quits the process
(1.43 KiB) Downloaded 608 times

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Installer for the latest version of Firefox

#2 Post by Geoffrey »

I've updated the script so now it checks to see if a different version is installed, if the same version it quits, only continues if it finds none or another version.

See the first post for the script and download.

I don't know if this is correct way to retrieve all the update information, but only being new to scripting it seemed the most logical way as I could find no more info on how it could be done, maybe someone could give me some pointers on how I could have done it a better way, I've tested it quite a number of times to make sure that it works, I can't fault it, works every time, but whether it will work after the next update of Firefox I will have to see, it all relies on the format of the index.html and Firefox's version info being reformatted to obtain the desired result, seems to work ok so far.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#3 Post by Geoffrey »

Well it looks as if my script has worked in downloading and installing the next Firefox version 3.6.14, I'm happy that it wasn't a waste of time. :D

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#4 Post by Geoffrey »

Gee, that was a quick update, Firefox 3.6.15, the script still works.

Post Reply