-1

How to download the latest .deb of Vivaldi browser using wget generic command (with the help of wildcards)? Vivaldi can't be downloaded without entering the exact name and number of the latest build. For example,

wget https://downloads.vivaldi.com/stable/vivaldi-stable_3.5.2115.81-1_amd64.deb

What I want is something easy like in the case of firefox and google-chrome, where

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

and

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

are working very well, downloading the latest versions of these browsers without the need to specify the exact name and build number, unlike in the case of Vivaldi. I want to have a script that downloads this browser(Vivaldi) anytime without my intervention to update/change it.

Kulfy
  • 17,696
msf
  • 13
  • 1
    Use MATE Software Boutique. Do not invent bicycles. – N0rbert Dec 28 '20 at 06:50
  • I don't want to install anything ,I just want to download the .debs of these browsers.For Vivaldi i even tried to replace this group of numbers, " 3.5.2115.81-1 " with " * " ,to be kind of generic command but it didn't work.Maybe is there another symbol to mask/replace those numbers? – msf Dec 28 '20 at 07:52
  • Possible duplicate of https://unix.stackexchange.com/questions/117988/wget-with-wildcards-in-http-downloads – Archisman Panigrahi Dec 28 '20 at 08:05
  • Vivaldi shows ERROR 403: Forbidden when a wildcard is used.

    wget -r --no-parent -A 'vivaldi-stable_*.deb' https://downloads.vivaldi.com/stable/

    There's nothing you can do.

    – Archisman Panigrahi Dec 28 '20 at 08:09

2 Answers2

1

OK, let me parse JSON from Ubuntu MATE Software Boutique for you.

Browser Repository install command
Vivaldi http://repo.vivaldi.com/archive/deb/ wget https://repo.vivaldi.com/archive/deb/pool/main/vivaldi-stable_3.5.2115.81-1_amd64.deb && sudo apt-get update && sudo apt-get install -y ./vivaldi-stable_3.5.2115.81-1_amd64.deb
Opera https://deb.opera.com/opera-stable/ wget https://deb.opera.com/opera-stable/pool/non-free/o/opera-stable/opera-stable_73.0.3856.284_amd64.deb && sudo apt-get update && sudo apt-get install -y ./opera-stable_73.0.3856.284_amd64.deb
Firefox https://packages.ubuntu.com/focal-updates/firefox sudo apt-get update && sudo apt-get install firefox
Chrome http://dl.google.com/linux/chrome/deb/ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo apt-get update && sudo apt-get install ./google-chrome-stable_current_amd64.deb

But this solution is not universal.

More universal solution is to add repositories to the system and then install packages from them:

  • Vivaldi

    cd /tmp
    wget http://repo.vivaldi.com/stable/linux_signing_key.pub
    sudo apt-key add linux_signing_key.pub
    sudo add-apt-repository "deb http://repo.vivaldi.com/archive/deb/ stable main"
    sudo apt-get update
    sudo apt-get install vivaldi-stable
    
  • Opera

    cd /tmp
    wget https://deb.opera.com/archive.key
    sudo apt-key add archive.key
    sudo add-apt-repository "deb https://deb.opera.com/opera-stable/ stable non-free"
    sudo apt-get update
    sudo apt-get install opera-stable
    
  • Firefox

    sudo apt-get update
    sudo apt-get install firefox
    
  • Chrome

    cd /tmp
    wget http://dl.google.com/linux/linux_signing_key.pub
    sudo apt-key add linux_signing_key.pub
    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 78BD65473CB3BD13
    sudo add-apt-repository "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
    sudo apt-get update
    sudo apt-get install google-chrome-stable
    

and as the result all these packages will have automatic updates (by unattended upgrades) or manual updates by sudo apt-get update && sudo apt-get upgrade.

