Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
atom-beta-update.sh: download & install in openSUSE the latest Beta version of Atom from GitHub
#!/bin/bash
# atom-beta-update.sh: download the latest Beta version of Atom from
# GitHub: https://atom.io/beta
# Copyright © 2016 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
set -e
set -u
TMP_DIR="/root/.atom-releases"
github_server="https://github.com"
github_releases="https://github.com/atom/atom/releases"
last_release="$(wget -o /dev/null -O - ${github_releases} | \
grep -E '.*releases.*download.*beta.*x86_64.rpm.*' | \
sed 's/^.*ref="//' | \
sed 's/x86_64.rpm.*$/x86_64.rpm/' | \
grep -E 'atom.x86_64.rpm$' | \
head -1)"
mkdir -p $TMP_DIR
cd $TMP_DIR
chown -R root:root .
rm -f atom.x86_64.rpm wget.log
if [ -z "${last_release}" ]; then
echo
echo " => Error, last Atom Beta release could not be determinated."
echo " ... Are you connected to the Internet?"
echo " ... Is there a file named atom.x86_64.rpm availabled at ${github_releases}?"
echo
exit 1
fi
echo
echo " => Downloading ${github_server}/${last_release}"
echo " as ${TMP_DIR}/atom.x86_64.rpm"
echo
sleep 3
wget "${github_server}/${last_release}" -O atom.x86_64.rpm -o - | tee wget.log
echo
echo " => Installing ${TMP_DIR}/atom.x86_64.rpm"
echo
zypper install atom.x86_64.rpm
@Fred-Barclay

This comment has been minimized.

Copy link

Fred-Barclay commented Apr 20, 2016

Great code. 👍 I've revised it for Debian here: https://github.com/Fred-Barclay/AtomUpdates
Thanks!

Edit: and Fedora/CentOS/openSUSE as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.