Created
March 22, 2017 14:37
-
-
Save nathanchere/c5d1d1d40f7b3288521513dd6409df9d to your computer and use it in GitHub Desktop.
Install Vivaldi browser (latest) on RPM-based Linux distros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment