Skip to content

Instantly share code, notes, and snippets.

@olegantonyan
Created May 2, 2016 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olegantonyan/0279c07a47094afa704a572647578700 to your computer and use it in GitHub Desktop.
Save olegantonyan/0279c07a47094afa704a572647578700 to your computer and use it in GitHub Desktop.
Linux RPM check Atom update
#!/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