Last active
October 16, 2017 15:44
-
-
Save felipeelia/46bd74439c6574ff67a5402d1687ca8d to your computer and use it in GitHub Desktop.
Update Atom to lastest stable release
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 | |
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