-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathspot-pota
More file actions
256 lines (224 loc) · 8.35 KB
/
spot-pota
File metadata and controls
256 lines (224 loc) · 8.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/bin/bash
#####################################################################################
# script to spot yourself and view POTA spots
# utilizing Winlink & potagw@outlook.com
# This can be done manually as described in this video https://youtu.be/yAVzdw7WonA
# 01JULY2023 KM4ACK
# 14JULY2023 last edit
#####################################################################################
############################################################
# Installation #
############################################################
# Download this script. Open the terminal,navigate to #
# where the script was downloaded, and run #
# bash spot-pota install #
# If you wish to uninstall later, run: #
# spot-pota uninstall #
############################################################
############################################################
# Change Log #
############################################################
# Version 2 14JULY2023
# include options for viewing spots
# add search feature
# add help section
############################################################
#set some variables
LOGO=$HOME/Pictures/pota.png
eval `pat env`
VERSION=2
#get call sign if pat winlink is installed
if [ $(which pat) ]; then
eval `pat env`
fi
#installation function
INSTALL(){
#verify YAD is installed
if [ ! $(which yad) ]; then
echo "YAD Not found but required"
read -p "Install YAD now? y/n " ans
if [ "$ans" = 'y' ] || [ "$ans" = 'Y' ]; then
sudo apt update
sudo apt install yad -y
fi
fi
echo "installing POTA Spots for Winlink"
chmod +x spot-pota
echo "moving file to /usr/local/bin"
sudo cp spot-pota /usr/local/bin
#download logo
if [ ! -f $HOME/Pictures/pota.png ]; then
mkdir -p $HOME/Pictures
echo "Downloading POTA logo"
wget https://raw.githubusercontent.com/km4ack/73Linux/master/data/ico/pota.png -P $HOME/Pictures/
fi
#create shortcut
echo "creating shortcut for POTA Spot"
shortcut=/run/user/$UID/spot-pota.desktop
echo "[Desktop Entry]" > $shortcut
echo "Name=POTA Spots" >> $shortcut
echo "Comment=POTA Spots with Winlink" >> $shortcut
echo "GenericName=POTA Spots with Winlink" >> $shortcut
echo "Exec=/usr/local/bin/spot-pota" >> $shortcut
echo "Icon=$HOME/Pictures/pota.png" >> $shortcut
echo "Type=Application" >> $shortcut
echo "Encoding=UTF-8" >> $shortcut
echo "Terminal=false" >> $shortcut
echo "Categories=HamRadio" >> $shortcut
echo "Keywords=Radio" >> $shortcut
#move shortcut to correct location
sudo mv $shortcut /usr/local/share/applications/
#give user some feedback
echo "POTA Spot installation done. If you wish to uninstall, run:"
echo "spot-pota uninstall"
echo "73, de KM4ACK"
exit
}
#uninstall function
UNINSTALL(){
echo "Uninstalling POTA Spots for Winlink"
sudo rm /usr/local/bin/spot-pota
sudo rm /usr/local/share/applications/spot-pota.desktop
rm $HOME/Pictures/pota.png
echo "Uninstall complete"
exit
}
#check to see if we are installing/uninstalling
if [ "$1" = 'install' ]; then
INSTALL
elif [ "$1" = 'uninstall' ]; then
UNINSTALL
fi
HELP(){
cat <<EOF > /run/user/$UID/temp_pota.txt
View Current Spots :: will get you the list of current
spots from the POTA website in the chosen format.
If you choose to include comments, be aware that
the resulting email will be larger and take longer
to download over RF.
Spot Yourself :: Use this option to post a spot
to the POTA website with your current activation details.
Search :: Use the search function to return details about
a park. You can search by Park name to get the park number
and grid square or search by park number to get the park name
and grid square.
Note: In each instance, a message is posted to the
Pat Winlink outbox. A Winlink connection must be made
to send the request. After sending the request (View/Search)
wait ~5 minutes and make another Winlink connection. The results
will then be returned to your inbox.
Uninstall :: If you wish to uninstall this application, open the
terminal and run
spot-pota uninstall
EOF
yad --width=700 --height=500 --text-align=left --center --title="Help" \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text-info \
--button=gtk-close < /run/user/$UID/temp_pota.txt
rm /run/user/$UID/temp_pota.txt
MENU
}
#main funtion
MENU(){
#give user choice of spotting or viewing spots
CHOICE=$(yad --form --width=420 --text-align=center --center --title="POTA Spots" \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="POTA Spot for Winlink\r by KM4ACK Version $VERSION" \
--field="Select One":CB "Spot Yourself|View Current Spots|Search|Help" \
--button="Exit":1 \
--button="Continue":2)
BUT=$?
if [ ${BUT} = 1 ] || [ ${BUT} = 252 ]; then
exit
fi
ans=$(echo $CHOICE | awk -F "|" '{print $1}')
case $ans in
"Spot Yourself")
#grab data for spot
INFO=$(yad --form --width=420 --text-align=center --center --title="Activation Info" --text-align=center \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="POTA Spot for Winlink\r by KM4ACK Version $VERSION\r Enter your details" \
--field="Call Sign" "$PAT_MYCALL" \
--field="Park Number" "K-2144" \
--field="Frequency (Hz)" "7157" \
--field="Mode":CB "SSB|CW|FT8|FT4|DATA|PHONE" \
--field="Comment" "" \
--button="Cancel":1 \
--button="Post Spot":2)
BUT=$?
if [ ${BUT} = 1 ]; then
MENU
elif [ ${BUT} = 252 ]; then
exit
fi
#parse data entered & store in variable
call=$(echo $INFO | awk -F "|" '{print $1}')
park=$(echo $INFO | awk -F "|" '{print $2}')
freq=$(echo $INFO | awk -F "|" '{print $3}')
mode=$(echo $INFO | awk -F "|" '{print $4}')
comment=$(echo $INFO | awk -F "|" '{print $5}')
echo "SPOT $call $park $freq $mode $comment" | pat compose potagw@outlook.com -s "$call $park $freq $mode $comment"
#give user feedback
yad --form --width=500 --text-align=center --center --title="Spot Posted" --text-align=center \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text="POTA Spot for Winlink\r by KM4ACK Version $VERSION\r <b>Spot Message Posted to Outbox</b>\rInitiate Winlink connection to send" \
--button=gtk-ok
MENU;;
"View Current Spots")
VIEW=$(yad --form --width=420 --text-align=center --center --title="Activation Info" --text-align=center \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="POTA Spot for Winlink\r by KM4ACK Version $VERSION" \
--field="Request Type":CB "Basic|Basic with Comments|HTML|HTML with Comments|CSV|CSV with Comments" \
--button="Cancel":1 \
--button="Post Request":2)
BUT=$?
if [ ${BUT} = 1 ]; then
MENU
elif [ ${BUT} = 252 ]; then
exit
fi
REQUEST=$(echo $VIEW | awk -F "|" '{print $1}')
case $REQUEST in
"Basic")
SUBJECT="VIEWSPOTS";;
"Basic with Comments")
SUBJECT="VIEWSPOTS -c";;
"HTML")
SUBJECT="VIEWSPOTS -p";;
"HTML with Comments")
SUBJECT="VIEWSPOTS -c -p";;
"CSV")
SUBJECT="VIEWSPOTS -a";;
"CSV with Comments")
SUBJECT="VIEWSPOTS -a -c";;
esac
#Post message to get active spots
echo "VIEWSPOTS" | pat compose potagw@outlook.com -s "$SUBJECT"
#Give user feedback
yad --form --width=500 --text-align=center --center --title="Request Posted" --text-align=center \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text="POTA Spot for Winlink\r by KM4ACK Version $VERSION\r <b>Request Posted to Outbox</b>\rInitiate Winlink connection to send" \
--button=gtk-ok
MENU;;
"Search")
SEARCH=$(yad --form --width=420 --text-align=center --center --title="Activation Info" --text-align=center \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="POTA Spot for Winlink\r by KM4ACK Version $VERSION\r\rEnter Search Terms" \
--field="Park Name or Number" "" \
--button="Cancel":1 \
--button="Post Search":2)
BUT=$?
if [ ${BUT} = 1 ]; then
MENU
elif [ ${BUT} = 252 ]; then
exit
fi
SEARCH=$(echo $SEARCH | awk -F "|" '{print $1}')
#echo $SEARCH; exit
echo "$SEARCH" | pat compose potagw@outlook.com -s "SEARCH $SEARCH"
;;
"Help")
HELP;;
esac
}
MENU #Call main menu