WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Firefox - Script to install the latest version - soon to be extension  (Read 1019 times)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
First, this script was designed to download and package as a tcz extension the latest version of firefox for TC-5.x and TC-6.x, however it has become a little more than that.

This version will attempt to detect the current latest official firefox download, then package it up as a firefox-official extension and install it.
There are options to specify the exact version desired if this differs from the latest, or if this script is no longer able to detect the latest version.because of a change in the mozilla latest web page..??
Additionally, an option to manually edit the firefox download http or ftp address is provided should anyone have specific localization requests.

This script is an updater and an installer.  it does not require any previous install of firefox at all.
This version of the script supports

tc-5-x86
tc-5-x86_64
tc-6-x86
tc-6-x86_64

The newly created firefox-official extension is a direct replacement, therefore will upgrade a previously installed version if found
eg: firefox-official.tcz from both tc-5-x86 & tc-6-x86 repo's

Additionally is a direct replacement for
firefox.tcz from the tc-5-x86_64 repo, however this extension will not be automatically upgraded, there will be an option to uninstall it before the script exit's

With this script (soon to be extension) these previously mentioned firefox-official extensions will no longer be supported and are likely redundant.

In the case of
firefox.tcz from the tc-5-x86_64 and
firefox.tcz from both tc-5-x86 & tc-6-x86 repo's
there is provided a means of uninstalling these outdated firefox extensions if currently installed in the systems onboot.lst
this script will not uninstall any previously installed firefox extensions unless you opt-in to do so
The onus is on the user to uninstall older and possibly conflicting firefox extensions, but I've tried to do the next best thing in that regard.

The only drawback as far as I can see is the process will probably require a reasonably good connection and some free space in terms of memory and permanent storage. 

I'll be grateful for feedback and suggestions



A huge thank you to those who have been helping to test this script.
I should also thank aus9 who's original script inspired me

« Last Edit: December 29, 2014, 05:57:56 PM by coreplayer2 »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #1 on: December 29, 2014, 06:01:15 PM »
To use:

download the script
set executable permissions
run the script until completion
uninstall old version as required
then reboot

:)

Offline Misalf

  • Sr. Member
  • ****
  • Posts: 472
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #2 on: December 29, 2014, 07:27:29 PM »
Quote
The only drawback as far as I can see is the process will probably require a reasonably good connection [...]

I will test and report back as soon as my 3G connection limit kicks in (after downloading 5GB of data the speed is limited to 56Kbit/s). For now I know it works flawlessly at ~2Mbit/s. I'll go watching some youtube with firefox-official. (;

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Firefox - Script to install the latest version - soon to be extension
« Reply #3 on: December 29, 2014, 08:00:48 PM »
I'm guessing if you have no problems with a 3G connection then I think we're safe!!  concern debunked..   2Mbit/s is fast compared to data plans we used to have





Sent from my iPhone using Tapatalk
« Last Edit: December 29, 2014, 08:02:21 PM by coreplayer2 »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #4 on: December 29, 2014, 08:05:57 PM »
So how long did it take to download the Firefox tar file, 20 seconds?


Sent from my iPhone using Tapatalk

Offline Misalf

  • Sr. Member
  • ****
  • Posts: 472
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #5 on: December 29, 2014, 08:47:24 PM »
~260 - ~310 Kilo Bytes per second it takes about 2 minutes 37 seconds. Just tested.

~8 Kilo Bytes per second, for a 40+ MB file will probably take like two hours. At least.. q:

Still downloading random stuff. (:

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #6 on: December 30, 2014, 12:33:51 AM »
Yikes but that is in throttled me de?


Sent from my iPad using Tapatalk HD

Offline Misalf

  • Sr. Member
  • ****
  • Posts: 472
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #7 on: December 30, 2014, 02:37:08 PM »
2h would be throttled mode, yes. I'm living in the stone age of the internet from time to time. ):
However, my ISP is either too lazy or doesn't care to check my bandwidth consumption or it really likes me because the bandwidth limit don't want to kick in this month for some reason. It usually does. Yay! (:

Anyway, I'm using a quite simple wget script to make sure a troublesome download will not totally fail:
Some stuff might look familiar.. (:
Code: [Select]
#!/bin/sh
## Author: Misalf
## v 0.1
## Jun-6-2014

echo -e "\033]0;Wget...\007"

#. /etc/init.d/tc-functions
#useBusybox

trap 'echo -e "\033]0;$\007" ; line="=" ; f_line ; trap 2 ; kill -2 $$' 1 2 3 13 15

##******************************************************************************************************************
##***************************************************Functions******************************************************
## coreplayer2

## Draws a line at full screen-width  ( use xy=(line#) for row position ;   linecolor=([0]-[7]) linebold=([0]-[7]) ;  line=([char]) )
f_line() {
wide=`stty size | cut -d" " -f2`
#printf "\033[3;0H"
echo -ne "\033[0${linebold};3${linecolor}m "
printf '%*s\n' "$(( wide-2 ))" '' | tr ' ' $line
printf "\033[00m"
}

## Check Connection / URL
f_chkconn () {
echo -ne "\033[00;35m Using\033[01;30m: \033[00;32m${WGET} \033[01;30m::"
echo -e "\033[00;35m URL\033[01;30m: \033[00;36m${URL}"

line="-"
f_line

echo -ne "\033[00;36m Testing connection to server\033[01;30m... \033[00m"
${WGET} -s -T 20 "${URL}" 2>/dev/null &
rotdash $!
case $? in
0) echo -e "\033[00;32mOK \033[00m"; cx=0;;
1) echo -e "\033[00;31mFail\033[00;33m!\033[00m"; cx=1; f_line; exit 1;;
esac
}
##******************************************************************************************************************
##******************************************************************************************************************

f_resolve_url() {
url=$1
domain=`echo $url | sed 's-^[^/]*/*\([^/]*\)/\?.*$-\1-'`
ipaddr=`ping -c 1 $domain | sed -n 's@^.*(\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*$@\1@p' | head -1`
req_url=`echo $url | sed "s-/[^/]\+-/$ipaddr-"`
wget $req_url
}

##******************************************************************************************************************

#WGET="$(which wget)"
WGET="$(which busybox) wget"

if [ -z "$1" ]; then
echo -e "\033[00;31m No download specified\033[01;30m."
echo -e "\033[00;33m Exiting\033[01;30m..."
sleep 3
exit 1
else
if [ -z "$2" ]; then
DIR="."
URL="$1"
else
DIR="$1"
if [ ! -d "${DIR}" ]; then
echo -e "\033[00;31m Directory does not exist\033[01;30m:"
echo -e "\033[01;34m ${DIR}/"
echo -e "\033[00;33m Exiting\033[01;30m..."
sleep 3
exit 1
fi
URL="$2"
fi
fi

linebold=1
linecolor=0
line="="
f_line

f_chkconn

echo -e "\033[00;35m Downloading to\033[01;30m:"
echo -e "\033[00;34m ${DIR}/\033[00;33m${URL##*/}"
line="-"
f_line

if [ -f ${DIR}/${URL##*/} ]; then
echo -e "\033[00;35m Continuing download\033[01;30m..."
else
echo -e "\033[00;35m Starting download\033[01;30m..."
fi

##******************************************************************************************************************

echo -ne "\033]0;Wget: ${URL##*/}\007"

RETRYNUM=0
while true; do
RETRYNUM=$((RETRYNUM+1))
###xterm -title "Wget: ${URL}" -e $(which busybox) wget -P ${DIR} -c ${URL}
echo -ne "\033[00;32m"
#${WGET} -P ${DIR} -c ${URL} && (echo -e "\n\033[00;33m DONE.") ; break || (echo -e "\033[00;31mERROR\033[01;30m = \033[00;33m$?\n\n\033[00;35mRetrying...\033[00m" ; sleep 2)
${WGET} -P ${DIR} -c ${URL}
EL=$?
case $EL in
0)
echo -e "\n\033[00;33m DONE. Press any key to exit."
line="="
f_line
break
;;
*)
echo -e "\033[00;31m ERROR\033[01;30m = \033[00;33m${EL}"
linebold=0
linecolor=1
line="-"
f_line
linebold=1
linecolor=0
echo -ne "\033[00;35m Waiting 5 seconds\033[01;30m... \033[00;33m"
sleep 5 &
rotdash $!
echo -e "\033[00;35mRetrying\033[01;30m (\033[00;35m#${RETRYNUM}\033[01;30m)\033[00m"
;;
esac
done

read junk

echo -e "\033[00m"


Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #8 on: January 05, 2015, 04:31:05 PM »
For now I know it works flawlessly at ~2Mbit/s. I'll go watching some youtube with firefox-official. (;

I take that as the script is working as intended..  :)

ok extension submitted ( named it  "firefox-latest.tcz" )

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #9 on: January 07, 2015, 06:36:42 PM »
I just noticed that Firefox v35.0 is soon to be released..    Unfortunately the download links and release page hasn't been updated yet..

The update script probably will not auto detect an update until 35.0.1 or higher is released :(



Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #10 on: January 17, 2015, 11:24:06 PM »
**Update**

Get Latest Firefox script now updated to support cloud mode install (issue found and fixed while testing on TinyCorePure64.ISO/CD boot )
and fixed Firefox major version update detection
eg: firefox v34.0.05 to v35.0 now properly detected.

new script attached and updated extension submitted

« Last Edit: January 17, 2015, 11:26:55 PM by coreplayer2 »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 1734
Re: Firefox - Script to install the latest version - soon to be extension
« Reply #11 on: January 26, 2015, 09:48:32 PM »
firefox-latest.tcz (extension) installs (or updates firefox-official to) latest version 35.0.1