Skip to content

Instantly share code, notes, and snippets.

@moonexpr
Last active December 13, 2023 15:36
Show Gist options
  • Save moonexpr/eac1fa7100eeef42a80498a7a9919836 to your computer and use it in GitHub Desktop.
Save moonexpr/eac1fa7100eeef42a80498a7a9919836 to your computer and use it in GitHub Desktop.
A small script for updating discord
#!/bin/bash
shopt -s extglob
download_file()
{
echo $1
curl -L# "$1" -o $2
}
install_pkg()
{
echo "[discord] Installing Debian package."
sudo dpkg -i $1
}
echo "[discord] Permission to download & install remote Debian package?"
sudo echo a > /dev/null
if [[ $? > 0 ]]; then
echo -e "[discord] Permission denied, aborting."
exit 2
fi
URL="https://discord.com/api/download?platform=linux&format=deb"
if [[ -n `command -v curl_resolve` ]]; then
URL=`curl_resolve $URL`
fi
PKG_FILE=~/discord.deb
download_file $URL $PKG_FILE
install_pkg $PKG_FILE
rm -f $PKG_FILE &> /dev/null
#vim: set sw=4 ts=4 et
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment