Last active
March 24, 2025 19:02
-
-
Save Razuuu/cbc6f15632e8be0fec3356d9a262e422 to your computer and use it in GitHub Desktop.
Install or (default: update) discord via tar.gz file
This file contains 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 | |
echo "$([ "$1" == "install" ] && echo "Install" || echo "Update") Discord" | |
# Download Discord | |
cd /tmp | |
curl -o discord.tar.gz -J --location-trusted --max-redirs 10 "https://discord.com/api/download/stable?platform=linux&format=tar.gz" | |
# Unzip | |
tar -xzf discord.tar.gz | |
# Copy files to /opt/discord/ | |
sudo mkdir -p /opt/discord | |
sudo cp -r Discord/* /opt/discord/ | |
# Edit desktop file for custom folder | |
sudo sed -i 's|Exec=/usr/share/discord/Discord|Exec=/usr/bin/discord|' /opt/discord/discord.desktop | |
sudo sed -i 's|Icon=discord|Icon=/opt/discord/discord.png|' /opt/discord/discord.desktop | |
# install | |
if [ $1 == "install" ]; then | |
# set symlink | |
sudo ln -sf /opt/discord/Discord /usr/bin/discord | |
# place discord.desktop into applications folder | |
sudo cp -r /opt/discord/discord.desktop /usr/share/applications/ | |
fi | |
# Add execute permission and set root user | |
sudo chown root:root -R /opt/discord/ | |
sudo chmod -R +x /opt/discord/ | |
# Delete temp files | |
rm -rf discord.tar.gz Discord |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment