aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/discord
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2024-08-18 17:01:32 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2024-08-18 17:01:32 -0400
commitd158be2aea4300234d1c1c31aad041d66919960b (patch)
tree00ad8e8acfd81ef7b6b3b22e087d6c0ab638d10c /scripts/discord
parentc840e6608751f1e15a2cd6347924186b27fbe842 (diff)
add useful scripts
Diffstat (limited to 'scripts/discord')
-rwxr-xr-xscripts/discord34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/discord b/scripts/discord
new file mode 100755
index 0000000..948c59e
--- /dev/null
+++ b/scripts/discord
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+DOWNLOAD_URL="https://discord.com/api/download?platform=linux&format=tar.gz"
+INSTALL_DIR="$HOME/src/Discord"
+
+update(){
+ pidof Discord > /dev/null 2>&1 && pkill Discord
+ curl -L "$DOWNLOAD_URL" > /tmp/discord.tar.gz &&
+ rm -rf "$INSTALL_DIR" &&
+ tar -xzf /tmp/discord.tar.gz -C "$HOME/src"
+}
+
+
+# check for updates
+if [ -n "$1" ]; then
+ case "$1" in
+ "update")
+ echo "Updating Discord"
+ update
+ ;;
+ *)
+ echo "Unknown argument. Usage $0 [update]"
+ exit 1
+ ;;
+ esac
+else
+ # install if not installed
+ [ -x "$INSTALL_DIR/Discord" ] || {
+ echo "Installing Discord"
+ update
+ }
+
+ # start discord
+ "$INSTALL_DIR/Discord" > /dev/null 2>&1 & disown
+fi