Ubuntu – How to obtain the latest .deb package of Vivalvi browser


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"


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.

Best Answer

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:

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.

Related Question