#!/bin/bash

version=23.03

# Get dependencies
install_packages xterm python3-pil python3-pil.imagetk python3-pip python3-psutil python3-distro python3-bs4 python3-dev python3-requests mpg123 lolcat || exit 1

rm -rf ~/PiGro-Aid- || error "Failed to first remove ~/PiGro-Aid- folder!"
git_clone https://github.com/actionschnitzel/PiGro-Aid- -b $version --depth=1 || error "Failed to clone repository!"

cd PiGro-Aid- || error "Failed to enter directory!"
chmod +x start.sh

mkdir -p $HOME/Desktop $HOME/.local/share/applications
echo "[Desktop Entry]
Version=2.1
Exec=$HOME/PiGro-Aid-/start.sh
Name=PiGro
GenericName=PiGro
Encoding=UTF-8
Terminal=false
Type=Application
Categories=System
Icon=$HOME/PiGro-Aid-/images/icons/logo.png
Path=$HOME/PiGro-Aid-/" > ~/Desktop/pigro.desktop

chmod +x ~/Desktop/pigro.desktop
cp ~/Desktop/pigro.desktop ~/.local/share/applications/pigro.desktop
