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 :)


  • Vivaldi Translator

    Mehh... creative approach deserve point. Especially if you thought/tweak it your self.



  • @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...


  • Vivaldi Translator

    @zhangdl
    Vivaldi setup always put the repo sources.list or something like your sample, plus Vivaldi keyring.

    Obviously, Debian & RedHat source list style are different in form. Yours there for RPM.

    For RPM, it seem there's sometime a miss for this registering/installing source list. I don't know, I don't use RPM based distro since 1999.

    The repo? It's Vivaldi server it self, http://repo.vivaldi.com/*
    Like in your sample.

    Debian, Ubuntu & all their children & grandchildren use *.deb package.
    RedHat, Fedora, all RPM based & all their children & grandchildren use *.rpm package.
    Some other distro re-pack them & put it in their community repo or somewhere. I think Linux/Arch does this.



  • @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?


  • Vivaldi Translator

    @zhangdl said in Unattended installation script for Fedora/Mandriva/OpenSUSE/etc:

    etc/apt/source.list.d/vivaldi.list

    Check if the deb source list not commented out.
    deb http://repo.vivaldi.com/stable/deb/ stable main

    /etc/apt/source.list.d/vivaldi.list.distUpgrade

    It's Debian APT install way to put new file but it detect the target (older) file in this case vivaldi.list above had been change from default.

    But I can't get the new version (1.8)

    What is your current Vivaldi version?

    /etc/cron.daily/vivaldi

    That just a script mainly re-check/re-register Vivaldi repo & repo key daily. Plus handle some other little maintanance stuff.

    Sample of correct vivaldi.list entry:

    ### THIS FILE IS AUTOMATICALLY CONFIGURED ###
    # You may comment out this entry, but any other modifications may be lost.
    deb http://repo.vivaldi.com/stable/deb/ stable main
    


  • @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...


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.