commit 8cbb2900906f0410604cf0540a7deea7ec54da61
parent cde1c165bbc6cfef03857766ce4ff8bd311aa1e3
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Tue, 30 Apr 2024 09:16:41 +0200
add README, update code
Diffstat:
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/README.md 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
@@ -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: //' )"