0

How Could I download the latest version of firefox via the command line and insert into a script

I have tried wget https://download.mozilla.org/?product=firefox-38.0.1-SSL&os=linux64&lang=en-US

I copied the link location from the download button at https://www.mozilla.org/en-US/firefox/new/

But this wget command has just generate a useless index.html?product=firefox-38.0.1-SSL file most likely because of no escape characters, but either way this command is restrained to the static 38 version and not universal as say

wget http://wordpress.org/latest.tar.gz

or with curl via curl -O https://wordpress.org/latest.tar.gz

Or is this just not possible as firefox does not provide a latest tar link? Are there any efficient workarounds?

I do use apt-get install firefox as well, however the apt repository does not appear to contain the most up to date firefox

phillipsK
  • 1,466
  • 5
  • 29
  • 43

3 Answers3

5

Use wget with --content-disposition key and enclose a link in quotes.

Example:

wget --content-disposition "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US"

Double quoted needed here to escape a special character & in URL. Otherwise we lose the parameters from URL.

Sergey
  • 879
  • 1
  • 11
  • 16
  • Double quoted needed here to escape a special character `&` in URL. Otherwise we lose the parameters from URL. – Sergey Apr 26 '18 at 13:15
  • 1
    Thanks, but it is preferable that you put this information into your answer so that readers can better understand why the answer is useful. There is an edit button just below the answer text. Thanks. – Stephen Rauch Apr 26 '18 at 13:17
2

You may try this code:

wget --recursive --no-parent --no-host-directories --cut-dirs=6 --accept bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest/linux-x86_64/en-US/
maniak26
  • 21
  • 4
1

TLDR:

wget -O FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"

On the old Mozilla FTP directory, it includes an instruction on how to download with wget. I have included it below:

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/?product=firefox-latest&os=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
   Aragonese                  lang=an
   Armenian                   lang=hy-AM
   Assamese                   lang=as
   Asturian                   lang=ast
   Azerbaijani                lang=az
   Basque                     lang=eu
   Belarusian                 lang=be
   Bengali (Bangladesh)       lang=bn-BD
   Bengali (India)            lang=bn-IN
   Bosnian                    lang=bs
   Breton                     lang=br
   Bulgarian                  lang=bg
   Catalan                    lang=ca
   Chinese (Simplified)       lang=zh-CN
   Chinese (Traditional)      lang=zh-TW
   Croatian                   lang=hr
   Czech                      lang=cs
   Danish                     lang=da
   Dutch                      lang=nl
   English (British)          lang=en-GB
   English (South African)    lang=en-ZA
   Esperanto                  lang=eo
   Estonian                   lang=et
   Finnish                    lang=fi
   French                     lang=fr
   Frisian                    lang=fy-NL
   Fulah                      lang=ff
   Gaelic (Scotland)          lang=gd
   Galician                   lang=gl
   German                     lang=de
   Greek                      lang=el
   Gujarati (India)           lang=gu-IN
   Hebrew                     lang=he
   Hindi (India)              lang=hi-IN
   Hungarian                  lang=hu
   Icelandic                  lang=is
   Indonesian                 lang=id
   Irish                      lang=ga-IE
   Italian                    lang=it
   Kannada                    lang=kn
   Kazakh                     lang=kk
   Khmer                      lang=km
   Korean                     lang=ko
   Latvian                    lang=lv
   Ligurian                   lang=lij
   Lithuanian                 lang=lt
   Lower Sorbian              lang=dsb
   Macedonian                 lang=mk
   Maithili                   lang=mai
   Malay                      lang=ms
   Malayalam                  lang=ml
   Marathi                    lang=mr
   Norwegian (Bokmål)        lang=nb-NO
   Norwegian (Nynorsk)        lang=nn-NO
   Oriya                      lang=or
   Persian                    lang=fa
   Polish                     lang=pl
   Portuguese (Brazilian)     lang=pt-BR
   Portuguese (Portugal)      lang=pt-PT
   Punjabi (India)            lang=pa-IN
   Romanian                   lang=ro
   Romansh                    lang=rm
   Russian                    lang=ru
   Serbian                    lang=sr
   Sinhala                    lang=si
   Slovak                     lang=sk
   Slovenian                  lang=sl
   Songhai                    lang=son
   Spanish (Argentina)        lang=es-AR
   Spanish (Chile)            lang=es-CL
   Spanish (Mexico)           lang=es-MX
   Spanish (Spain)            lang=es-ES
   Swedish                    lang=sv-SE
   Tamil                      lang=ta
   Telugu                     lang=te
   Thai                       lang=th
   Turkish                    lang=tr
   Ukrainian                  lang=uk
   Upper Sorbian              lang=hsb
   Uzbek                      lang=uz
   Vietnamese                 lang=vi
   Welsh                      lang=cy
   Xhosa                      lang=xh


Mozilla Release Engineering
Email: release-engineering@lists.mozilla.org
Web:   https://groups.google.com/forum/#!forum/mozilla.release.engineering
``