Last active
June 14, 2016 05:50
-
-
Save nihilismus/2d9a8e639b205369650c37c646ffcc5c to your computer and use it in GitHub Desktop.
atom-beta-update.sh: download & install in openSUSE the latest Beta version of Atom from GitHub
This file contains hidden or 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 | |
# atom-beta-update.sh: download the latest Beta version of Atom from | |
# GitHub: https://atom.io/beta | |
# Copyright © 2016 Antonio Hernández Blas <[email protected]> | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great code. 👍 I've revised it for Debian here: https://github.com/Fred-Barclay/AtomUpdates
Thanks!
Edit: and Fedora/CentOS/openSUSE as well