blob: 948c59eb67c389391064543e0be394eb1ff86485 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
|