Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 21 Nov 2014, 15:37
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Browsers and Internet
Installer for the latest version of Firefox 3.6 en-US
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
Geoffrey


Joined: 30 May 2010
Posts: 1467
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Sun 09 Jan 2011, 11:14    Post_subject:  Installer for the latest version of Firefox 3.6 en-US
Sub_title: Script to install Firefox 3.6 en-US latest updates
 

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:
#!/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
firefox-3.6.xx-installer-updater.tar.gz
Description  This updated script checks the installed version, if the same quits the process
gz

 Download 
Filename  firefox-3.6.xx-installer-updater.tar.gz 
Filesize  1.43 KB 
Downloaded  383 Time(s) 
Back to top
View user's profile Send_private_message 
Geoffrey


Joined: 30 May 2010
Posts: 1467
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Wed 12 Jan 2011, 06:32    Post_subject: Installer for the latest version of Firefox
Sub_title: script updated
 

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.
Back to top
View user's profile Send_private_message 
Geoffrey


Joined: 30 May 2010
Posts: 1467
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Tue 01 Mar 2011, 22:18    Post_subject:    

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. Very Happy
Back to top
View user's profile Send_private_message 
Geoffrey


Joined: 30 May 2010
Posts: 1467
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Sun 06 Mar 2011, 20:08    Post_subject:  

Gee, that was a quick update, Firefox 3.6.15, the script still works.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Browsers and Internet
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0998s ][ Queries: 12 (0.0445s) ][ GZIP on ]