Created
March 31, 2019 15:38
-
-
Save Ishidres/ded955250c6061d359e25da6abe1fbbc to your computer and use it in GitHub Desktop.
Automatically updates Atom by downloading the latest version and replacing the currently installed version with it.
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
# Usage: | |
# $ chmod +x update_atom.sh | |
# $ ./update_atom.sh | |
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c | |
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | | |
grep '"tag_name":' | | |
sed -E 's/.*"([^"]+)".*/\1/' | |
} | |
notify-send "Updating Atom..." | |
pkill -9 atom | |
latestVersion=$(get_latest_release "atom/atom") | |
wget "https://github.com/atom/atom/releases/download/$latestVersion/atom-amd64.tar.gz" | |
# remove currently installed version of Atom and replace it with the new downloaded one | |
rm -r atom-*-amd64 | |
tar -xf "atom-amd64.tar.gz" | |
rm "atom-amd64.tar.gz" | |
notify-send "Updating Atom to latest version has finished." | |
# remove v from version number: v1.5.0 -> 1.5.0 | |
latestVersion="${latestVersion:1}" | |
cd "./atom-$latestVersion-amd64" | |
./atom & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment