#!/bin/bash

#Menu system for interacting with Pat Winlink
#km4ack 20190404

#clear screen
clear

#Begin First Menu
echo;echo;echo;echo
echo Pat Menu by KM4ACK
echo
firstnames='Pat-Login Start-Pat-Ardop Stop-Pat Find-ARDOP-Gateways Quit'
PS3='Enter an Option Number: '
select firstname in $firstnames
do

if [[ -z "$firstname" ]]; then
   echo 
   printf "\033[1;31mPLEASE SELECT A NUMBER BETWEEN 1 & 5\033[0m\n"
fi

if [[ -z "$firstname" ]]; then
   echo
else
	if [ $firstname == 'Quit' ]
	then
	clear
	echo;echo;echo
	echo "If you enjoy this menu system please"
	echo "consider donating"
	echo;echo
	echo "Hold control key while clicking link"
	echo "https://www.paypal.me/km4ack/5usd"
	exit
	fi
fi

if [[ -z "$firstname" ]]; then
   echo
else
        if [ $firstname == 'Pat-Login' ]
        then
        lxterminal -e $HOME/ardop/patlogin
        fi
fi

if [[ -z "$firstname" ]]; then
   echo
else
        if [ $firstname == 'Start-Pat-Ardop' ]
        then
	echo "Pat Ardop will start in 5 seconds."
	echo "Press ctl+c to abort"
	sleep 5
        lxterminal -e $HOME/ardop/start-pat
        fi
fi

if [[ -z "$firstname" ]]; then
   echo
else
        if [ $firstname == 'Stop-Pat' ]
        then
        echo "Stopping Pat"
	lxterminal -e $HOME/ardop/stop-pat
        echo "Pat Has Been Stopped"
        fi
fi

if [[ -z "$firstname" ]]; then
   echo
else
        if [ $firstname == 'Find-ARDOP-Gateways' ]
        then
	lxterminal -e $HOME/ardop/findardop
        fi
fi

done
