#! /bin/bash # This program is a Command Line driven Menu for use with PAT. # Version 1.0 26-aug-2018 # Copyright (C) 2018 Charles S. Schuman, k4gbb1@gmail.com # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # To received a copy of the GNU General Public License # write to : # Free Software Foundation, Inc. # 51 Franklin Street, Fifth Floor # Boston, MA 02110-1301, USA. if [ ! -e "/usr/bin/pat" ] then echo "Can not find PAT ( /usr/bin/pat )" exit 1 fi if [ ! -e "/usr/bin/whiptail" ] then echo "Whiptail is missing." echo "install with sudo apt-get install whiptail" exit 1 fi function check_config { # Retreive call, password and location from config.json file. Mycall=(`less .wl2k/config.json|grep '"mycall":'|awk '{ print $2 }'`) Mypass=(`less .wl2k/config.json|grep '"secure_login_password":'|awk '{ print $2 }'`) Myqrl=(`less .wl2k/config.json|grep '"locator":'|awk '{ print $2 }'`) # Check for BLank variables. if [ $Mycall = '"",' ] ; then whiptail --title "ERROR" --msgbox "Mycall is blank" 7 60 pat configure else if [ $Mypass = '"",' ] ; then whiptail --title "ERROR" --msgbox "PASSWORD is blank" 7 60 pat configure else if [ $Myqrl = '"",' ] ; then whiptail --title "ERROR" --msgbox "Locator is blank" 7 60 pat configure fi fi fi } # Menu while [ 1 ] do CHOICE=$( whiptail --backtitle " Wl2K Messaging " --title "PAT Menu " \ --menu Select --nocancel 16 60 9 \ "1 Version" " - Version." \ "2 COMPOSE" " - Compose a message." \ "3 Connect" " - Connect via Telnet." \ "4 Connect" " - Connect via Ax.25." \ "5 Read " " - Read messages." \ "6 Monitor" " - Monitor Ax.25 port." \ "7 Edit " " - Configure PAT." \ "8 Heard " " - List stations heard"\ "9 Close " " - Exit Menu" 3>&2 2>&1 1>&3 ) case $CHOICE in 1\ *) return=$(pat version) whiptail --title " Version " --msgbox "$return" 7 60 ;; 2\ *) check_config pat compose return=" Message complete " whiptail --title " Compose " --msgbox " Message complete " 7 60 ;; 3\ *) clear check_config pat connect telnet return=`cat .wl2k/pat.log` whiptail --title "Connect via Telnet" --msgbox "$return" 25 60 ;; 4\ *) clear check_config pat connect ax25:///we4nc-10 return=`cat .wl2k/pat.log` whiptail --title " Connect via X.25 " --msgbox "$return" 25 60 ;; 5\ *) clear pat read return=" Return to Menu " whiptail --title " Menu " --msgbox "$return" 7 60 ;; 6\ *) whiptail --title " Info " --msgbox "Entering LISTEN - Ctl-C to Exit" 7 60 listen -cart return=" Return to Menu" whiptail --title " Menu " --msgbox "$return" 7 60 ;; 7\ *) clear pat configure return=" pat.config complete" whiptail --title " Configure " --msgbox "$return" 7 60 ;; 8\ *) return=$(mheard) whiptail --title " Heard List " --msgbox "$return" 15 60 ;; 9\ *) clear exit 0 ;; esac done exit 0 # (END) patmenu