Last active
September 24, 2025 16:48
-
-
Save AlphaGameDeveloper/9efd0a7e973177274e1e7bf22b7658a4 to your computer and use it in GitHub Desktop.
Quick & Simple shell script for Linux systems to install Discord with Vencord. Works for initial installation and updates.
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
| #!/usr/bin/env bash | |
| # Quick shell script for Linux systems, to install Discord & Vencord. | |
| # By default, installs to /opt/discord; Should be fine. What's nice | |
| # about this script in lieu of other methods is that it installs the | |
| # package from discord themselves instead of a package maintained by | |
| # some people who'll be a couple hours (if not days) late after an | |
| # update was released by Discord. | |
| # Also, I've had problems with Vencord being nuked when Discord gets | |
| # updated, so this'll just try running the vencordInstaller every time | |
| # Discord gets updated. | |
| # The script works as follows-- | |
| # 1. Download the official Discord tarball, and save it in the /tmp folder. | |
| # 2. Extract said tarball to /opt/discord. | |
| # 3. Create all needed *.desktop files, so it's recognized in the search menu. | |
| # 4. Download the official Vencord installer CLI, and save it in the /tmp folder. | |
| # 5. Run this installer in unattended mode, patching the stable installation. | |
| # 5.1. Note - This might cause problems if you have multiple Discord installations, | |
| # such as the Flatpak, apt, or whatever version you have. Room for | |
| # improvement here would be to manually specify that we're using the | |
| # `/opt/discord` installation. :) | |
| # 5.2. If this has problems, the output is in `/tmp/vencordInstaller.stdout` and | |
| # `/opt/vencordInstaller.stderr`. | |
| # Also, one caveat - this was made & tested in KDE Plasma, on Arch Linux. Haven't tested | |
| # it on other distros, but it might work--Support for GNOME might be added later. :) | |
| set -e | |
| DISCORD_URL="https://discord.com/api/download?platform=linux&format=tar.gz" | |
| VENCORD_URL="https://github.com/Vendicated/VencordInstaller/releases/latest/download/VencordInstallerCli-Linux" | |
| VENCORD_CHECKSUM_URL="https://github.com/Vendicated/VencordInstaller/releases/latest/download/checksums.sha256" | |
| VENCORD_BINARY_FILE="/tmp/vencordInstaller" | |
| VENCORD_CHECKSUM_FILE="$VENCORD_BINARY_FILE.sha256" | |
| INSTALL_DIR="/opt/discord" | |
| BIN_PATH="/usr/bin/discord" | |
| DESKTOP_FILE="/usr/share/applications/discord.desktop" | |
| TMP_FILE="/tmp/discord.tar.gz" | |
| if [ "$UID" -ne 0 ]; then | |
| echo "error: script must be run as root :3" | |
| exit 1 | |
| fi | |
| echo "[+] Downloading Discord..." | |
| curl -L "$DISCORD_URL" -o "$TMP_FILE" | |
| echo "[+] Extracting..." | |
| rm -rf "$INSTALL_DIR" | |
| mkdir -p "$INSTALL_DIR" | |
| tar -xzf "$TMP_FILE" -C "$INSTALL_DIR" --strip-components=1 | |
| echo "[+] Creating symlink..." | |
| ln -sf "$INSTALL_DIR/Discord" "$BIN_PATH" | |
| echo "[+] Setting up desktop entry..." | |
| cat > "$DESKTOP_FILE" <<EOF | |
| [Desktop Entry] | |
| Name=Discord | |
| Comment=All-in-one voice and text chat | |
| Exec=$BIN_PATH | |
| Icon=$INSTALL_DIR/discord.png | |
| Terminal=false | |
| Type=Application | |
| Categories=Network;InstantMessaging; | |
| StartupWMClass=discord | |
| EOF | |
| echo "[✓] Discord installed/updated successfully!" | |
| echo "[+] Installing Vencord installer" | |
| curl -sS $VENCORD_URL \ | |
| --output "$VENCORD_BINARY_FILE" \ | |
| --location \ | |
| --fail | |
| # Thanks, @Vendicated, for making the checksum file literally for this script to function | |
| # Vencord/Installer issue #163 | |
| printf "[+] Verifying Installer Integrity... " | |
| curl -sSL $VENCORD_CHECKSUM_URL \ | |
| -o $VENCORD_CHECKSUM_FILE | |
| sed -i "s/VencordInstallerCli-linux/$(basename $VENCORD_BINARY_FILE)/" $VENCORD_CHECKSUM_FILE | |
| pushd /tmp > /dev/null | |
| if sha256sum -c "$VENCORD_CHECKSUM_FILE" --ignore-missing --status; then | |
| echo "OK" | |
| else | |
| echo "NOT OK" | |
| echo "❌ Checksum mismatch! Aborting." | |
| exit 1 | |
| fi | |
| popd > /dev/null | |
| echo "[+] Executing Vencord Installer" | |
| chmod +x $VENCORD_BINARY_FILE | |
| $VENCORD_BINARY_FILE -install -branch stable > $VENCORD_BINARY_FILE.stdout 2> $VENCORD_BINARY_FILE.stderr | |
| echo "[✓] Vencord installed successfully! (Exit code $?)" | |
| echo "[+] Cleaning up... (You can use \"$0 noClean\" to skip the cleanup)" | |
| if [ "$1" != "noClean" ]; then | |
| rm $VENCORD_BINARY_FILE | |
| rm $VENCORD_BINARY_FILE.stdout | |
| rm $VENCORD_BINARY_FILE.stderr | |
| rm $VENCORD_CHECKSUM_FILE | |
| rm $TMP_FILE | |
| echo "[✓] All done cleaning up." | |
| else | |
| echo " [!] 'noClean' argument used, not cleaning up!" | |
| exit 0 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment