You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Botspot-Pi-Apps/apps/Discord/install

55 lines
1.6 KiB
Bash

#!/bin/bash
DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"
function error {
echo -e "\\e[91m$1\\e[39m"
exit 1
}
arch=''
while [ "$arch" != 'armhf' ] && [ "$arch" != 'arm64' ]
do
echo -n "Which type of Discord do you want? [armhf/arm64] "
arch=''
read arch
if [ "$arch" != 'armhf' ] && [ "$arch" != 'arm64' ];then
echo -e "\\e[91mDid not understand '$arch'. Try again.\\e[39m"
fi
done
#maker and enter discord-electron folder
gio trash ~/discord-electron
mkdir ~/discord-electron
cd ~/discord-electron || error "Failed to enter discord-electron folder!"
if [ "$arch" == 'armhf' ];then
#Download from github
wget https://github.com/SpacingBat3/electron-discord-webapp/releases/download/v0.1.1/linux-armv7l.tar.gz || error 'Failed to download archive!'
tar -xf linux-armv7l.tar.gz --strip 1 || error 'Failed to extract archive!'
rm -f linux-armv7l.tar.gz
elif [ "$arch" == 'arm64' ];then
#Download from github
wget https://github.com/SpacingBat3/electron-discord-webapp/releases/download/v0.1.1/linux-aarch64.tar.gz || error 'Failed to download archive!'
tar -xf linux-aarch64.tar.gz --strip 1 || error 'Failed to extract archive!'
rm -f linux-aarch64.tar.gz
fi
cd $HOME
#Create desktop shortcut
echo "[Desktop Entry]
StartupNotify=true
Terminal=false
Type=Application
Name=Discord
Path=$HOME/discord-electron
Exec=$HOME/discord-electron/discord
Icon=/home/pi/pi-apps/apps/Discord/icon-64.png
Categories=Network;Chat;VideoConference;WebApp;Internet
Comment=Your place to talk!
GenericName=Network Messenger" > ~/.local/share/applications/discord.desktop