This repository has been archived by the owner on Feb 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qnconfig
executable file
·558 lines (539 loc) · 26.5 KB
/
qnconfig
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
#!/bin/bash
#
# Copyright (c) 2019-2020 by Thomas A. Early N7TAE
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
SetBooleanValue () {
local dvname
local cv
if [ -z $2 ]; then
if [ -z ${!1+x} ]; then
if [[ "$1" == module_[abc]_* ]]; then
echo matches
dvname=${1//_[abc]_/_x_}
else
echo does not match
dvname=${1}_d
fi
cv=${!dvname}
else
cv=${!1}
fi
if [[ $cv == [tT]* ]]; then
eval ${1}=false
else
eval ${1}=true
fi
elif [[ "$2" == [tT]* ]]; then
eval ${1}=true
else
eval ${1}=false
fi
}
EvaluateVar () {
if [ -z ${!1+x} ]; then
if [ -z "${!2}" ]; then
echo "'' <DEFAULT>"
else
echo "${!2} <DEFAULT>"
fi
else
if [ -z "${!1}" ]; then
echo "''"
else
echo "${!1}"
fi
fi
}
EndMenu () {
echo
echo "u <key> to unset the value of key (revert to the default value)."
echo "q to return to the main menu"
read -p "Please input: <key> <new_value> # omit value to toggle a true/false : " key value
}
LinkMenu () {
key=''
while [[ "$key" != q* ]]; do
clear
echo
echo " Link/D-Plus Menu"
echo
echo " 'CSV' means Comma Separated Values (of callsigns)"
echo " An empty CVS means everybody has permission"
echo -n "ad : CSV of calls that can execute scripts = "; EvaluateVar link_admin{,_d}
echo -n "li : CSV of calls that can link and unlink = "; EvaluateVar link_link_unlink{,_d}
echo -n "n : CSV of calls that cannot link&unlink = "; EvaluateVar link_no_link_unlink{,_d}
if [ -n "$em" ]; then
echo -n "i : Incoming IP address of QnetLink = "; EvaluateVar link_incoming_ip{,_d}
echo -n "r : UDP port for REF linking = "; EvaluateVar link_ref_port{,_d}
echo -n "x : UDP port for XRF linking = "; EvaluateVar link_xrf_port{,_d}
echo -n "d : DCS port for XRF linking = "; EvaluateVar link_dcs_port{,_d}
echo -n "la : Local IP address = "; EvaluateVar link_ip{,_d}
echo -n "lp : Local UDP Port # = "; EvaluateVar link_port{,_d}
echo -n "an : Announce linking = "; EvaluateVar link_announce{,_d}
echo -n "ac : Acknowledge link on each keyup = "; EvaluateVar link_acknowledge{,_d}
echo -n "m : Maximum # of dongles allowed = "; EvaluateVar link_max_dongles{,_d}
fi
echo
echo " Legacy D-Plus Repeaters and Reflectors"
echo -n "au : Authorize Legacy D-Plus Linking = "; EvaluateVar dplus_authorize{,_d}
echo -n "ap : DPlus Priority = "; EvaluateVar dplus_priority{,_d}
if [ -n "$em" ]; then
echo -n "lo : Login call for authorization server = "; EvaluateVar dplus_ref_login{,_d}
echo -n "RF : Add legacy reflectors to gateway list = "; EvaluateVar dplus_use_reflectors{,_d}
echo -n "RP : add legacy repeaters to gateway list = "; EvaluateVar dplus_use_repeaters{,_d}
fi
EndMenu
if [[ "$key" == ad* ]]; then link_admin="${value^^}"
elif [[ "$key" == li* ]]; then link_link_unlink="${value^^}"
elif [[ "$key" == n* ]]; then link_no_link_unlink="${value^^}"
elif [[ "$key" == i* ]]; then link_incoming_ip="$value"
elif [[ "$key" == r* ]]; then link_ref_port="$value"
elif [[ "$key" == x* ]]; then link_xrf_port="$value"
elif [[ "$key" == d* ]]; then link_dcs_port="$value"
elif [[ "$key" == la* ]]; then link_ip="$value"
elif [[ "$key" == lp* ]]; then link_port="$value"
elif [[ "$key" == an* ]]; then SetBooleanValue link_announce "$value"
elif [[ "$key" == ac* ]]; then SetBooleanValue link_acknowledge "$value"
elif [[ "$key" == m* ]]; then link_max_dongles="$value"
elif [[ "$key" == au* ]]; then SetBooleanValue dplus_authorize "$value"
elif [[ "$key" == ap* ]]; then SetBooleanValue dplus_priority "$value"
elif [[ "$key" == lo* ]]; then dplus_ref_login="${value^^}"
elif [[ "$key" == RF* ]]; then SetBooleanValue dplus_use_reflectors "$value"
elif [[ "$key" == RP* ]]; then SetBooleanValue dplus_use_repeaters "$value"
elif [[ "$key" == u* ]]; then
if [[ "$value" == ad* ]]; then unset link_admin
elif [[ "$value" == li* ]]; then unset link_link_unlink
elif [[ "$value" == n* ]]; then unset link_no_link_unlink
elif [[ "$value" == i* ]]; then unset link_incoming_ip
elif [[ "$value" == r* ]]; then unset link_ref_port
elif [[ "$value" == x* ]]; then unset link_xrf_port
elif [[ "$value" == d* ]]; then unset link_dcs_port
elif [[ "$value" == la* ]]; then unset link_ip
elif [[ "$value" == lp* ]]; then unset link_port
elif [[ "$value" == an* ]]; then unset link_announce
elif [[ "$value" == ac* ]]; then unset link_acknowledge
elif [[ "$value" == m* ]]; then unset link_max_dongles
elif [[ "$value" == au* ]]; then unset dplus_authorize
elif [[ "$value" == ap* ]]; then unset dplus_priority
elif [[ "$value" == lo* ]]; then unset dplus_ref_login
elif [[ "$value" == RF* ]]; then unset dplus_use_reflectors
elif [[ "$value" == RP* ]]; then unset dplus_use_repeaters
fi
fi
done
}
FileMenu () {
key=''
while [[ "$key" != q* ]]; do
clear
echo
if [ -z "$em" ]; then
echo " Debugging Menu"
else
echo " Debugging/Files/Timings Menu"
fi
echo
echo " Additional entries in log files (in /usr/local/var)"
echo -n "cl : Call(QSO) logging = "; EvaluateVar log_qso{,_d}
echo -n "il : IRC logging = "; EvaluateVar log_irc{,_d}
echo -n "dl : DTMF logging = "; EvaluateVar log_dtmf{,_d}
echo -n "xl : Debug logging = "; EvaluateVar log_debug{,_d}
echo " WARNING debug logging can produce large log file!"
if [ -n "$em" ]; then
echo
echo " Files and directories"
echo -n "sf : Repeater status file = "; EvaluateVar file_status{,_d}
echo -n "ed : Echo/Voicemail directory = "; EvaluateVar file_echotest{,_d}
echo -n "dd : DTMF directory = "; EvaluateVar file_dtmf{,_d}
echo -n "vf : QnetVoice filename = "; EvaluateVar file_qnvoicefile{,_d}
echo -n "gf : Gateways filename = "; EvaluateVar file_gwys{,_d}
echo -n "ad : Announce directory = "; EvaluateVar file_announce_dir{,_d}
echo
echo " Timing controls"
echo -n "et : Echo timeout (sec) = "; EvaluateVar timing_timeout_echo{,_d}
echo -n "vt : Voicemail timeout (sec) = "; EvaluateVar timing_timeout_voicemail{,_d}
echo -n "gt : G2 timeout (sec) = "; EvaluateVar timing_timeout_remote_g2{,_d}
echo -n "rt : Repeater timeout (sec) = "; EvaluateVar timing_timeout_local_rptr{,_d}
echo -n "pw : Echo play wait (sec) = "; EvaluateVar timing_play_wait{,_d}
echo -n "pd : Echo play delay (msec) = "; EvaluateVar timing_play_delay{,_d}
fi
EndMenu
if [[ "$key" == sf* ]]; then file_status="$value"
elif [[ "$key" == ed* ]]; then file_echotest="$value"
elif [[ "$key" == dd* ]]; then file_dtmf="$value"
elif [[ "$key" == vf* ]]; then file_qnvoicefile="$value"
elif [[ "$key" == gf* ]]; then file_gwys="$value"
elif [[ "$key" == ad* ]]; then file_announce_dir="$value"
elif [[ "$key" == cl* ]]; then SetBooleanValue log_qso "$value"
elif [[ "$key" == il* ]]; then SetBooleanValue log_irc "$value"
elif [[ "$key" == dl* ]]; then SetBooleanValue log_dtmf "$value"
elif [[ "$key" == xl* ]]; then SetBooleanValue log_debug "$value"
elif [[ "$key" == et* ]]; then timing_timeout_echo="$value"
elif [[ "$key" == vt* ]]; then timing_timeout_voicemail="$value"
elif [[ "$key" == gt* ]]; then timing_timeout_remote_g2="$value"
elif [[ "$key" == rt* ]]; then timing_timeout_local_rptr="$value"
elif [[ "$key" == pw* ]]; then timing_play_wait="$value"
elif [[ "$key" == pd* ]]; then timing_play_delay="$value"
elif [[ "$key" == u* ]]; then
if [[ "$value" == sf* ]]; then unset file_status
elif [[ "$value" == ed* ]]; then unset file_echotest
elif [[ "$value" == dd* ]]; then unset file_dtmf
elif [[ "$value" == vf* ]]; then unset file_qnvoicefile
elif [[ "$value" == gf* ]]; then unset file_gwys
elif [[ "$value" == ad* ]]; then unset file_announce_dir
elif [[ "$value" == cl* ]]; then unset log_qso
elif [[ "$value" == il* ]]; then unset log_irc
elif [[ "$value" == dl* ]]; then unset log_dtmf
elif [[ "$value" == xl* ]]; then unset log_debug
elif [[ "$value" == et* ]]; then unset timing_timeout_echo
elif [[ "$value" == vt* ]]; then unset timing_timeout_voicemail
elif [[ "$value" == gt* ]]; then unset timing_timeout_remote_g2
elif [[ "$value" == rt* ]]; then unset timing_timeout_local_rptr
elif [[ "$value" == pw* ]]; then unset timing_play_wait
elif [[ "$value" == pd* ]]; then unset timing_play_delay
fi
fi
done
}
IrcddbMenu () {
key=''
while [[ "$key" != q* ]]; do
clear
echo
echo " IRCDDB Menu"
echo
echo "l : Login - must be a legal callsign = '${ircddb_login}'"
echo -n "h : Hostname for IRC Server = "; EvaluateVar ircddb_host{,_d}
if [ -n "$em" ]; then
echo -n "po : IRC TCP port = "; EvaluateVar ircddb_port{,_d}
echo -n "pa : IRC Password = "; EvaluateVar ircddb_password{,_d}
fi
EndMenu
if [[ "$key" == l* ]]; then ircddb_login="${value^^}"
elif [[ "$key" == h* ]]; then ircddb_host="$value"
elif [[ "$key" == po* ]]; then ircddb_port="$value"
elif [[ "$key" == pa* ]]; then ircddb_password="$value"
elif [[ "$key" == u* ]]; then
if [[ "$value" == h* ]]; then unset ircddb_host
elif [[ "$value" == po* ]]; then unset ircddb_port
elif [[ "$value" == pa* ]]; then unset ircddb_password
fi
fi
done
}
GateMenu () {
key=''
while [[ "$key" != q* ]]; do
clear
echo
echo " Gateway/APRS Menu"
echo
echo " Gateway Option"
if [ -n "$em" ]; then
echo -n "r : Regenerate Headers = "; EvaluateVar gateway_header_regen{,_d}
echo -n "s : Send IRC network Module Info = "; EvaluateVar gateway_send_qrgs_maps{,_d}
echo -n "i : IRC TCP local network address = "; EvaluateVar gateway_local_irc_ip{,_d}
echo -n "xa : G2 external port address = "; EvaluateVar gateway_external_ip{,_d}
echo -n "xp : G2 external port number = "; EvaluateVar gateway_external_port{,_d}
echo -n "na : G2 internal port address = "; EvaluateVar gateway_internal_ip{,_d}
echo -n "np : G2 internal port number = "; EvaluateVar gateway_internal_port{,_d}
fi
echo -n "he : Gateway G2 healing = "; EvaluateVar gateway_healing{,_d}
echo -n "la : Latitude (-90.0 to 90.0) = "; EvaluateVar gateway_latitude{,_d}
echo -n "lo : Longitude (-180.0 to 180.0) = "; EvaluateVar gateway_longitude{,_d}
echo -n "d1 : Description #1 (20 chars max) = "; EvaluateVar gateway_desc1{,_d}
echo -n "d2 : Description #1 (20 chars max) = "; EvaluateVar gateway_desc2{,_d}
echo -n "w : URL (80 char max) = "; EvaluateVar gateway_url{,_d}
echo -n "fr : Find Route(s) = "; EvaluateVar gateway_find_route{,_d}
echo " Find Route(s) is a comma-separated list of common routing callsigns."
echo " These will be added to your local cache on boot-up."
echo
echo " APRS - Repeater/User position tracking"
echo -n "e : Enable APRS Tracking = "; EvaluateVar aprs_enable{,_d}
if [ -n "$em" ]; then
echo -n "ho : APRS hostname = "; EvaluateVar aprs_host{,_d}
echo -n "ap : APRS TCP port number = "; EvaluateVar aprs_port{,_d}
echo -n "k : APRS Keep-alive interval (min) = "; EvaluateVar aprs_interval{,_d}
echo -n "af : APRS Filter (experimental) = "; EvaluateVar aprs_filter{,_d}
fi
EndMenu
if [[ "$key" == r* ]]; then SetBooleanValue gateway_header_regen "$value"
elif [[ "$key" == s* ]]; then SetBooleanValue gateway_send_qrgs_maps "$value"
elif [[ "$key" == i* ]]; then gateway_local_irc_ip="$value"
elif [[ "$key" == xa* ]]; then gateway_external_ip="$value"
elif [[ "$key" == xp* ]]; then gateway_external_port="$value"
elif [[ "$key" == na* ]]; then gateway_internal_ip="$value"
elif [[ "$key" == np* ]]; then gateway_internal_port="$value"
elif [[ "$key" == he* ]]; then SetBooleanValue gateway_healing "$value"
elif [[ "$key" == la* ]]; then gateway_latitude="$value"
elif [[ "$key" == lo* ]]; then gateway_longitude="$value"
elif [[ "$key" == d1* ]]; then gateway_desc1="${value:0:20}"
elif [[ "$key" == d2* ]]; then gateway_desc2="${value:0:20}"
elif [[ "$key" == w* ]]; then gateway_url="${value:0:80}"
elif [[ "$key" == fr* ]]; then gateway_find_route="${value^^}"
elif [[ "$key" == e* ]]; then SetBooleanValue aprs_enable "$value"
elif [[ "$key" == ho* ]]; then aprs_host="$value"
elif [[ "$key" == ap* ]]; then aprs_port="$value"
elif [[ "$key" == k* ]]; then aprs_interval="$value"
elif [[ "$key" == af* ]]; then aprs_filter="$value"
elif [[ "$key" == u* ]]; then
if [[ "$value" == r* ]]; then unset gateway_header_regen
elif [[ "$value" == s* ]]; then unset gateway_send_qrgs_maps
elif [[ "$value" == i* ]]; then unset gateway_local_irc_ip
elif [[ "$value" == xa* ]]; then unset gateway_external_ip
elif [[ "$value" == xp* ]]; then unset gateway_external_port
elif [[ "$value" == na* ]]; then unset gateway_internal_ip
elif [[ "$value" == np* ]]; then unset gateway_internal_port
elif [[ "$value" == he* ]]; then unset gateway_healing
elif [[ "$value" == la* ]]; then unset gateway_latitude
elif [[ "$value" == lo* ]]; then unset gateway_longitude
elif [[ "$value" == d1* ]]; then unset gateway_desc1
elif [[ "$value" == d2* ]]; then unset gateway_desc2
elif [[ "$value" == w* ]]; then unset gateway_url
elif [[ "$value" == fr* ]]; then unset gateway_find_route
elif [[ "$value" == e* ]]; then unset aprs_enable
elif [[ "$value" == ho* ]]; then unset aprs_host
elif [[ "$value" == ap* ]]; then unset aprs_port
elif [[ "$value" == k* ]]; then unset aprs_interval
elif [[ "$value" == af* ]]; then unset aprs_filter
fi
fi
done
}
ModuleMenu () {
mod=module_${1}
if [[ $1 == a ]]; then
nmod='a'
elif [[ $1 == b ]]; then
nmod='b'
else
nmod='c'
fi
eval ${mod}=icom
key=''
while [[ "$key" != q* ]]; do
clear
echo
echo " Module ${1^^} Menu ($mod=${!mod})"
echo
echo -n "ls : Link at startup (must be 8 chars) = "; EvaluateVar {${mod},module_x}_link_at_start
if [ -n "$em" ]; then
echo -n "al : Automatic re-link on loss of link = "; EvaluateVar {${mod},module_x}_auto_link
fi
echo -n "cs : Callsign (uses ircddb_login if empty) = "; EvaluateVar {${mod},module_x}_callsign
echo -n "ra : Range (in meters, 1 mile=1609.344 meters) = "; EvaluateVar {${mod},module_x}_range
echo -n "ag : Above ground level (in meters) = "; EvaluateVar {${mod},module_x}_agl
if [ -n "$em" ]; then
echo -n "ip : IP Address = "; EvaluateVar {${mod},module_x}_ip
echo -n "po : Port number = "; EvaluateVar {${mod},module_x}_port
echo -n "in : Inactivity for this many minutes unlinks = "; EvaluateVar {${mod},module_x}_inactivity
echo -n "ac : Send acknowledgment on each transmission = "; EvaluateVar {${mod},module_x}_acknowledge
echo -n "ad : acknowledgment delay (in msec) = "; EvaluateVar {${mod},module_x}_ack_delay
fi
echo -n "fr : Frequency in MHz = "; EvaluateVar {${mod},dvap}_frequency
echo -n "of : Offset in Hz = "; EvaluateVar {${mod},dvap}_offset
echo "xx : Delete this module"
EndMenu
if [[ "$key" == ls* ]]; then
value="${value:0:8}"
eval ${mod}_link_at_start="'${value^^}'"
elif [[ "$key" == ac* ]]; then SetBooleanValue ${mod}_acknowledge "$value"
elif [[ "$key" == ad* ]]; then eval ${mod}_ack_delay="$value"
elif [[ "$key" == ag* ]]; then eval ${mod}_agl="$value"
elif [[ "$key" == al* ]]; then SetBooleanValue ${mod}_auto_link "$value"
elif [[ "$key" == cs* ]]; then eval ${mod}_callsign="${value^^}"
elif [[ "$key" == fr* ]]; then eval ${mod}_frequency="$value"
elif [[ "$key" == in* ]]; then eval ${mod}_inactivity="$value"
elif [[ "$key" == ip* ]]; then eval ${mod}_ip="$value"
elif [[ "$key" == po* ]]; then eval ${mod}_port="$value"
elif [[ "$key" == of* ]]; then eval ${mod}_offset="$value"
elif [[ "$key" == ra* ]]; then eval ${mod}_range="$value"
elif [[ "$key" == xx* ]]; then
unset ${mod}_{link_at_start,callsign,offset,range,agl,ip,port}
unset ${mod}_{inactivity,packet_wait,acknowledge,ack_delay,auto_link}
unset ${mod}
return
elif [[ "$key" == u* ]]; then
if [[ "$value" == ac* ]]; then unset ${mod}_acknowledge
elif [[ "$value" == ad* ]]; then unset ${mod}_ack_delay
elif [[ "$value" == ag* ]]; then unset ${mod}_agl
elif [[ "$value" == al* ]]; then unset ${mod}_auto_link
elif [[ "$value" == cs* ]]; then unset ${mod}_callsign
elif [[ "$value" == fr* ]]; then unset ${mod}_frequency
elif [[ "$value" == in* ]]; then unset ${mod}_inactivity
elif [[ "$value" == ip* ]]; then unset ${mod}_ip
elif [[ "$value" == po* ]]; then unset ${mod}_port
elif [[ "$value" == ls* ]]; then unset ${mod}_link_at_start
elif [[ "$value" == of* ]]; then unset ${mod}_offset
elif [[ "$value" == pw* ]]; then unset ${mod}_packet_wait
elif [[ "$value" == ra* ]]; then unset ${mod}_range
fi
fi
done
}
WriteCFGFile () {
local m p q outFile
if [ -z "$ircddb_login" ]; then
echo "You MUST set your ircddb login callsign (in the ircddb section)!"
read -p "Press <Enter> to continue: " ans
return
fi
outFile='./qn.cfg'
echo "# Created on `date`" > $outFile
# gateway_ section
echo "ircddb_login='$ircddb_login'" >> $outFile
[ -z "${ircddb_host+x}" ] || echo "ircddb_host='${ircddb_host}'" >> $outFile
[ -z "${ircddb_port+x}" ] || echo "ircddb_host=${ircddb_port}" >> $outFile
[ -z "${ircddb_password+x}" ] || echo "ircddb_password='${ircddb_password}'" >> $outFile
# module_?_ section
for m in a b c
do
p="module_$m"
if [ -n "${!p}" ]; then
echo "${p}=${!p}" >> $outFile
q=${p}_link_at_start; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile
q=${p}_auto_link; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_callsign; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile
q=${p}_offset; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_range; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_agl; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_inactivity; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_packet_wait; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_acknowledge; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_ack_delay; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
q=${p}_ip; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile
q=${p}_port; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile
fi
done
# gateway_section
[ -z "${gateway_header_regen+x}" ] || echo "gateway_header_regen=${gateway_header_regen}" >> $outFile
[ -z "${gateway_send_qrgs_maps+x}" ] || echo "gateway_send_qrgs_maps=${gateway_send_qrgs_maps}" >> $outFile
[ -z "${gateway_local_irc_ip+x}" ] || echo "gateway_local_irc_ip='${gateway_local_irc_ip}'" >> $outFile
[ -z "${gateway_internal_ip+x}" ] || echo "gateway_internal_ip=${gateway_internal_ip}" >> $outFile
[ -z "${gateway_internal_port+x}" ] || echo "gateway_internal_port=${gateway_internal_port}" >> $outFile
[ -z "${gateway_external_ip+x}" ] || echo "gateway_external_ip=${gateway_external_ip}" >> $outFile
[ -z "${gateway_external_port+x}" ] || echo "gateway_external_port=${gateway_external_port}" >> $outFile
[ -z "${gateway_healing+x}" ] || echo "gateway_healing=${gateway_healing}" >> $outFile
[ -z "${gateway_latitude+x}" ] || echo "gateway_latitude=${gateway_latitude}" >> $outFile
[ -z "${gateway_longitude+x}" ] || echo "gateway_longitude=${gateway_longitude}" >> $outFile
[ -z "${gateway_desc1+x}" ] || echo "gateway_desc1='${gateway_desc1}'" >> $outFile
[ -z "${gateway_desc2+x}" ] || echo "gateway_desc2='${gateway_desc2}'" >> $outFile
[ -z "${gateway_url+x}" ] || echo "gateway_url='${gateway_url}'" >> $outFile
[ -z "${gateway_find_route+x}" ] || echo "gateway_find_route='${gateway_find_route}'" >> $outFile
# arps_ section
[ -z "${aprs_enable+x}" ] || echo "aprs_enable=${aprs_enable}" >> $outFile
[ -z "${aprs_host+x}" ] || echo "aprs_host='${aprs_host}'" >> $outFile
[ -z "${aprs_port+x}" ] || echo "aprs_port=${aprs_port}" >> $outFile
[ -z "${aprs_interval+x}" ] || echo "aprs_interval=${aprs_interval}" >> $outFile
[ -z "${aprs_filter+x}" ] || echo "aprs_filter='${aprs_filter}'" >> $outFile
# link_ section
[ -z "${link_admin+x}" ] || echo "link_admin='${link_admin}'" >> $outFile
[ -z "${link_link_unlink+x}" ] || echo "link_link_unlink='${link_link_unlink}'" >> $outFile
[ -z "${link_no_link_unlink+x}" ] || echo "link_no_link_unlink='${link_no_link_unlink}'" >> $outFile
[ -z "${link_incoming_ip+x}" ] || echo "link_incoming_ip='${link_incoming_ip}'" >> $outFile
[ -z "${link_ref_port+x}" ] || echo "link_ref_port=${link_ref_port}" >> $outFile
[ -z "${link_xrf_port+x}" ] || echo "link_xrf_port=${link_xrf_port}" >> $outFile
[ -z "${link_dcs_port+x}" ] || echo "link_dcs_port=${link_dcs_port}" >> $outFile
[ -z "${link_ip+x}" ] || echo "link_ip=${link_ip}" >> $outFile
[ -z "${link_port+x}" ] || echo "link_port=${link_port}" >> $outFile
[ -z "${link_announce+x}" ] || echo "link_announce=${link_announce}" >> $outFile
[ -z "${link_acknowledge+x}" ] || echo "link_acknowledge=${link_acknowledge}" >> $outFile
[ -z "${link_max_dongles+x}" ] || echo "link_max_dongles=${link_max_dongles}" >> $outFile
# log_ section
[ -z "${log_qso+x}" ] || echo "log_qso=${log_qso}" >> $outFile
[ -z "${log_irc+x}" ] || echo "log_irc=${log_irc}" >> $outFile
[ -z "${log_dtmf+x}" ] || echo "log_dtmf=${log_dtmf}" >> $outFile
[ -z "${log_debug+x}" ] || echo "log_debug=${log_debug}" >> $outFile
# dplus_ section
[ -z "${dplus_authorize+x}" ] || echo "dplus_authorize=${dplus_authorize}" >> $outFile
[ -z "${dplus_priority+x}" ] || echo "dplus_priority=${dplus_priority}" >> $outFile
[ -z "${dplus_ref_login+x}" ] || echo "dplus_ref_login='${dplus_ref_login}'" >> $outFile
[ -z "${dplus_use_repeaters+x}" ] || echo "dplus_use_repeaters=${dplus_use_repeaters}" >> $outFile
[ -z "${dplus_use_reflectors+x}" ] || echo "dplus_use_reflectors=${dplus_use_reflectors}" >> $outFile
# file_ section
[ -z "${file_gwys+x}" ] || echo "file_gwys='${file_gwys}'" >> $outFile
[ -z "${file_dtmf+x}" ] || echo "file_dtmf='${file_dtmf}'" >> $outFile
[ -z "${file_status+x}" ] || echo "file_status='${file_status}'" >> $outFile
[ -z "${file_echotest+x}" ] || echo "file_echotest='${file_echotest}'" >> $outFile
[ -z "${file_qnvoicefile+x}" ] || echo "file_qnvoicefile='${file_qnvoicefile}'" >> $outFile
[ -z "${file_announce_dir+x}" ] || echo "file_announce_dir='${file_announce_dir}'" >> $outFile
# timing_ section
[ -z "${timing_timeout_echo+x}" ] || echo "timing_timeout_echo=${timing_timeout_echo}" >> $outFile
[ -z "${timing_timeout_remote_g2+x}" ] || echo "timing_timeout_remote_g2=${timing_timeout_remote_g2}" >> $outFile
[ -z "${timing_timeout_voicemail+x}" ] || echo "timing_timeout_voicemail=${timing_timeout_voicemail}" >> $outFile
[ -z "${timing_timeout_local_rptr+x}" ] || echo "timing_timeout_local_rptr=${timing_timeout_local_rptr}" >> $outFile
[ -z "${timing_play_wait+x}" ] || echo "timing_play_wait=${timing_play_wait}" >> $outFile
[ -z "${timing_play_delay+x}" ] || echo "timing_play_delay=${timing_play_delay}" >> $outFile
clear
cat $outFile
echo
read -p "File written! Press <Enter> to continue: " ans
}
# Execution starts here!
# source files
if [ -e ./defaults ]; then
source ./defaults
else
echo 'Error: ./defaults not found!'
exit 1
fi
if [ -e ./qn.cfg ]; then
source ./qn.cfg
else
echo 'No configuration file found...'
sleep 1
fi
# process arguments
if [[ "$1" == ex* ]]; then
em="expertMode"
fi
# main loop
while [[ "$ans" != q* ]]
do
clear
echo
echo " QNCONFIG for the Icom Stack, Version #190316"
echo " Main Menu"
echo
echo -n "a : Module A - "; if [ -z $module_a ]; then echo "<EMPTY>"; else echo "${module_a^^}"; fi
echo -n "b : Module B - "; if [ -z $module_b ]; then echo "<EMPTY>"; else echo "${module_b^^}"; fi
echo -n "c : Module C - "; if [ -z $module_c ]; then echo "<EMPTY>"; else echo "${module_c^^}"; fi
echo "i : IRCDDB Menu - login = '${ircddb_login}'"
echo "g : Gateway/APRS Menu - location info and route cache"
echo "l : Link/D-Plus Menu - linking access"
if [ -n "$em" ]; then
echo "d : Debugging/Files/Timings - miscellaneous parameters"
else
echo "d : Debugging - additional log entries"
fi
echo
if [ -n $module_a ] || [ -n $module_b ] || [ -n $module_c ] && [ -n $ircddb_login ]; then
echo "w : Write qn.cfg configuration file (overwrites any existing file)"
echo
fi
read -p "q to quit: " ans
if [[ "$ans" == a* ]]; then ModuleMenu a
elif [[ "$ans" == b* ]]; then ModuleMenu b
elif [[ "$ans" == c* ]]; then ModuleMenu c
elif [[ "$ans" == i* ]]; then IrcddbMenu
elif [[ "$ans" == g* ]]; then GateMenu
elif [[ "$ans" == l* ]]; then LinkMenu
elif [[ "$ans" == d* ]]; then FileMenu
elif [[ "$ans" == w* ]]; then WriteCFGFile
fi
done
[ -e qn.cfg ] && cat qn.cfg
exit 0