[HACK/SOLUTION] Discord updates

I had noticed the Discord update weirdness on my new OMLx install, but because I’ve had a rough start and had to make some modifications, I thought it was maybe my fault. Then I saw Brodie’s video about it.

In short, whenever Discord starts, it checks for updates, and if there is an update, Discord tells you to go and download and install the update before you can access Discord again.

Either you have to manually update before each use (because Discord releases patches every 4 minutes and the repos don’t keep up), use the web version (I’d prefer to keep Discord separate from my browser in case of browser crashes), or disable the update check altogether.

So I have written a script that automatically checks the latest version of Discord, updates if necessary, and then boots Discord for you.

If that sounds useful to you, the code and instructions can be found in a Gist that I apparently can’t link to? Very helpful…

OK, I’ll post the code and instructions here as well, although my first priority will be keeping the Gist up to date.

discord.sh

#!/bin/bash

# Written by Luke Boland / TehMagilla 2025
# Released under Creative Commons

# Make sure the download folder exists
mkdir dlpackages1 2> /dev/null

echo "Checking for most recent package..."
CURFILE=$(curl -sIkL "https://discord.com/api/download?platform=linux&format=tar.gz" | grep "location:" | awk -F '/' '{print $7}')

# Clean out the weirdness (some unprintable control characters were coming out of curl/grep/awk)
CURFILE=$(echo $CURFILE | sed 's/[^a-zA-Z0-9\.\-]//g')

CURFILE=dlpackages/$CURFILE

if [ ! -f $CURFILE ];
then
	echo "New version of Discord to install, updating..."
	wget -P ./dlpackages/ "https://discord.com/api/download?platform=linux&format=tar.gz"
	echo "Download complete"
	for file in $(ls -t -w 1 | grep ".tar.gz" | sed -n 1p)
	do
		tar -xvzf $file -C ../../
	done
	echo "Archive decompressed"
fi
echo "Starting Discord"
./Discord > /dev/null 2>&1 &

How to use this:

  1. Create a folder for Discord to live in. I chose ~/apps/Discord/
    
  2. Put the attached file (discord.sh) in the Discord folder you just created (ie ~apps/Discord/discord.sh)
    
  3. Make discord.sh executable (ie chmod +x ~apps/Discord/discord.sh)
    
  4. Run discord.sh (ie ~apps/Discord/discord.sh)
    

What it does:

  1. Make sure there's a separate folder to download into
    
  2. Check with the discord server to see if you have the current version
    
  3. If you don't, download the latest available file, unzip it to your Discord folder
    
  4. Copy the discord.desktop file to your local desktop launcher folder (~/.local/share/applications)
    
  5. Start Discord
    

Discord also make a .deb version available. It shouldn’t take too many edits to make that work as well, but I don’t have a .deb-based system to test it on.

4 Likes

OK, apparently I’m basic now, so I can post the Gist link.

4 Likes

@TehMagilla Thank you.

The workflow is that we need users’ positive feedbacks then I can move/copy the tutorials in Resources category with credits.

3 Likes

Can I ask for the ability to edit my own posts please? I’ve just updated the Gist because I made a silly mistake…

@TehMagilla afaics there is a grace period when you (everyone) can edit your posts, it’s default based so I can’t change individually post.
I’d suggest write here below your changes.

1 Like

Point 4:

Copy the discord.desktop file to your local desktop launcher folder (~/.local/share/applications)

This was silly of me, I didn’t change it to point to the discord.sh file. Delete

	echo "Adding Discord to launcher..."
	cp -f ./discord.desktop ~/.local/share/applications/

or get the latest version from the Gist link

2 Likes

@TehMagilla Done, but better you double check.

2 Likes

Lovely, looks good. Thank you!

2 Likes

Just used the script, OM ROME LXQt, works fine, thank you.

1 Like