Skip to content

Instantly share code, notes, and snippets.

@TheSainEyereg
Last active March 11, 2025 16:57
Show Gist options
  • Select an option

  • Save TheSainEyereg/913419499aa5b58cb33217e196402f2c to your computer and use it in GitHub Desktop.

Select an option

Save TheSainEyereg/913419499aa5b58cb33217e196402f2c to your computer and use it in GitHub Desktop.
Discord updating scripts

Discord updater

Scripts for updating and starting discord in "1 click"

  • Vencord installer included
#!/usr/bin/env bash
set -e
DISCORD_BRANCH="canary" # "stable", "canary", "ptb"
DISCORD_PATH="/opt/discord-canary"
DISCORD_PROCESS="DiscordCanary"
UPDATE_COMMAND="yay -S --noconfirm discord-canary"
say_error() {
echo -e "\033[0;31m$1\033[0m"
}
kill_discord() {
echo "Killing $DISCORD_PROCESS"
pkill -9 -f "$DISCORD_PROCESS$" || true
}
if [ "$EUID" -eq 0 ]; then
say_error "Do not run this install script as root"
exit 1
fi
REMOTE=$(curl -s "https://discord.com/api/updates/$DISCORD_BRANCH?platform=linux" | jq -r .name)
LOCAL=$(cat "$DISCORD_PATH/resources/build_info.json" | jq -r .version)
if [ "$REMOTE" = "$LOCAL" ]; then
echo "Discord is already up to date"
kstart "$DISCORD_PATH/$DISCORD_PROCESS"
exit 0
fi
echo "New version available: $REMOTE (current: $LOCAL)"
kill_discord
echo "Running update command"
$UPDATE_COMMAND > /dev/null
NEW=$(cat "$DISCORD_PATH/resources/build_info.json" | jq -r .version)
if [ "$REMOTE" != "$NEW" ]; then
say_error "Failed to update to $REMOTE, latest downloaded is $NEW"
read -rsp $'Press any key to continue...\n' -n 1
exit 0
fi
if [ -f "$(dirname "$0")/vencord.sh" ]; then
echo "Intalling Vencord"
"$DISCORD_PATH/$DISCORD_PROCESS" 2> /dev/null | while read -r line; do
if [[ $line == *"status: 'launching'"* ]]; then
kill_discord
break
fi
done
"$(dirname "$0")/vencord.sh" -branch $DISCORD_BRANCH -install-openasar -install
else
echo "Skipping Vencord install as vencord.sh not found"
fi
kstart "$DISCORD_PATH/$DISCORD_PROCESS"
#!/usr/bin/env bash
set -e
say_error() {
# {
# GTK_THEME="Breeze-Dark" zenity --error --text="$1" 2>/dev/null
# } || {
# echo -e "\033[0;31m$1\033[0m"
# }
echo -e "\033[0;31m$1\033[0m"
}
if [ "$EUID" -eq 0 ]; then
say_error "Do not run this install script as root"
exit 1
fi
outfile=$(mktemp)
trap 'rm -f "$outfile"' EXIT
echo "Downloading Vencord installer"
curl -sS https://github.com/Vendicated/VencordInstaller/releases/latest/download/VencordInstallerCli-Linux \
--output "$outfile" \
--location
chmod +x "$outfile"
if command -v sudo >/dev/null; then
echo "Running with sudo"
sudo "$outfile" "$@"
elif command -v doas >/dev/null; then
echo "Running with doas"
doas "$outfile" "$@"
else
say_error "No sudo or doas found"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment