Last active
December 13, 2023 15:36
-
-
Save moonexpr/eac1fa7100eeef42a80498a7a9919836 to your computer and use it in GitHub Desktop.
A small script for updating discord
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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