Update Discord on Ubuntu

Hey guys,

Like probably everyone else who uses Discord on Ubuntu, I’ve always been irritated with the fact that Discord is apparently unable? Unwilling? To provide a repository to update their chat client along with all the other software on my computer, instead insisting on bumping the minor version number on their .deb file (and you never even know if anything changes in this installer other than the version number).

Discord

For some reason it also only works this way on Linux and the other operating systems can self-update just fine… leading me to believe that in fact nothing changes in the new download, it’s just implemented very poorly.

So… I’ve been looking for a better solution and I found some things, but like… well I’m a DevOps engineer why can’t I save time at home as well? So I took those fixes and assembled this:

https://gitlab.com/dustwolf/discord-update

The Readme on the page includes installation steps, so it should be pretty straightforward to use.

I know I could have simply installed a snap, but to be honest I’ve never trusted snaps, they never worked really well and at the end of the day, what this code does and what they do to create the snap, are basically the same things, it’s just that the snap does it at the snap distribution point, while this solution does it on your computer.

I get that some people might be frightened by the use of Ansible, but it’s really as simple as the instructions say. You don’t need to know anything about it to use it, other than to download all the files in their place (download a ZIP and unpack it) and copy-paste the lines into the terminal, replacing the discord_username with your username on your computer.

The Ansible scripting language is something I use at work (as mentioned I work as a DevOps engineer). It took me a while to get into, but it really is very appropriate as a linux scripting language for installing stuff, because what it does is that it allows you to tell it what you want to end up with and so… in the case that your script encounters some unexpected conditions, the solution does not have to be in the code and instead Ansible will come up with it. In addition, if some kind of major error is encountered, the script will bail sensibly, rather than go haywire.

Ansible is also great for being relatively platform independent. Obviously in this case my code uses apt and downloads a deb, this will only work on Ubuntu, maybe Debian. But if a new version of Ubuntu comes out, I will most likely not have to fix the script and it can just keep going.

Ansible
“Re-establishing Ansible connection…”

As you get older… time becomes your most valuable commodity. I found I just don’t have the time anymore to fuck around with scripts whenever I get off work and sit down at the computer. I need stuff to just work, so that I can focus on what I actually need to be doing. As such, solutions like Ansible code that can either be reused without much preparation or is already installed in the system and just works in the background, are kind of ideal.

SystemD is another one such system, hence my choice of it’s timers instead of something like cron. You can actually tell it stuff like: Okay, I want updates once a week, but only do it after Internet is connected. And it will do it whether someone is logged on or not or whether this is a desktop which is always connected, or a laptop that doesn’t usually have internet until you log on, or even some occasionally used box that you still need updated even though you only use it once a month.

In addition, if your code makes output, it will silently stow it in the journal, so that you can check it if you’re curious if it works, but you can otherwise be unbothered by it. It will even handle exit codes sensibly and let you know if something is not working. I mean I know people have had a lot of bad stuff to say about SystemD, because it doesn’t follow the principle of being a small bit good for only one purpose (which on Linux is a great thing by the way), but for what it’s worth it does a lot of stuff right, and I’m much rather stuck with this, than some half broken single-core System 5 from the 1980s.

I hope you get my somewhat antiquated humor. Hope the script works for you.

Have a good one.

LP,
Jure

Leave a comment

Your email address will not be published. Required fields are marked *