N0rbert
  • 99,918
  • Thank you all.The thing is I don't want to install these browsers ,I download ,unarchive and use them in portable way.Until now it is working very well with firefox and google-chrome .I wanted to experiment also with vivaldi and opera too ,in the same way (using scripts in terminal ) ,but seems imposible with the " Italian composer ".For opera I found this " wget -Oopera.deb 'www.opera.com/download/get/?id=35889&location=360¬hanks=yes&sub=marine' " ,but I don't know from where is this url because if you go to the official page of opera ,you will get another adress of the .deb. – msf Dec 28 '20 at 09:58
  • You can use apt to just download package. Rest of procedure is same as in this answer – LuxZg Jan 03 '21 at 15:37
  • apt-get download will download the package, but not its dependencies, to the current directory. apt-get -d install will download the given package and all missing dependencies to the system packages directory – LuxZg Jan 03 '21 at 16:16
  • @N0rbert I managed to make it work combining your and@ LuxZg's method after importing gpg keys(forgot to do this at the beginning and had constant error message).But to download the deb it needs to type the root pass. – msf Jan 03 '21 at 22:30
1

On Debian based systems where APT tool is available, you can download deb packages without installing them by replacing apt-get install with apt-get download in N0rbert's answer. However, since you still want to use wget and avoid APT, you need to first understand, Vivaldi, doesn't name their latest release like Firefox and Google Chrome do. Firefox and Google Chrome generally makes latest/current point to the latest release which Vivaldi don't follow. It just adds the version number in the deb package name.

Since, Vivaldi maintains a file known as Packages which contains information about the builds currently available in the repository for a particular architecture (see How to see all packages in a package repository? Website or command line?). It generally has a stable build and a snapshot. As of now snapshot's information is placed at top. Might confirm later whether the information placement is random or fixed.

A simple bash script would look like this:

#!/bin/bash
wget https://repo.vivaldi.com/archive/deb/dists/stable/main/binary-amd64/Packages
ver=$(tac Packages| grep -m1 Version | cut -d " " -f2)
wget https://repo.vivaldi.com/archive/deb/pool/main/vivaldi-stable_"$ver"_amd64.deb
rm Packages

Some explanation: First downloaded the Packages file. Extracted the latest version string and stored in ver variable. Since the stable's information is stored at bottom of the file, tac was used to reverse the rows. Used grep to extract the "version". And to limit results -m flag was used. Since the result is like "Version: VersionNumber", used cut with -f flag to get second field, i.e., VersionNumber. Since debs are in /pool, used wget and value of ver to get the latest build from there. Finally removed Packages file.

If you're using some other architecture you can use that instead of amd64, for example, i386. I assumed that there was no file with name as Packages already existing in the current working directory. You might like to create a new folder specially for this and delete it later from the script itself. Alternatively, you can use -O option from wget.

Kulfy
  • 17,696
  • Kulfy ,I owe you the most of my gratitude ,because I loved the pure scripting way of solving this ".deb browser" ache of mine.It works sooooo nice.To vivaldi and as a bonus to opera-stable too.Now could I dare to ask you something more?How to extend your script to opera-developer ,which is on 3rd row(middle row) out of 5 rows in Package file.So cat/tac doesn't work anymore.Tried ed , sed , awk ,but becomes too complicated and exceeds my (in)competence in scripting. – msf Jan 03 '21 at 22:50
  • I think I got it to work: ' #!/bin/bash -x wget https://deb.opera.com/opera-stable/dists/stable/non-free/binary-amd64/Packages ver=$(awk '/opera-developer/{c=0};(c!=""&&c++==1)' Packages| grep -m1 Version | cut -d " " -f2) wget https://deb.opera.com/opera-stable/pool/non-free/o/opera-developer/opera-developer_"$ver"_amd64.deb rm Packages ' .Man I'm struggeling with comment text formatting. – msf Jan 03 '21 at 23:20
  • @msf Instead of awk and even tac, you can use grep and sed to make it universal. For example, if you know the placement of information, like opera-developer is placed at 3rd position, you can use grep "Version" Packages | sed '3q;d' | cut -d" " -f2. Replace 3 with the required number. – Kulfy Jan 04 '21 at 12:18