Added script
This commit is contained in:
parent
f9c810c9f5
commit
ba95c09cf3
40
discord_updater.sh
Executable file
40
discord_updater.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Get latest version from Discord's API
|
||||||
|
LATEST_JSON=$(curl -s "https://discord.com/api/updates/stable?platform=linux")
|
||||||
|
LATEST_VERSION=$(echo "$LATEST_JSON" | grep -oP '"name":\s*"\K[0-9.]+')
|
||||||
|
|
||||||
|
|
||||||
|
# Get installed version from APT (if installed)
|
||||||
|
if apt show discord 2>/dev/null | grep -q 'Version:'; then
|
||||||
|
INSTALLED_VERSION=$(apt show discord 2>/dev/null | grep '^Version:' | awk '{print $2}')
|
||||||
|
else
|
||||||
|
INSTALLED_VERSION="none"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Latest available version: $LATEST_VERSION"
|
||||||
|
echo "Currently installed version: $INSTALLED_VERSION"
|
||||||
|
|
||||||
|
# Compare versions
|
||||||
|
if [ "$LATEST_VERSION" != "$INSTALLED_VERSION" ]; then
|
||||||
|
echo "Updating Discord to version $LATEST_VERSION..."
|
||||||
|
|
||||||
|
DEB_URL="https://stable.dl2.discordapp.net/apps/linux/${LATEST_VERSION}/discord-${LATEST_VERSION}.deb"
|
||||||
|
TEMP_DEB="/tmp/discord-${LATEST_VERSION}.deb"
|
||||||
|
|
||||||
|
echo "Downloading: $DEB_URL"
|
||||||
|
curl -L "$DEB_URL" -o "$TEMP_DEB"
|
||||||
|
|
||||||
|
echo "Installing..."
|
||||||
|
sudo dpkg -i "$TEMP_DEB"
|
||||||
|
|
||||||
|
echo "Cleaning up..."
|
||||||
|
rm -f "$TEMP_DEB"
|
||||||
|
|
||||||
|
echo "✅ Discord updated to $LATEST_VERSION"
|
||||||
|
else
|
||||||
|
echo "👍 Discord is already up to date."
|
||||||
|
fi
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user