Skip to content

Instantly share code, notes, and snippets.

@felipeelia
Last active October 16, 2017 15:44
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 felipeelia/46bd74439c6574ff67a5402d1687ca8d to your computer and use it in GitHub Desktop.
Save felipeelia/46bd74439c6574ff67a5402d1687ca8d to your computer and use it in GitHub Desktop.
Update Atom to lastest stable release
#!/bin/bash
set -euo pipefail
# from this answer: https://askubuntu.com/a/630530/700841
# with some changes, like testing versions, for instance.
#
# How to use:
# 1. put this at /usr/local/bin/ as atom-auto-update (without .sh)
# 2. save and make it executable with `sudo chmod +x /usr/local/bin/atom-auto-update`
# 3. run whenever you want with `sudo atom-auto-update`
# 4. optionally create a cron task with `sudo crontab -e` and
# `0 10 * * 1 /usr/local/bin/atom-auto-update` for weekly updates at 10am
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
INSTALLED_VERSION=$(atom --version | grep -E Atom.* | cut -d':' -f2 | tr -d '[:space:]')
NEW_VERSION=$(cat /tmp/latest | grep -Po '/v\K[^a]+(?=/atom-amd64.deb)')
if [ "$INSTALLED_VERSION" != "$NEW_VERSION" ]; then
wget https://github.com$(cat /tmp/latest | grep -o -E 'href=".*atom-amd64.deb' | cut -d'"' -f2) -O /tmp/atom-amd64.deb
dpkg -i /tmp/atom-amd64.deb
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment