LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Latest-firefox ruari's script broken due change Firefox download site (https://www.linuxquestions.org/questions/slackware-14/latest-firefox-ruaris-script-broken-due-change-firefox-download-site-4175559470/)

neymac 11-20-2015 07:12 PM

Latest-firefox ruari's script broken due change Firefox download site
 
Firefox changed the site where the latest firefox is and the script latest-firefox developed by Ruari Oedegaard shows "Could not work out the latest version".

README.txt (from firefox):
Quote:

Please use download.mozilla.org to retrieve the latest Firefox release.

For example, if you wish to download the US English installer for Windows (32bit)
the url is
https://download.mozilla.org/?produc...win&lang=en-US

This could be pasted into the location bar of a browser, or used with curl or wget, e.g.
wget -O FirefoxSetup.exe "https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US"

For other operating systems replace 'os=win' with:
Windows 64bit os=win64
OS X os=osx
Linux x86_64 os=linux64
Linux i686 os=linux

For other languages replace 'lang=en-US' with:
Acholi lang=ach
Afrikaans lang=af
Albanian lang=sq
Arabic lang=ar
....

speck 11-21-2015 03:04 PM

I did a quick three line fix that seems to work on my 14.1 64 bit system, you can try replacing the following lines.

Code:

70c70
< VERSION=${VERSION:-$(wget -qO- http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$FFCHANNEL/linux-$ARCH/$FFLANG/ | sed -nr 's|.*>firefox-(.*)\.tar\.bz2</a>.*|\1|p')}
---
> VERSION=${VERSION:-$(curl -s "https://download.mozilla.org/?product=firefox-${FFCHANNEL}&os=linux${LIBDIRSUFFIX}&lang=${FFLANG}" | awk -F/ '{print $7}')}
101c101
< FIREFOXPKG=http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$VERSION/linux-$ARCH/$FFLANG/firefox-$VERSION.tar.bz2
---
> FIREFOXPKG="https://download.mozilla.org/?product=firefox-${FFCHANNEL}&os=linux${LIBDIRSUFFIX}&lang=${FFLANG}"
165c165
<  wget -P "$REPACKDIR/src" $FIREFOXPKG
---
>  wget -O "$REPACKDIR/src/firefox-$VERSION.tar.bz2" $FIREFOXPKG


lukameen 11-21-2015 04:51 PM

Thanks, speck. That fix worked for me too.

hitest 11-21-2015 05:59 PM

neymac,

Perhaps you could send a PM to ruario and let him know? He does excellent work for our community.

neymac 11-21-2015 06:58 PM

Quote:

Originally Posted by hitest (Post 5453377)
neymac,

Perhaps you could send a PM to ruario and let him know? He does excellent work for our community.

I know he does indeed. I don't know how to send private message to Ruario, I don't have his address.

@speck:> Thanks for the fix, it worked fine.

glorsplitz 11-21-2015 08:23 PM

Quote:

Originally Posted by hitest (Post 5453377)
neymac,

Perhaps you could send a PM to ruario and let him know? He does excellent work for our community.

I tried to PM him this thread. Thanks speck.

ruario 11-23-2015 05:03 AM

Hi, sorry I missed all this and have not been using Firefox much for the last few months so did not encounter the problem myself. Thanks in particular to speck for quickly posting a working fix and glorsplitz fr pinging me.

I have updated the Gist on GitHub. I went with a slight variation from speck as I want the script to handle ESR and would prefer only use one download utilityŚWget or cURL are both fine but I would prefer the script was reliant on only one of them.

Code:

2c2
< # latest-firefox Version 1.2
---
> # latest-firefox Version 1.3
61c61
<  FFCHANNEL=latest-esr
---
>  FFCHANNEL=esr-latest
70c70
< VERSION=${VERSION:-$(wget -qO- http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$FFCHANNEL/linux-$ARCH/$FFLANG/ | sed -nr 's|.*>firefox-(.*)\.tar\.bz2</a>.*|\1|p')}
---
> VERSION=${VERSION:-$(wget --spider --max-redirect 0 "https://download.mozilla.org/?product=firefox-${FFCHANNEL}&os=linux${LIBDIRSUFFIX}&lang=${FFLANG}" 2>&1 | sed -n '/^Location:/s/.*\/firefox-\(.*\)\.tar\.[bx]z2\{0,1\} .*/\1/p')}
101c101
< FIREFOXPKG=http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$VERSION/linux-$ARCH/$FFLANG/firefox-$VERSION.tar.bz2
---
> FIREFOXPKG="https://download.mozilla.org/?product=firefox-${FFCHANNEL}&os=linux${LIBDIRSUFFIX}&lang=${FFLANG}"
165c165
<  wget -P "$REPACKDIR/src" $FIREFOXPKG
---
>  wget --trust-server-names -P "$REPACKDIR/src" $FIREFOXPKG


ruario 11-23-2015 05:12 AM

One annoying thing with using a URL that is constructed with the download.mozilla.org download links is that you can't just redefine the variable VERSION to fetch an old package any more. You would need to download the package first and place it in the directory you are running the script from, in addition to redefining that variable. I'm sure that is fixable but I am not sure I can be bothered right now. Maybe when I get bored!

ruario 11-23-2015 05:44 AM

Quote:

Originally Posted by ruario (Post 5453907)
One annoying thing with using a URL that is constructed with the download.mozilla.org download links is that you can't just redefine the variable VERSION to fetch an old package any more. You would need to download the package first and place it in the directory you are running the script from, in addition to redefining that variable. I'm sure that is fixable but I am not sure I can be bothered right now. Maybe when I get bored!

Ok, actually that is easily handled. Another update. The key bit being:

Code:

< FIREFOXPKG="https://download.mozilla.org/?product=firefox-${FFCHANNEL}&os=linux${LIBDIRSUFFIX}&lang=${FFLANG}"
---
> FIREFOXPKG=http://download.cdn.mozilla.net/pub/firefox/releases/$VERSION/linux-$ARCH/$FFLANG/firefox-$VERSION.tar.bz2


ruario 11-23-2015 06:19 AM

Quote:

Originally Posted by ruario (Post 5453907)
One annoying thing with using a URL that is constructed with the download.mozilla.org download links is that you can't just redefine the variable VERSION to fetch an old package any more.

I was wrong, you can but I need to use product=firefox-${VERSION} and not product=firefox-${FFCHANNEL} for the download link. So another edit to go back to using download.mozilla.org/? for FIREFOXPKG, as it is more likely to result in a secure (https) download and yet you can still download a specific version.

speck 11-23-2015 11:40 AM

Thanks Ruari, I've switched back to your official version.

neymac 11-23-2015 05:47 PM

Thanks Ruari.:)

PS: By the way, after read the latest-firefox script I saw that you are now working on Vivaldi and I tried the beta version of the vivaldi browser. It is very fast, when will we have a "latest-vivaldi" script for slackware?;)


All times are GMT -5. The time now is 12:10 AM.