Unattended installation script for Fedora/Mandriva/OpenSUSE/etc
-
Since Vivaldi is now a part of my 'essentials' toolkit I wanted a way of installing it unattended. I couldn't find anything else out there so I'm sharing a simplified version of my setup script in case anyone else has the same itch and finds this useful.
#!/bin/bash if [ "$(id -u)" != "0" ]; then echo "This script must be run as root. Try sudo ./install_vivaldi.sh" exit 1 fi latestVivaldiRpmUrl() { echo $(curl -sL "https://vivaldi.com/download" | grep "https.*vivaldi-stable-.*.x86_64.rpm" | cut -d '"' -f 4) } latestVivaldiVersion() { echo $(curl -sL "https://vivaldi.com/download" | grep -E "https.*vivaldi-stable-.*.x86_64.rpm" | cut -d '"' -f 4 | cut -d '/' -f 5 | cut -d '-' -f 3 ) } echo "Checking installed vs latest Vivaldi versions" INSTALLEDVERSION=$(installedVersion "vivaldi-stable") LATESTVERSION=$(latestVivaldiVersion) if [ "$INSTALLEDVERSION" == "$LATESTVERSION" ]; then echo "Latest version $LATESTVERSION already installed" exit 0 fi if [ "$INSTALLEDVERSION" == "" ]; then echo "No previous Vivaldi installation detected; installing $LATESTVERSION" else echo "Outdated version $INSTALLEDVERSION installed; updating to $LATESTVERSION" fi DOWNLOADURL=$(latestVivaldiRpmUrl) INSTALLER="$(mktemp -u).vivaldi.rpm" echo "Downloading from $DOWNLOADURL to $INSTALLER" curl -L "$(latestVivaldiRpmUrl)" -o "$INSTALLER" dnf install -y "$INSTALLER"
Shared as a gist here: https://gist.github.com/nathanchere/c5d1d1d40f7b3288521513dd6409df9d
Single-command install for those that need the hand holding:
curl -S https://gist.github.com/nathanchere/c5d1d1d40f7b3288521513dd6409df9d | sudo bash
-
For some reason every time I try to edit this post it insists it was "flagged as spam" (wtf?) so a shorter way:
curl -S https://git.io/vyj3P | sudo bash
As always, check what you're downloading first before executing anything behind a URL shortener (especially as root).
-
en... a naive question: why don't you just use yum?
-
I could only find vivaldi in a 'fdzh' repository and there are several reasons why I'd prefer a direct download to adding additional package sources to dnf/yum. Of course feel free to do it that way if you prefer
-
@nathanchere I don't remember where I got a yum repo for my centos:
[vivaldi] name=vivaldi baseurl=http://repo.vivaldi.com/archive/rpm/x86_64 enabled=1 gpgcheck=1 gpgkey=http://repo.vivaldi.com/archive/linux_signing_key.pub
I hope it's not a fake one....
I never succeed in finding an official repo for Ubuntu. So I still have an outdated version there... Anyone knows one?
I think vivaldi should provide a page for repo setup, or make it more visible if there is already one, instead of just an eye-catching "download" button/link.
Add one more: downloading by yourself means that you will take care of the dependence, though which usually is not a problem...
-
@dLeon on my Unbuntu, there are entries /etc/apt/source.list.d/vivaldi.list and /etc/apt/source.list.d/vivaldi.list.distUpgrade from vivaldi-stable package. But I can't get the new version (1.8) by
sudo apt-get update; sudo apt-get dist-upgrade
. Any idea why it does not work? Thanks.BTW, there is also a file: /etc/cron.daily/vivaldi. Is vivaldi checking the update by itself instead of the system software manager?
-
@dLeon Thanks. So it's because the vivaldi repo is not on by default. It works after uncommenting the list in
/etc/apt/source.list.d/vivaldi.list
.It's a bit unexpected, but probably make some sense: someone maybe just want to stay with what they downloaded. Those who want to stay always with the latest/best should do some extrawork...
-
-