Last active
March 16, 2016 13:03
-
-
Save FrankDeGroot/83ce21a2c22b79289f1c to your computer and use it in GitHub Desktop.
Get latest atom
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 | |
| # based on http://askubuntu.com/questions/589469/how-to-automatically-update-atom-editor | |
| if [ -e /usr/share/atom ] | |
| then | |
| CURRENT=$(/usr/share/atom/atom --version) | |
| echo "Atom $CURRENT is installed." | |
| else | |
| echo "Atom not installed." | |
| fi | |
| echo "Finding latest..." | |
| LATEST_URL=$(wget -qO- https://github.com/atom/atom/releases/latest | awk -F '[<>]' '/href=".*atom-amd64.deb/ {match($0,"href=\"(.*.deb)\"",a); print "https://github.com/" a[1]}') | |
| LATEST=$(echo $LATEST_URL | awk '/.*/ {match($0,"v([^/]+)",a); print a[1]}') | |
| if [ "$CURRENT" = "$LATEST" ] | |
| then | |
| echo "Atom $CURRENT is latest." | |
| exit | |
| fi | |
| echo "Getting $LATEST ($LATEST_URL)..." | |
| wget -O /tmp/atom-amd64.deb $LATEST_URL | |
| echo "Installing package..." | |
| sudo dpkg -i /tmp/atom-amd64.deb | |
| echo "Cleaning up..." | |
| rm /tmp/atom-amd64.deb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment