update_discord.sh (859B)
1 function update_discord(){ 2 verbose=1 3 4 mkdir -p "$HOME/Downloads/update-discord" 5 cd "$HOME/Downloads/update-discord" 6 curl -L -I "https://discord.com/api/download/stable?platform=linux&format=deb" -o discord.head 7 8 uri_old="$(cat discord.head.old | grep location | sed 's/location: //' )" 9 uri_new="$(cat discord.head | grep location | sed 's/location: //')" 10 11 if [ "$verbose" == 1 ]; then echo "uri_old: $uri_old"; fi 12 if [ "$verbose" == 1 ]; then echo "uri_new: $uri_new"; fi 13 14 if [ "$uri_old" != "$uri_new" ]; then 15 cp "discord.head" "discord.head.old" 16 17 if [ "$verbose" == 1 ]; then echo "Downloading discord.deb"; fi 18 curl -L "https://discord.com/api/download/stable?platform=linux&format=deb" -o discord.deb 19 20 if [ "$verbose" == 1 ]; then echo "Updating discord.deb"; fi 21 sudo apt install ./discord.deb 22 fi 23 24 } 25 26 update_discord