Created
May 2, 2016 09:07
-
-
Save olegantonyan/0279c07a47094afa704a572647578700 to your computer and use it in GitHub Desktop.
Linux RPM check Atom update
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/sh | |
NOTIFY_USER=oleg # optional, for kdialog | |
USER_DISPLAY=:0 # optional, for kdialog | |
LOCATION=`curl -I https://github.com/atom/atom/releases/latest | perl -n -e '/^Location: (.*)$/ && print "$1"'` | |
VERSION=`basename $LOCATION | perl -n -e '/(\d+.\d+.\d+)/ && print "$1"'` | |
echo "available version: $VERSION" | |
INSTALLED=`rpm -q atom | perl -n -e '/atom-(.*?)-/ && print "$1"'` | |
echo "installed version: $INSTALLED" | |
if [ "$INSTALLED" != "$VERSION" ]; then | |
echo "version $VERSION available" | |
sudo -u $NOTIFY_USER DISPLAY=$USER_DISPLAY kdialog --title "Atom update" --passivepopup "$VERSION is available ($INSTALLED installed) <a href=$LOCATION>download</a>" 10 # optional | |
exit 0 | |
else | |
exit 126 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment