From d158be2aea4300234d1c1c31aad041d66919960b Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sun, 18 Aug 2024 17:01:32 -0400 Subject: add useful scripts --- scripts/discord | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/discord (limited to 'scripts/discord') 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 -- cgit v1.2.3