This Go program automatically keeps Discord up-to-date with two modes:
1. Daemon: Monitors ~/Downloads for new discord-*.deb files and performs automatic hourly update checks.
2. Discord command wrapper: Acts as a Discord wrapper that checks for updates on startup then launches Discord (run as an alias named discordup or with --launch flag). No need for a background service, but a bit more manual to install/consume updates.
Discord has an awful upgrade process on Linux:
- You open the program and it shows a "Download" button and stops the world. The older version won't even open.
- You hit download, but have 10 other older .deb files and can't find the right one, so you have to run
ls -ltras ~/Downloads/discord*.deb - You find the right one and have to
dpkg -iit assudo - You have to relaunch Discord
One alternative is to use Flatpak or snap.. I really want to keep that stuff off my system. This program automates the entire process for you and it's open source, so you can hack on it as much as you like, or adapt it to update other similar packages.
-
Get or build the program:
# Arkade can be installed without sudo if you are worried. # it's only used to move arkade to /usr/local/bin/ curl -SLs https://get.arkade.dev | sudo sh arkade get discord-update mkdir -p ~/go/bin/ cp ~/.arkade/bin/discord-updater ~/go/bin/Or build from source:
go installIf you don't have Go,
sudo -E arkade system install gois a quick way to get it via arkade. -
Install the systemd service:
Replace my username in the template with your own:
sed -i "s/alex/$(whoami)/g" discord-updater.service mkdir -p ~/.config/systemd/user/ cp discord-updater.service ~/.config/systemd/user/ -
Enable and start the service as a user-level service:
systemctl --user daemon-reload systemctl --user enable discord-updater systemctl --user start discord-updater
If your user does not have passwordless sudo, then you'll need it for dpkg to work:
echo "$(whoami) ALL=(ALL) NOPASSWD: /usr/bin/dpkg" | sudo tee -a /etc/sudoers
-
Build the program:
go installIf you don't have Go,
sudo -E arkade system install gois a quick way to get it via arkade. -
Option A) create a symlink or alias named
discordupto the built binary for launcher mode:ln -s $(which discord-updater) ~/bin/discordup -
Option B) just use the
--launchflag when running the binary:discord-updater --launch
journalctl --user -u discord-updater -fdiscord-update watching: /home/alex/Downloads
Current installed Discord version: 0.0.123
Performing initial update check...
Checking for Discord updates...
Online version: 0.0.124, Installed: 0.0.123, Latest deb:
New version available: 0.0.124
Downloaded Discord 0.0.124 to /home/alex/Downloads
Installing discord via: discord-0.0.124.deb
Discord updated in 1 attempts
Killing discord and relaunching the new version
The program detects installed Discord versions by reading /usr/share/discord/resources/build_info.json, which contains the exact version information in JSON format. This method is more reliable and accurate than scanning directory names.
[MIT](LICENSE.md] - no warranty of any kind. Use and adapt at your own risk.