Skip to content

Instantly share code, notes, and snippets.

Last active September 1, 2016 07:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Atom auto-update script for Debian/Ubuntu Linux
if [ $EUID != 0 ]; then
echo "You must be root to run this script" 1>&2
exit 1
NEW_RELEASE=$(curl -sL $URL_RELEASES | egrep -o 'href="([^"#]+)atom-amd64.deb"' | cut -d'"' -f2 | sort | uniq)
NEW_VERSION=$(echo $NEW_RELEASE | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
CURRENT_VERSION=$(atom --version | fgrep Atom | awk '{print $3}')
if [[ -z "$NEW_VERSION" ]]; then
echo "New version could not be detected from $URL_RELEASES"
elif [[ $NEW_VERSION == $CURRENT_VERSION ]]; then
echo "Current version $CURRENT_VERSION is the latest available"
echo "Current version $CURRENT_VERSION is not the latest available $NEW_VERSION -> Updating ..."
wget --progress=bar -q "$NEW_RELEASE" -O /tmp/atom-amd64.deb -q --show-progress
dpkg -i /tmp/atom-amd64.deb
rm /tmp/atom-amd64.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment