add README, update code

This commit is contained in:
NunoSempere 2024-04-30 09:16:41 +02:00
parent cde1c165bb
commit 8cbb290090
2 changed files with 42 additions and 2 deletions

40
README.md Normal file
View File

@ -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.

View File

@ -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: //' )"