#!/bin/bash DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")" red="\e[31m" normal="\e[0m" function error() { echo -e "${red}$1${normal}" exit 1 } #Removing existing /usr/local/bin/pi-apps and script echo -n "removing existing version of the script..." sudo rm -f /usr/local/bin/pi-apps rm -f "${DIRECTORY}/pi-apps-terminal-bash-edition.sh" echo "done" #Download script echo -n "Downloading script..." wget https://raw.githubusercontent.com/Itai-Nelken/PiApps-terminal_bash-edition/main/pi-apps-terminal-bash-edition.sh -O "${DIRECTORY}/pi-apps-terminal-bash-edition.sh" || error "Failed to download pi-apps terminal bash edition script!" echo "done" chmod u+x "${DIRECTORY}/pi-apps-terminal-bash-edition.sh" || error "Failed to mark ${DIRECTORY}/pi-apps-terminal-bash-edition.sh as executable!" #create launcher script echo -n "creating launcher script..." echo '#!/bin/bash '"${DIRECTORY}"'/pi-apps-terminal-bash-edition.sh "$@"' | sudo tee /usr/local/bin/pi-apps >/dev/null || error "Failed to create pi-apps command in '/usr/local/bin/'!" sudo chmod +x /usr/local/bin/pi-apps || error "Failed to make launcher script executable!" echo "done"