Last active
December 24, 2017 00:31
-
-
Save ruario/a428b54433f006569b95 to your computer and use it in GitHub Desktop.
Fetches the latest Vivaldi Linux rpm or deb package listed on the team blog
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/sh | |
case ${ARCH:-$(uname -m)} in | |
x86_64) DEBARCH=amd64; ARCH=x86_64 ;; | |
i?86) DEBARCH=i386; ARCH=i386 ;; | |
*) echo "Your architecture is not supported!" >&2; exit 1 ;; | |
esac | |
if [ "$1" = "-d" ]; then | |
PKGTYPE=deb | |
ARCH=$DEBARCH | |
shift 1 | |
elif [ "$1" = "-r" ]; then | |
PKGTYPE=rpm | |
shift 1 | |
else | |
if [ -x "/usr/bin/dpkg" ]; then | |
PKGTYPE=deb | |
ARCH=$DEBARCH | |
else | |
PKGTYPE=rpm | |
fi | |
fi | |
for PKG in $(curl -Ls 'https://vivaldi.net/blogs/teamblog?format=feed&type=rss' | sed -n "s/.*\/snapshot\/\(vivaldi-snapshot[_-]\(\([0-9]\+\.\)\)\{3\}[0-9]\+[_-][0-9]\+[_\.]$ARCH.$PKGTYPE\).*/\1/p" | head -n ${1:-1}); do | |
if [ -e "$PKG" ]; then | |
echo "$PKG is the latest version and it is already present" >&2 | |
else | |
echo "Fetching $PKG" | |
curl -O "https://downloads.vivaldi.com/snapshot/$PKG" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment