Created
September 7, 2016 07:23
-
-
Save seraphyn/6d5281ad4a37680c526d520a21b520b1 to your computer and use it in GitHub Desktop.
Automatic update for the editor atom
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
#!/bin/bash | |
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest | |
MATCHEDROW=$(awk -F '[<>]' '/href=".*atom-amd64.deb/' /tmp/latest) | |
LATEST=$(echo $MATCHEDROW | grep -o -P '(?<=href=").*(?=" rel)') | |
VER_LATEST=$(echo $MATCHEDROW | rev | cut -d"/" -f 2 | rev | sed 's/v//g') | |
VER_INST=$(dpkg -l atom | tail -n1 | tr -s ' ' | cut -d" " -f 3) | |
if [ "$VER_LATEST" != "$VER_INST" ]; then | |
wget --progress=bar -q "https://github.com/$LATEST" -O /tmp/atom-amd64.deb --show-progress | |
dpkg -i /tmp/atom-amd64.deb | |
echo "Atom has been update from $VER_LATEST to $VER_INST" | |
logger -t atom-update "Atom has been update from $VER_LATEST to $VER_INST" | |
else | |
echo "Atom version $VER_INST is the latest version, no update require" | |
logger -t atom-update "Atom version $VER_INST is the latest version, no update require" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment