Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active December 24, 2017 00:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruario/a428b54433f006569b95 to your computer and use it in GitHub Desktop.
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
#!/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