mirror of
https://github.com/km4ack/patmenu2.git
synced 2025-05-19 08:10:12 -07:00
clean up code
This commit is contained in:
parent
1e55185698
commit
3f839a11d1
56
autopat-vara
56
autopat-vara
@ -14,9 +14,7 @@ MAIN=$MYPATH/patmenu
|
|||||||
source $MYPATH/config
|
source $MYPATH/config
|
||||||
|
|
||||||
#verify we have rig control
|
#verify we have rig control
|
||||||
if [ $RIGCONTROL == 'no' ]
|
if [ $RIGCONTROL == 'no' ]; then
|
||||||
then
|
|
||||||
|
|
||||||
yad --title="NO RIG CONTROL" --width=400 --height=100 \
|
yad --title="NO RIG CONTROL" --width=400 --height=100 \
|
||||||
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
||||||
--center --form --text="\r\r\r\rRig Control is needed for auto pat.\rPlease configure rig control and try again." \
|
--center --form --text="\r\r\r\rRig Control is needed for auto pat.\rPlease configure rig control and try again." \
|
||||||
@ -55,8 +53,7 @@ STARTRIG () {
|
|||||||
#start rigctld & restart pat
|
#start rigctld & restart pat
|
||||||
PIDCTL=$(pidof rigctld)
|
PIDCTL=$(pidof rigctld)
|
||||||
WHO=$(whoami)
|
WHO=$(whoami)
|
||||||
if [ -z "$PIDCTL" ]
|
if [ -z "$PIDCTL" ]; then
|
||||||
then
|
|
||||||
CONTROL=$(echo $RIG | sed 's/rigctl/rigctld/')
|
CONTROL=$(echo $RIG | sed 's/rigctl/rigctld/')
|
||||||
$CONTROL &
|
$CONTROL &
|
||||||
sudo -A systemctl restart pat@$WHO
|
sudo -A systemctl restart pat@$WHO
|
||||||
@ -65,8 +62,7 @@ WHO=$(whoami)
|
|||||||
|
|
||||||
STARTRIG
|
STARTRIG
|
||||||
|
|
||||||
if [ -z "$PIDCTL" ]
|
if [ -z "$PIDCTL" ]; then
|
||||||
then
|
|
||||||
STARTRIG
|
STARTRIG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -90,45 +86,37 @@ exit 0
|
|||||||
}
|
}
|
||||||
|
|
||||||
#check if distance is empty and give direction
|
#check if distance is empty and give direction
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
|
||||||
directions
|
directions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check if band is empty and give direction
|
#check if band is empty and give direction
|
||||||
if [ -z "$2" ]
|
if [ -z "$2" ]; then
|
||||||
then
|
|
||||||
directions
|
directions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Check for min distance
|
#Check for min distance
|
||||||
if [ -z "$3" ]
|
if [ -z "$3" ]; then
|
||||||
then
|
|
||||||
MIN=0
|
MIN=0
|
||||||
else
|
else
|
||||||
MIN=$3
|
MIN=$3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#take $2 as band to use
|
#take $2 as band to use
|
||||||
if [ $2 = "20" ]
|
if [ $2 = "20" ]; then
|
||||||
then
|
|
||||||
FILE=$VARALIST"20mvaralist.txt"
|
FILE=$VARALIST"20mvaralist.txt"
|
||||||
elif [ $2 = "30" ]
|
elif [ $2 = "30" ]; then
|
||||||
then
|
|
||||||
FILE=$VARALIST"30mvaralist.txt"
|
FILE=$VARALIST"30mvaralist.txt"
|
||||||
elif [ $2 = "40" ]
|
elif [ $2 = "40" ]; then
|
||||||
then
|
|
||||||
FILE=$VARALIST"40mvaralist.txt"
|
FILE=$VARALIST"40mvaralist.txt"
|
||||||
elif [ $2 = "80" ]
|
elif [ $2 = "80" ]; then
|
||||||
then
|
|
||||||
FILE=$VARALIST"80mvaralist.txt"
|
FILE=$VARALIST"80mvaralist.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Verify we have a list to work with
|
#Verify we have a list to work with
|
||||||
test -f $FILE
|
test -f $FILE
|
||||||
FILERESULT=$(echo $?)
|
FILERESULT=$(echo $?)
|
||||||
if [ $FILERESULT = "1" ]
|
if [ $FILERESULT = "1" ]; then
|
||||||
then
|
|
||||||
echo "FILE DOESN'T EXIST."
|
echo "FILE DOESN'T EXIST."
|
||||||
yad --title="NO LIST" --width=400 --height=100 \
|
yad --title="NO LIST" --width=400 --height=100 \
|
||||||
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
||||||
@ -146,11 +134,15 @@ BUT=$?
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $AMRRON = "no" ]
|
if [ $AMRRON = "no" ]; then
|
||||||
then
|
|
||||||
#start varaHF modem
|
#start varaHF modem
|
||||||
echo "Starting VARA-HF modem"
|
echo "Starting VARA-HF modem"
|
||||||
/usr/local/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 &
|
/usr/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 &
|
||||||
|
echo "standby while the modem starts....."
|
||||||
|
sleep 10 #give vara time to start
|
||||||
|
else
|
||||||
|
echo "Starting VARA-HF modem"
|
||||||
|
/usr/bin/wine $HOME/.wine/drive_c/VARA/VARA.exe > /dev/null 2>&1 &
|
||||||
echo "standby while the modem starts....."
|
echo "standby while the modem starts....."
|
||||||
sleep 10 #give vara time to start
|
sleep 10 #give vara time to start
|
||||||
fi
|
fi
|
||||||
@ -160,8 +152,7 @@ connect () {
|
|||||||
pat connect $CALL
|
pat connect $CALL
|
||||||
#Check if connection was successful
|
#Check if connection was successful
|
||||||
RESULTS=$(echo $?)
|
RESULTS=$(echo $?)
|
||||||
if [ $RESULTS = "0" ]
|
if [ $RESULTS = "0" ]; then
|
||||||
then
|
|
||||||
echo "A connection was made"
|
echo "A connection was made"
|
||||||
echo $DATE" "$CALL" Success with autopat" >> $LOG
|
echo $DATE" "$CALL" Success with autopat" >> $LOG
|
||||||
CALL=$(echo "$CALL" | sed 's/&/ /')
|
CALL=$(echo "$CALL" | sed 's/&/ /')
|
||||||
@ -171,8 +162,7 @@ yad --title="SUCCESS" --width=300 --height=100 \
|
|||||||
--center --form --text="<b>Successfully connected!</b>\r$CALL\r\rSee mylog in documents\rdirectory for more details." \
|
--center --form --text="<b>Successfully connected!</b>\r$CALL\r\rSee mylog in documents\rdirectory for more details." \
|
||||||
--button=gtk-ok
|
--button=gtk-ok
|
||||||
|
|
||||||
if [ $AMRRON = "no" ]
|
if [ $AMRRON = "no" ]; then
|
||||||
then
|
|
||||||
sudo -A killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1
|
sudo -A killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1
|
||||||
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
|
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
|
||||||
kill -9 $VARA > /dev/null 2>&1
|
kill -9 $VARA > /dev/null 2>&1
|
||||||
@ -215,8 +205,7 @@ echo "Will Attempt to Connect to This Station"
|
|||||||
while read LINE
|
while read LINE
|
||||||
do DISTANCE=$(echo $LINE | awk '{ print $1 }')
|
do DISTANCE=$(echo $LINE | awk '{ print $1 }')
|
||||||
CALL=$(echo $LINE | awk '{ print $2 }')
|
CALL=$(echo $LINE | awk '{ print $2 }')
|
||||||
if [ $DISTANCE -lt "$1" ] && [ $DISTANCE -gt "$MIN" ]
|
if [ $DISTANCE -lt "$1" ] && [ $DISTANCE -gt "$MIN" ]; then
|
||||||
then
|
|
||||||
echo "Distance="$DISTANCE " Call="$CALL
|
echo "Distance="$DISTANCE " Call="$CALL
|
||||||
#call the connect funtion
|
#call the connect funtion
|
||||||
connect
|
connect
|
||||||
@ -227,8 +216,7 @@ done < $HOME/tempardop/sorted.txt
|
|||||||
#remove temp directory & files
|
#remove temp directory & files
|
||||||
rm -rf $HOME/tempardop
|
rm -rf $HOME/tempardop
|
||||||
|
|
||||||
if [ $AMRRON = "no" ]
|
if [ $AMRRON = "no" ]; then
|
||||||
then
|
|
||||||
sudo -A killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1
|
sudo -A killall direwolf piardopc kissattach piARDOP_GUI rigctld > /dev/null 2>&1
|
||||||
sudo -A rfcomm release /dev/rfcomm0 > /dev/null 2>&1
|
sudo -A rfcomm release /dev/rfcomm0 > /dev/null 2>&1
|
||||||
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
|
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user