From 8cbb2900906f0410604cf0540a7deea7ec54da61 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Tue, 30 Apr 2024 09:16:41 +0200 Subject: [PATCH] add README, update code --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ update_discord.sh | 4 ++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef9300b --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# A function to update discord on Debian + +Updating discord is annoying. Initially, this script automated the process. Now, it also checks headers, so that it can be added to a crontab or similar, and it only downloads the ~100 Mb discord file if it is indeed new. + +## Usage + +**Download and execute** + +```sh +$ curl https://git.nunosempere.com/NunoSempere/update_discord/raw/branch/master/update_discord.sh -o update_discord.sh +$ cat update_discord.sh +$ bash update_discord.sh +``` + +**Add to .bashrc** + +You might also want to add the contents of update_discord.sh to your `.bashrc` file or similar. + +**Usage in cron** + +I think this is how you would add this to a crontab: + +``` +$ sudo crontab -e +# Then, inside the crontab +8 * * * * bash /download_path/update_discord.sh +``` + +However, I haven't tested this yet with a new update + +## Stack + +- curl +- apt—implying Debian or derivatives +- bash + + +## Security posture + +Total disregard. If you automatically download discord updates, if they are compromised you would have no warning. diff --git a/update_discord.sh b/update_discord.sh index 1b344cf..11f61cc 100644 --- a/update_discord.sh +++ b/update_discord.sh @@ -1,8 +1,8 @@ function update_discord(){ verbose=1 - mkdir -p "$HOME/Downloads/discord-update" - cd "$HOME/Downloads/discord-update" + mkdir -p "$HOME/Downloads/update-discord" + cd "$HOME/Downloads/update-discord" 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: //' )"