#!/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
}

git clone https://github.com/spectrumgamer75/All-is-well || error "Failed to download!"
cd $HOME/All-is-well/aiw
chmod +x 'aiwrpi.sh'
echo "alias aiw=$HOME/All-is-well/aiw/aiwrpi.sh" >> ~/.bashrc
echo "[Desktop Entry]
Name=All Is Well
GenericName=Update Helper and Fixer
Comment= ALL IS WELL is a bash script that allows users to easily update and upgrade their repositories and packages on linux. It will also fix any broken packages and dependencies.
Exec=$HOME/All-is-well/aiw/aiwrpi.sh
Icon=$HOME/pi-apps/apps/All Is Well/icon-64.png
Terminal=true
StartupNotify=true
Type=Application
Categories=Utility;" > ~/.local/share/applications/aiw.desktop || error "Failed to create menu button!"
