Can skip versions now. First upload.
This commit is contained in:
parent
2cd76f2c12
commit
7a2a2ebae9
4 changed files with 48 additions and 0 deletions
22
readme.md
Normal file
22
readme.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Discord updater
|
||||
|
||||
This script is designed to alleviate Discord updates on Linux systems.
|
||||
|
||||
Yes, there are repos, and snaps, and flatpacks... But fuck those.
|
||||
|
||||
Every time there's an update it takes some time for the app to be available.<br>
|
||||
And on Linux you'll be greeted by that freaking "good news, everyone" window saying there's a new version.<br>
|
||||
|
||||
Well, if you know there is, then ***update***. You know, like Telegram or any other normal software does!<br>
|
||||
Can't seem to be able to run the current version anyway (even though it clearly could run, Discord just hates its users).<br>
|
||||
|
||||
So, the idea is quite simple: the script tries to get a new version and updates the app if succeeds.
|
||||
|
||||
## Why text files?
|
||||
|
||||
1. To keep track of current version.
|
||||
Script adds 1 to it and tries to update.
|
||||
2. Some versions are broken, and we need to skip them (at least for now), e.g. ver.99 wants to update to ver.88.
|
||||
|
||||
- version.txt holds a single number - the currently installed version.
|
||||
- skipped_versions.txt holds several numbers each on a separate line - the versions updates should skip.
|
||||
1
skipped_versions.txt
Normal file
1
skipped_versions.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
89
|
||||
24
update_discord.sh
Executable file
24
update_discord.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
cd "$HOME/dev/discord_updater/"
|
||||
discord_version=`cat version.txt`
|
||||
mapfile -t skipped_versions < skipped_versions.txt
|
||||
|
||||
new_discord_version=$((discord_version + 1))
|
||||
|
||||
for skipped_version in "${skipped_versions[@]}"
|
||||
do
|
||||
if [ $skipped_version == $new_discord_version ]; then
|
||||
echo "skipping version ${skipped_version} ?"
|
||||
new_discord_version=$((new_discord_version + 1))
|
||||
fi;
|
||||
done
|
||||
|
||||
|
||||
wget "https://stable.dl2.discordapp.net/apps/linux/0.0.$new_discord_version/discord-0.0.$new_discord_version.tar.gz"
|
||||
if [ -f "discord-0.0.$new_discord_version.tar.gz" ]; then
|
||||
rm -rf "Discord"
|
||||
tar -xvf "discord-0.0.$new_discord_version.tar.gz"
|
||||
cp -r -T "Discord" "$HOME/Рабочий стол/Apps/Discord"
|
||||
echo $new_discord_version > version.txt
|
||||
fi
|
||||
|
||||
"$HOME/Рабочий стол/Apps/Discord/Discord"
|
||||
1
version.txt
Normal file
1
version.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
88
|
||||
Loading…
Add table
Add a link
Reference in a new issue