mirror of
https://github.com/km4ack/patmenu2.git
synced 2025-05-27 20:10:11 -07:00
commit
070d741c2b
@ -22,7 +22,15 @@ MYPATH=$HOME/patmenu2/ardop-list/
|
||||
#my log file
|
||||
LOG=$HOME/Documents/mylog.txt
|
||||
|
||||
GRIDCK=$(jq .locator $HOME/.wl2k/config.json)
|
||||
#set config file location for pat version
|
||||
VERSION=$(pat version | awk '{print $2}' | awk -F "." '{print $2}')
|
||||
if [ $VERSION -le 11 ]; then
|
||||
MYCONFIG=$HOME/.wl2k/config.json
|
||||
else
|
||||
MYCONFIG=$HOME/.config/pat/config.json
|
||||
fi
|
||||
|
||||
GRIDCK=$(jq .locator $MYCONFIG)
|
||||
if [ ${#GRIDCK} -lt 3 ]
|
||||
then
|
||||
echo "Grid square not set in Pat Configure" | tee -a $LOG
|
||||
@ -30,7 +38,7 @@ echo "Distances/Bearings will not be accurate"
|
||||
exit
|
||||
fi
|
||||
|
||||
GRID=$(grep locator ~/.wl2k/config.json | sed 's/"locator"://;s/"//g;s/,//;s/ //g')
|
||||
GRID=$(grep locator $MYCONFIG | sed 's/"locator"://;s/"//g;s/,//;s/ //g')
|
||||
echo "GRID=$GRID" > $HOME/patmenu2/.grid
|
||||
|
||||
#make directory if it doesn't exist
|
||||
|
26
FA-functions
26
FA-functions
@ -3,7 +3,7 @@
|
||||
|
||||
MYPATH=$HOME/patmenu2
|
||||
MAIN=$MYPATH/./find2
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
TEMP=$HOME/patmenu2/tempconfig.txt
|
||||
TODAY=$(date +%Y%m%d-%R)
|
||||
WHO=$(whoami)
|
||||
@ -30,7 +30,7 @@ exit
|
||||
AUTODOWN(){
|
||||
FILE=/run/user/$UID/cronbkup.txt
|
||||
crontab -l > $FILE
|
||||
HOURS=At-Boot,00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23
|
||||
HOURS=Disable,At-Boot,00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23
|
||||
MINS=00,15,30,45
|
||||
|
||||
TEST=$(yad --center --wrap --width=350 --title="Auto Download" --text-align=center \
|
||||
@ -59,6 +59,12 @@ sed -i '/getardoplist/d' $FILE
|
||||
$MAIN &
|
||||
rm $FILE
|
||||
exit
|
||||
elif [ $HOUR = 'Disable' ]; then
|
||||
sed -i s'/getardoplist-cron/d' $FILE
|
||||
crontab $FILE
|
||||
yad --center --timeout=3 --timeout-indicator=top --no-buttons --text="Auto Download Disabled" \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top
|
||||
$MAIN & exit
|
||||
|
||||
else
|
||||
|
||||
@ -86,7 +92,7 @@ fi
|
||||
#--------------------------------
|
||||
GRIDSEARCH(){
|
||||
OUTFILE=/run/user/$UID/tempardoplist.txt
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
TEMP=/run/user/$UID/tempconfig.txt
|
||||
ARDOPLIST=$MYPATH/ardop-list
|
||||
WHO=$(whoami)
|
||||
@ -307,7 +313,7 @@ yad --center --timeout=3 --timeout-indicator=top --no-buttons --text="You are no
|
||||
fi
|
||||
|
||||
#Create temp config file to use for downloads
|
||||
MAINFILE=$HOME/.wl2k/config.json
|
||||
MAINFILE=$XDG_CONFIG_HOME/pat/config.json
|
||||
TEMPFILE=/run/user/$UID/config.json
|
||||
cp $MAINFILE $TEMPFILE
|
||||
|
||||
@ -333,11 +339,11 @@ FOLDER=$HOME/patmenu2/alt-ardop-list/ardop-list-$GRID
|
||||
mkdir -p $FOLDER
|
||||
echo "downloading....please wait"
|
||||
DL(){
|
||||
pat --config /run/user/1000/config.json rmslist -s --band 80m --mode ardop --force-download > $FOLDER/80mardoplist.txt
|
||||
pat --config /run/user/1000/config.json rmslist -s --band 40m --mode ardop --force-download > $FOLDER/40mardoplist.txt
|
||||
pat --config /run/user/1000/config.json rmslist -s --band 30m --mode ardop --force-download > $FOLDER/30mardoplist.txt
|
||||
pat --config /run/user/1000/config.json rmslist -s --band 20m --mode ardop --force-download > $FOLDER/20mardoplist.txt
|
||||
pat --config /run/user/1000/config.json rmslist -s --mode packet --force-download > $FOLDER/packet.txt
|
||||
pat --config /run/user/$UID/config.json rmslist -s --band 80m --mode ardop --force-download > $FOLDER/80mardoplist.txt
|
||||
pat --config /run/user/$UID/config.json rmslist -s --band 40m --mode ardop --force-download > $FOLDER/40mardoplist.txt
|
||||
pat --config /run/user/$UID/config.json rmslist -s --band 30m --mode ardop --force-download > $FOLDER/30mardoplist.txt
|
||||
pat --config /run/user/$UID/config.json rmslist -s --band 20m --mode ardop --force-download > $FOLDER/20mardoplist.txt
|
||||
pat --config /run/user/$UID/config.json rmslist -s --mode packet --force-download > $FOLDER/packet.txt
|
||||
yad --center --timeout=2 --timeout-indicator=top --no-buttons --text="Downloads Done" &
|
||||
}
|
||||
DL | yad --center --progress --pulsate --auto-close --no-buttons --text-align=center \
|
||||
@ -389,7 +395,7 @@ $MAIN &
|
||||
exit
|
||||
fi
|
||||
#backup home grid before loading alt grid
|
||||
HOMEGRID=$(grep locator $HOME/.wl2k/config.json | sed 's/"//g;s/locator://;s/,//;s/ //g')
|
||||
HOMEGRID=$(grep locator $XDG_CONFIG_HOME/pat/config.json | sed 's/"//g;s/locator://;s/,//;s/ //g')
|
||||
if [ ! -d $HOME/patmenu2/alt-ardop-list/ardop-list-$HOMEGRID ]; then
|
||||
echo "Backing up home grid"
|
||||
mkdir -p $HOME/patmenu2/alt-ardop-list/ardop-list-$HOMEGRID
|
||||
|
@ -4,7 +4,7 @@
|
||||
#20191126 km4ack
|
||||
|
||||
MYPATH=$HOME/patmenu2
|
||||
FILE=/run/user/1000/cronbkup.txt
|
||||
FILE=/run/user/$UID/cronbkup.txt
|
||||
|
||||
crontab -l > $FILE
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
MYPATH=$HOME/patmenu2
|
||||
LOGO=$MYPATH/pmlogo.png
|
||||
MAIN=$MYPATH/./catalog
|
||||
PATCONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
|
||||
#get callsign from pat config file
|
||||
CALLSIGN=$(cat $HOME/.wl2k/config.json | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//' | tr '[:lower:]' '[:upper:]')
|
||||
CALLSIGN=$(cat $PATCONFIG | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//' | tr '[:lower:]' '[:upper:]')
|
||||
|
||||
|
||||
#COMPOSE EMAIL Function
|
||||
@ -25,7 +26,7 @@ TODAY1=$(date)
|
||||
NEW_UUID=$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 12 | head -n 1)
|
||||
|
||||
#add .b2f to end of random number for new file name
|
||||
NEW_FILE=$HOME/.wl2k/mailbox/$CALLSIGN/out/$NEW_UUID".b2f"
|
||||
NEW_FILE=$HOME/.local/share/pat/mailbox/$CALLSIGN/out/$NEW_UUID".b2f"
|
||||
|
||||
#create new file
|
||||
touch $NEW_FILE
|
||||
|
14
changelog
14
changelog
@ -1,7 +1,19 @@
|
||||
release=2.4.0
|
||||
release=2.6.0
|
||||
|
||||
|
||||
Changelog
|
||||
2.6.0 add version check
|
||||
add peer to peer alias
|
||||
2.6.0 does not support version of Pat prior to v0.12.0
|
||||
|
||||
2.5.0 update paths to accommodate Pat v0.12
|
||||
#Pat Menu 2.6 will not support older versions of Pat once it is released as stable code.
|
||||
#For now, 2.5 will remain on a seperate branch on GitHub. The master branch will continue
|
||||
#to support Pat v0.11 and earlier for the time being.
|
||||
fix pat port variable in quick stats
|
||||
add config repair
|
||||
add disable for auto list download
|
||||
add version check to .getardoplist-cron
|
||||
2.4.0 Add pat server status to quick stats https://github.com/km4ack/patmenu2/issues/25
|
||||
Add alternate grid download
|
||||
Add alternate grid selection
|
||||
|
12
find2
12
find2
@ -22,12 +22,12 @@ source $MYPATH/FA-functions
|
||||
yad --form --width=480 --text="<b>Find Gateways</b> by KM4ACK" --text-align=center --center --title="Find Gateways" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top \
|
||||
--text="<b>Find Gateways</b> by KM4ACK" \
|
||||
--field="Search for Gateway":fbtn 'bash -c "kill -USR1 $YAD_PID; source /home/pi/patmenu2/FA-functions; GRIDSEARCH"' \
|
||||
--field="View Grid Map":fbtn 'bash -c "source /home/pi/patmenu2/FA-functions; MAP"' \
|
||||
--field="Download Home Grid Gateway List":fbtn 'bash -c "kill -USR1 $YAD_PID; source /home/pi/patmenu2/FA-functions; DOWNLIST"' \
|
||||
--field="Download Alternate Grid Gateway List":fbtn 'bash -c "kill -USR1 $YAD_PID; source /home/pi/patmenu2/FA-functions; ALTGRID"' \
|
||||
--field="Load Alternate Grid Gateway List":fbtn 'bash -c "kill -USR1 $YAD_PID; source /home/pi/patmenu2/FA-functions; LOADALTGRID"' \
|
||||
--field="Auto Download Home Grid List <b>$CURRENT</b>":fbtn 'bash -c "kill -USR1 $YAD_PID; source /home/pi/patmenu2/FA-functions; AUTODOWN"' \
|
||||
--field="Search for Gateway":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/FA-functions; GRIDSEARCH"' \
|
||||
--field="View Grid Map":fbtn 'bash -c "source $MYPATH/FA-functions; MAP"' \
|
||||
--field="Download Home Grid Gateway List":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/FA-functions; DOWNLIST"' \
|
||||
--field="Download Alternate Grid Gateway List":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/FA-functions; ALTGRID"' \
|
||||
--field="Load Alternate Grid Gateway List":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/FA-functions; LOADALTGRID"' \
|
||||
--field="Auto Download Home Grid List <b>$CURRENT</b>":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/FA-functions; AUTODOWN"' \
|
||||
--field="Home $LASTDL":LBL \
|
||||
--field="Grid List Currently Loaded <b>$GRID</b>":LBL \
|
||||
--button="Main Menu":1
|
||||
|
@ -22,7 +22,7 @@ MYPATH=$HOME/patmenu2/ardop-list/
|
||||
#my log file
|
||||
LOG=$HOME/Documents/mylog.txt
|
||||
|
||||
GRIDCK=$(jq .locator $HOME/.wl2k/config.json)
|
||||
GRIDCK=$(jq .locator $XDG_CONFIG_HOME/pat/config.json)
|
||||
if [ ${#GRIDCK} -lt 3 ]
|
||||
then
|
||||
echo "Grid square not set in Pat Configure" | tee -a $LOG
|
||||
@ -42,7 +42,7 @@ FORTY=$MYPATH'40mardoplist.txt'
|
||||
TWENTY=$MYPATH'20mardoplist.txt'
|
||||
THIRTY=$MYPATH'30mardoplist.txt'
|
||||
PACKET=$MYPATH'packet.txt'
|
||||
GRID=$(grep locator ~/.wl2k/config.json | sed 's/"locator"://;s/"//g;s/,//;s/ //g')
|
||||
GRID=$(grep locator $XDG_CONFIG_HOME/pat/config.json | sed 's/"locator"://;s/"//g;s/,//;s/ //g')
|
||||
echo "GRID=$GRID" > $HOME/patmenu2/.grid
|
||||
|
||||
#check internet connection
|
||||
|
@ -5,9 +5,9 @@ VERSION=$(cat $MYPATH/changelog | grep release | head -1 | sed 's/release=//')
|
||||
|
||||
source $MYPATH/config
|
||||
|
||||
IN=$HOME/.wl2k/mailbox/$MYCALLSIGN/in
|
||||
ARCHIVE=$HOME/.wl2k/mailbox/$MYCALLSIGN/archive
|
||||
SENT=$HOME/.wl2k/mailbox/$MYCALLSIGN/sent
|
||||
IN=$HOME/.local/share/pat/mailbox/$MYCALLSIGN/in
|
||||
ARCHIVE=$HOME/.local/share/pat/mailbox/$MYCALLSIGN/archive
|
||||
SENT=$HOME/.local/share/pat/mailbox/$MYCALLSIGN/sent
|
||||
|
||||
ARCHIVE-ALL(){
|
||||
mv $IN/* $ARCHIVE/
|
||||
@ -63,9 +63,9 @@ fi
|
||||
}
|
||||
|
||||
EMAILBKUP(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
WHO=$(whoami)
|
||||
CALL=$(cat $HOME/.wl2k/config.json | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//' | tr '[:lower:]' '[:upper:]')
|
||||
CALL=$(cat $XDG_CONFIG_HOME/pat/config.json | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//' | tr '[:lower:]' '[:upper:]')
|
||||
BKUPTIME=$(date +%Y%d%m-%H%M)
|
||||
|
||||
BACKUP=$(yad --form --width=420 --text-align=center --center --title="Email Backup" --text-align=center \
|
||||
@ -85,7 +85,7 @@ fi
|
||||
|
||||
DIR=$(echo $BACKUP | awk -F "|" '{print $1}')
|
||||
|
||||
cp -r $HOME/.wl2k/mailbox/$CALL $DIR/email.bkup.$BKUPTIME
|
||||
cp -r $HOME/.local/share/pat/mailbox/$CALL $DIR/email.bkup.$BKUPTIME
|
||||
|
||||
if [ -d $DIR/email.bkup.$BKUPTIME ]; then
|
||||
yad --center --text="Backup Complete" \
|
||||
@ -98,9 +98,9 @@ fi
|
||||
|
||||
EMAILRESTORE(){
|
||||
MYPATH=$HOME/dev/patmenu2
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
WHO=$(whoami)
|
||||
CALL=$(cat $HOME/.wl2k/config.json | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//' | tr '[:lower:]' '[:upper:]')
|
||||
CALL=$(cat $XDG_CONFIG_HOME/pat/config.json | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//' | tr '[:lower:]' '[:upper:]')
|
||||
|
||||
RESTORE=$(yad --form --width=420 --text-align=center --center --title="Email Restore" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
@ -121,10 +121,10 @@ DIR=$(echo $RESTORE | awk -F "|" '{print $1}')
|
||||
DIRCHECK=$(ls $DIR)
|
||||
COUNT=${#DIRCHECK}
|
||||
if [ "$COUNT" = 19 ]; then
|
||||
cp $DIR/archive/* $HOME/.wl2k/mailbox/$CALL/archive/
|
||||
cp $DIR/in/* $HOME/.wl2k/mailbox/$CALL/in/
|
||||
cp $DIR/out/* $HOME/.wl2k/mailbox/$CALL/out/
|
||||
cp $DIR/sent/* $HOME/.wl2k/mailbox/$CALL/sent/
|
||||
cp $DIR/archive/* $HOME/.local/share/pat/mailbox/$CALL/archive/
|
||||
cp $DIR/in/* $HOME/.local/share/pat/mailbox/$CALL/in/
|
||||
cp $DIR/out/* $HOME/.local/share/pat/mailbox/$CALL/out/
|
||||
cp $DIR/sent/* $HOME/.local/share/pat/mailbox/$CALL/sent/
|
||||
yad --form --width=420 --text-align=center --center --title="Email Restore" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>Email Restore</b> by KM4ACK\r\r<b>RESTORE COMPLETE</b>" \
|
||||
|
@ -15,9 +15,11 @@ yad --form --width=420 --text-align=center --center --title="Manage Pat" --text-
|
||||
--field="Set ARDOP Speed":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; SPEED"' \
|
||||
--field="Set ARDOP PTT":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; SETPTT"' \
|
||||
--field="Set Listen Mode":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; LISTEN"' \
|
||||
--field="Add P2P Alias":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; PEER"' \
|
||||
--field="Delete Alias":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; DELETEALIAS"' \
|
||||
--field="Backup Pat Config":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; BKUPCONFIG"' \
|
||||
--field="Restore Pat Config":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; RESTORECONFIG"' \
|
||||
--field="Repair Pat Config":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/manage-pat-functions; REPAIRCONFIG"' \
|
||||
--button="Main Menu":1
|
||||
BUT=$?
|
||||
|
||||
|
@ -5,7 +5,7 @@ LOGO=$MYPATH/pmlogo.png
|
||||
|
||||
DELETEALIAS(){
|
||||
|
||||
PATCONFIG=$HOME/.wl2k/config.json
|
||||
PATCONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
OUTFILE=/run/user/$UID/currentlist.txt
|
||||
TEMP=/run/user/$UID/patconfig.txt
|
||||
WHO=$(whoami)
|
||||
@ -63,7 +63,7 @@ exit
|
||||
}
|
||||
|
||||
LOGIN(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
WHO=$(whoami)
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ fi
|
||||
}
|
||||
|
||||
GPSGRID(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
|
||||
if ! hash ruby2.3 2>/dev/null; then
|
||||
echo "Ruby Not found on system"
|
||||
@ -180,11 +180,11 @@ fi
|
||||
}
|
||||
|
||||
RESTORECONFIG(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
OUTFILE=/run/user/$UID/config.list
|
||||
WHO=$(whoami)
|
||||
|
||||
ls $HOME/.wl2k/ | grep .bkup > $OUTFILE
|
||||
ls $XDG_CONFIG_HOME/pat/ | grep .bkup > $OUTFILE
|
||||
|
||||
INFO=$(PARSER='OFS="\n" {print $1}'
|
||||
|
||||
@ -204,7 +204,7 @@ $MAIN
|
||||
exit
|
||||
fi
|
||||
FILE=$(echo $INFO | awk -F "|" '{print $1}')
|
||||
cp $HOME/.wl2k/$FILE $CONFIG
|
||||
cp $XDG_CONFIG_HOME/pat/$FILE $CONFIG
|
||||
sudo killall pat
|
||||
sudo systemctl start pat@$WHO
|
||||
yad --form --width=420 --text-align=center --center --title="Config Restore" --text-align=center \
|
||||
@ -216,7 +216,7 @@ $MAIN
|
||||
}
|
||||
|
||||
BKUPCONFIG(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
WHO=$(whoami)
|
||||
DATE=$(date +%d%b%Y-%H%M)
|
||||
|
||||
@ -234,7 +234,7 @@ exit
|
||||
elif [ $BUT = 2 ]; then
|
||||
echo "Backing up file"
|
||||
BKUPCONFIG=config.$DATE.bkup
|
||||
cp $CONFIG $HOME/.wl2k/$BKUPCONFIG
|
||||
cp $CONFIG $XDG_CONFIG_HOME/pat/$BKUPCONFIG
|
||||
yad --form --width=420 --text-align=center --center --title="Config Backup" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>Config File Backup</b> by KM4ACK\r\r<b>Backup COMPLETE</b>" \
|
||||
@ -244,7 +244,7 @@ $MAIN
|
||||
}
|
||||
|
||||
SPEED(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
CURRENT=$(cat $CONFIG | grep -i max | sed 's/"Max":\ //' | tr -d "[:blank:]")
|
||||
WHO=$(whoami)
|
||||
NEW=$(yad --form --width=320 --text-align=center --center --title="Speed" --text-align=center \
|
||||
@ -275,7 +275,7 @@ exit
|
||||
|
||||
SETPTT(){
|
||||
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
WHO=$(whoami)
|
||||
|
||||
CURRENT=$(cat $CONFIG | grep ptt_ctrl | tail -1 | sed 's/"ptt_ctrl":\ //' | sed 's/,//' | tr -d "[:blank:]")
|
||||
@ -321,7 +321,7 @@ exit
|
||||
MANUALGPS() {
|
||||
|
||||
WHO=$(whoami)
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
|
||||
GRID=$(yad --form --width=400 --text-align=center --center --title="Set Grid" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
@ -454,9 +454,141 @@ $MAIN &
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
REPAIRCONFIG(){
|
||||
DIR=/run/user/$UID
|
||||
WHO=$(whoami)
|
||||
|
||||
FILECHECK=$(ls $DIR | grep config.json)
|
||||
if [ ! -z $FILECHECK ]; then
|
||||
rm $DIR/config.json*
|
||||
fi
|
||||
|
||||
|
||||
#Verify Pat installed and set path variable if it is
|
||||
if ! hash pat 2>/dev/null; then
|
||||
echo "Pat Winlink not found on this system"
|
||||
exit
|
||||
else
|
||||
PATV=$(pat version | awk '{print $2}' | sed 's/v0.//' | awk -F "." '{print $1}')
|
||||
if [ $PATV -le 11 ]; then
|
||||
PATPATH=$HOME/.wl2k/
|
||||
else
|
||||
PATPATH=$XDGHOME_CONFIG_PATH/
|
||||
fi
|
||||
fi
|
||||
|
||||
#user input
|
||||
SETTINGS=$(yad --form --width=600 --text-align=center --center --title="Repair Config File" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>Pat Menu\rConfig File Repair\r</b> by KM4ACK" \
|
||||
--field="Call Sign" "" \
|
||||
--field="Winlink Password" "" \
|
||||
--field="Six Character Grid Square" "" \
|
||||
--field="Allow access to Pat across network?":CB "YES|NO" \
|
||||
--button="Repair Config File":2 \
|
||||
--button="Cancel":1)
|
||||
BUT=$?
|
||||
if [ $BUT = 1 ]; then
|
||||
$MAIN
|
||||
elif [ $BUT = 252 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
#parse input into variables
|
||||
CALL=$(echo $SETTINGS | awk -F "|" '{print $1}')
|
||||
CALL=${CALL^^}
|
||||
PASSWD=$(echo $SETTINGS | awk -F "|" '{print $2}')
|
||||
GRID=$(echo $SETTINGS | awk -F "|" '{print $3}')
|
||||
GRID=${GRID^^}
|
||||
SECURE=$(echo $SETTINGS | awk -F "|" '{print $4}')
|
||||
|
||||
|
||||
|
||||
if [ "$SECURE" = 'NO' ]; then
|
||||
SECURE="127.0.0.1"
|
||||
else
|
||||
SECURE="0.0.0.0"
|
||||
fi
|
||||
|
||||
#check to see if EES is installed and set port accordingly
|
||||
if [ -f /var/www/html/celladdy.php ]; then
|
||||
PORT=5000
|
||||
else
|
||||
PORT=8080
|
||||
fi
|
||||
|
||||
#download config.json file from km4ack github
|
||||
cd $DIR
|
||||
wget -q https://raw.githubusercontent.com/km4ack/pi-scripts/master/config.json
|
||||
|
||||
#verify download success
|
||||
if [ $? != 0 ]; then
|
||||
yad --title="Cannot Download!" --width=300 --height=100 \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top \
|
||||
--center --text="<b>Cannot download new config file.\rCheck internet connection</b>" \
|
||||
--button=gtk-ok
|
||||
$MAIN & exit
|
||||
fi
|
||||
|
||||
#update file with user settings
|
||||
sed -i "s/N0CALL/$CALL/" $DIR/config.json
|
||||
sed -i "s/PASSWORD/$PASSWD/" $DIR/config.json
|
||||
sed -i "s/GRID/$GRID/" $DIR/config.json
|
||||
sed -i "s/8080/$PORT/" $DIR/config.json
|
||||
sed -i "s/127.0.0.1/$SECURE/" $DIR/config.json
|
||||
|
||||
#cp file and restart pat
|
||||
cp $DIR/config.json $PATPATH/
|
||||
sudo systemctl restart pat@$WHO
|
||||
|
||||
yad --title="Repair Complete" --width=300 --height=100 \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top \
|
||||
--center --text="<b>Config File Repaired</b>" \
|
||||
--button=gtk-ok
|
||||
$MAIN & exit
|
||||
}
|
||||
|
||||
PEER(){
|
||||
TEMP_DIR=/run/user/$UID
|
||||
CONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
TEMP_CONFIG=$TEMP_DIR/temp-config.txt
|
||||
WHO=`whoami`
|
||||
|
||||
#get data from user
|
||||
PEER=$(yad --center --wrap --width=450 --title="Add P2P Alias" --text-align=center \
|
||||
--text="Enter the Peer to Peer Details Below\rIf using a hostname, add \".local\" to the end.\rExample: <b>raspberrypi.local</b>" \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top \
|
||||
--button="Update:2" \
|
||||
--button="Cancel:1" \
|
||||
--form --separator="|" --item-separator="|" \
|
||||
--field="Call Sign of Remote Station" \
|
||||
--field="IP address <b>OR</b> hostname of Remote Station" \
|
||||
)
|
||||
BUT=$?
|
||||
if [ $BUT = 1 ]; then
|
||||
$MAIN & exit
|
||||
elif [ $BUT = 252 ]; then
|
||||
exit
|
||||
elif [ $BUT = 2 ]; then
|
||||
#parse info entered above
|
||||
REMOTE_CALL=$(echo $PEER | awk -F "|" '{print $1}')
|
||||
REMOTE_CALL=${REMOTE_CALL^^}
|
||||
IP=$(echo $PEER | awk -F "|" '{print $2}')
|
||||
#create shortcut
|
||||
SC="telnet://{mycall}:CMSTelnet@$IP:8774/wl2k"
|
||||
#mod config file
|
||||
jq '.connect_aliases += {'\"P2P-"$REMOTE_CALL"-"$IP"\"' : '\"$SC\"'}' $CONFIG > $TEMP_CONFIG
|
||||
cp $TEMP_CONFIG $CONFIG
|
||||
sudo systemctl restart pat@$WHO
|
||||
|
||||
#give user notice
|
||||
yad --form --width=420 --text-align=center --center --title="P2P Alias Add" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>P2P Alias Added</b>" \
|
||||
--button=gtk-ok
|
||||
$MAIN
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
MYPATH=$HOME/patmenu2
|
||||
LOGO=$MYPATH/pmlogo.png
|
||||
MAIN=$MYPATH/./patmenu
|
||||
PATCONFIG=$XDG_CONFIG_HOME/pat/config.json
|
||||
|
||||
AUTOPAT(){
|
||||
|
||||
@ -134,13 +135,13 @@ fi
|
||||
}
|
||||
|
||||
STATS(){
|
||||
CONFIG=$HOME/.wl2k/config.json
|
||||
CONFIG=$PATCONFIG
|
||||
SMD=/lib/systemd/system/pat@.service
|
||||
CALL=$(grep mycall $CONFIG | head -1 | sed s'/"mycall": //;s/"//g;s/,//;s/ //g')
|
||||
GRID=$(grep locator $CONFIG | sed 's/"//g;s/locator://;s/,//;s/ //g')
|
||||
ARDOPMAX=$(grep -i max $CONFIG | sed 's/"Max":\ //;s/ //g')
|
||||
PTT=$(grep ptt_ctrl $CONFIG | tail -1 | sed 's/"ptt_ctrl":\ //;s/,//;s/ //g')
|
||||
PORT=$(grep http_addr $CONFIG | sed 's/^.*0://;s/",//')
|
||||
PORT=$(grep http_addr $CONFIG | awk '{print $2}' | sed 's/.*://;s/",//')
|
||||
RIG=$(grep RIGCONTROL $HOME/patmenu2/config | sed 's/RIGCONTROL=//')
|
||||
TELNET=$(grep telnet, $SMD)
|
||||
ARDOP=$(grep ardop, $SMD)
|
||||
|
13
patmenu
13
patmenu
@ -12,6 +12,19 @@ VERSION=$(cat $MYPATH/changelog | grep release | head -1 | sed 's/release=//')
|
||||
|
||||
source $MYPATH/config
|
||||
|
||||
#verify pat is at least v0.12.0
|
||||
PAT_VER=`pat version | awk '{print $2}' | awk -F "." '{print $2}'`
|
||||
|
||||
if [ $PAT_VER -lt 12 ]; then
|
||||
#give user notice
|
||||
yad --form --width=420 --text-align=center --center --title="Pat out of Date" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="Pat Menu only supports Pat Winlink\rversion 0.12.0 or later\r<b>Please update Pat Winlink</b>" \
|
||||
--button=gtk-ok
|
||||
exit
|
||||
fi
|
||||
|
||||
#verify call is set
|
||||
if [ "$MYCALLSIGN" = "N0CALL" ]; then
|
||||
yad --title="N0CALL" --width=400 --height=100 \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
||||
|
@ -123,7 +123,7 @@ yad --title="ARDOP MODEM" --width=400 --height=100 \
|
||||
fi
|
||||
|
||||
#open pat inbox in browser
|
||||
export DISPLAY=:0 && chromium-browser --app=http://127.0.0.1:$PORT > /dev/null 2>&1 &
|
||||
export DISPLAY=:0 && chromium-browser http://127.0.0.1:$PORT > /dev/null 2>&1 &
|
||||
|
||||
|
||||
|
||||
|
@ -149,7 +149,7 @@ yad --title="PACKET MODEM" --width=400 --height=100 \
|
||||
fi
|
||||
|
||||
#open pat inbox in browser
|
||||
export DISPLAY=:0 && chromium-browser --app=http://127.0.0.1:$PORT > /dev/null 2>&1 &
|
||||
export DISPLAY=:0 && chromium-browser http://127.0.0.1:$PORT > /dev/null 2>&1 &
|
||||
|
||||
#exit 0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user