Skip to content

Instantly share code, notes, and snippets.

@MrGibus
Created February 16, 2024 14:33
Show Gist options
  • Select an option

  • Save MrGibus/7f3f58defe2a2c24e5412e2165e71fd2 to your computer and use it in GitHub Desktop.

Select an option

Save MrGibus/7f3f58defe2a2c24e5412e2165e71fd2 to your computer and use it in GitHub Desktop.
Updates discord in Fedora Linux.
#!/bin/bash
# navigate to downloads run `sudo bash ~/path/to/updiscord.sh discord-0.0.xx.tar.gz
if [ $# -ne 1 ]; then
echo "Usage: $0 <discord-file-path>"
exit 1
fi
discord_file_path=$1
install_path="/lib64/Discord"
backup_path="$install_path/old"
# Check if the backup folder already exists
if [ -d "$backup_path" ]; then
read -r -p "The 'old' folder already exists. Do you want to delete it? (y/n) " answer
if [ "$answer" == "y" ]; then
mkdir -p "$backup_path"
mv "$install_path"/* "$backup_path"
else
echo "Aborting installation."
exit 1
fi
fi
# Move the existing files to the backup folder
if [ -d "$install_path" ]; then
mv "$install_path" "$backup_path"
fi
# Extract the Discord files to the installation path
mkdir -p "$install_path"
tar -xvf "$discord_file_path" -C "$install_path"
# Ensure the symbolic link points to the correct location
ln -sf "$install_path/Discord/Discord" "/bin/Discord"
echo "Installation complete."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment