Files
discord-auto-update/README.md

50 lines
2.3 KiB
Markdown

# Discord Automatic Updater
This is a small shell script and systemd service that automatically check for discord updates in the background. It updates Discord by editing `/usr/share/discord/resources/build_info.json` to the most recent version number - the content of the updates are installed by Discord itself when launched.
Currently, this has only been tested with the debian-based Discord package. It may work with the `.rpm` installer as well - let me know if you try it. Update the appropriate environment variables in `update-discord.sh`.
## Setup
Run this from inside the Git repo:
```sh
# move the script to a system location and make it executable
sudo mkdir -p /usr/local/bin
sudo cp ./update-discord.sh /usr/local/bin/update-discord
sudo chmod 755 /usr/local/bin/update-discord
# create the systemd service
sudo cp ./update-discord.service /etc/systemd/system/update-discord.service
# create the systemd timer
sudo cp ./update-discord.timer /etc/systemd/system/update-discord.timer
sudo systemctl daemon-reload
sudo systemctl enable --now update-discord.timer
```
You can manually test it too:
```sh
# check schedule
systemctl list-timers | grep discord
# manually trigger and check logs
sudo systemctl start update-discord.service
journalctl -u update-discord.service
```
## Stopping automatic updates
Discord's stock client prompts you to manually update whenever they release a new version. I originally created this script so that I didn't have to interact with that prompt and download a `.deb` every week.
However, Discord recently botched one of their linux updates (somewhere around version `0.0.133`, I think) and have yet to publish a fix. While searching for a workaround to that, I learned that [you can disable Discord's forced updates entirely](https://superuser.com/questions/1745556/prevent-discord-from-updating-automatically). Yippee!
Edit `~/.config/discord/settings.json` to include the following JSON field:
```json
{
"SKIP_HOST_UPDATE": true
}
```
Then, edit `/usr/share/discord/resources/build_info.json` and change the `version` field to some older version (I used `0.0.131`). You may need to run `killall Discord` and restart the app for changes to take place.
You can turn off the auto-update script by running `sudo systemctl disable update-discord.timer`. You can also re-enable it by running `sudo systemctl enable update-discord.timer`.