From cde1c165bbc6cfef03857766ce4ff8bd311aa1e3 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Tue, 30 Apr 2024 08:56:55 +0200 Subject: [PATCH] add update_discord script --- update_discord.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 update_discord.sh diff --git a/update_discord.sh b/update_discord.sh new file mode 100644 index 0000000..1b344cf --- /dev/null +++ b/update_discord.sh @@ -0,0 +1,26 @@ +function update_discord(){ + verbose=1 + + mkdir -p "$HOME/Downloads/discord-update" + cd "$HOME/Downloads/discord-update" + curl -L -I "https://discord.com/api/download/stable?platform=linux&format=deb" -o discord.head + + uri_old="$(cat discord.head.old | grep location | sed 's/location: //' )" + uri_new="$(cat discord.head | grep location | sed 's/location: //')" + + if [ "$verbose" == 1 ]; then echo "uri_old: $uri_old"; fi + if [ "$verbose" == 1 ]; then echo "uri_new: $uri_new"; fi + + if [ "$uri_old" != "$uri_new" ]; then + cp "discord.head" "discord.head.old" + + if [ "$verbose" == 1 ]; then echo "Downloading discord.deb"; fi + curl -L "https://discord.com/api/download/stable?platform=linux&format=deb" -o discord.deb + + if [ "$verbose" == 1 ]; then echo "Updating discord.deb"; fi + sudo apt install ./discord.deb + fi + +} + +update_discord