#!/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 . 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 "'' " else echo "${!2} " fi else if [ -z "${!1}" ]; then echo "''" else echo "${!1}" fi fi } EndMenu () { echo echo "u to unset the value of key (revert to the default value)." echo "q to return to the main menu" read -p "Please input: # 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 "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 "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" == r* ]]; then link_ref_port="$value" elif [[ "$key" == x* ]]; then link_xrf_port="$value" elif [[ "$key" == d* ]]; then link_dcs_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" == r* ]]; then unset link_ref_port elif [[ "$value" == x* ]]; then unset link_xrf_port elif [[ "$value" == d* ]]; then unset link_dcs_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 } DashboardMenu () { key='' while [[ "$key" != q* ]]; do clear echo echo " Dashboard Menu" echo echo -n "r : Refresh time (sec) for page = "; EvaluateVar dash_refresh{,_d} echo -n "c : Max number of last heard entries = "; EvaluateVar dash_lastheard_count{,_d} echo -n "o : Show Section Order = "; EvaluateVar dash_show_order{,_d} echo echo " The 'Show Section' is a comma separated value, e.g. 'lh,mo,sy,ip,ps,ur'" echo " The following sections can be shown in any order. It's okay to leave out sections." echo " Don't use spaces, just use commas. Lowercase will be set to uppercase." echo echo " LH is the Last Heard Section" echo " MO is the Modules Section" echo " SY is the System Section" echo " IP is the IP Address Section" echo " PS is the Processes Section" echo " UR is the Send URCall Section" EndMenu if [[ "$key" == r* ]]; then dash_refresh="$value" elif [[ "$key" == c* ]]; then dash_lastheard_count="$value" elif [[ "$key" == o* ]]; then dash_show_order="${value^^}" elif [[ "$key" == u* ]]; then if [[ "$value" == r* ]]; then unset dash_refresh elif [[ "$value" == c* ]]; then unset dash_lastheard_count elif [[ "$value" == o* ]]; then unset dash_show_order 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 "Routes to other clients using IRC Server A will be searched first" echo echo "l : Login - must be a legal callsign = '${ircddb_login}'" echo echo "d : Setup dual-stack (IPv4 & IPv6) QuadNet irc servers for me!" echo echo -n "ha : Hostname for IRC Server A = "; EvaluateVar ircddb0_host{,_d} if [ -n "$em" ]; then echo -n "oa : IRC TCP port A = "; EvaluateVar ircddb0_port{,_d} echo -n "aa : IRC Password A = "; EvaluateVar ircddb0_password{,_d} fi echo -n "hb : Hostname for IRC Server B = "; EvaluateVar ircddb1_host{,_d} if [ -n "$em" ]; then echo -n "ob : IRC TCP port B = "; EvaluateVar ircddb1_port{,_d} echo -n "ab : IRC Password B = "; EvaluateVar ircddb1_password{,_d} fi EndMenu if [[ "$key" == l* ]]; then ircddb_login="${value^^}" elif [[ "$key" == d* ]]; then ircddb0_host='ircv6.openquad.net' ircddb1_host='ircv4.openquad.net' unset ircddb{0,1}_port ircddb{0,1}_password elif [[ "$key" == ha* ]]; then if [ -z "$value"]; then if [ -z "${ircddb1_host+x}" ]; then ircddb0_host='' else echo "You cannot set an empty value for ha unless hb has its default value" read -p " to continue: " garbage fi elif [[ "$value" =~ ^([a-zA-Z0-9]+\.)+[a-zA-Z0-9]+$ ]]; then ircddb0_host="$value" else clear echo "$value is not a valid hostname" read -p " to continue: " garbage fi elif [[ "$key" == oa* ]]; then ircddb0_port="$value" elif [[ "$key" == aa* ]]; then ircddb0_password="$value" elif [[ "$key" == hb* ]]; then if [[ "$value" =~ ^([a-zA-Z0-9]+\.)+[a-zA-Z0-9]+$ ]]; then ircddb1_host="$value" else clear echo "$value is not a valid hostname" read -p " to continue: " garbage fi elif [[ "$key" == ob* ]]; then ircddb1_port="$value" elif [[ "$key" == ab* ]]; then ircddb1_password="$value" elif [[ "$key" == u* ]]; then if [[ "$value" == l* ]]; then unset ircddb_login elif [[ "$value" == ha* ]]; then unset ircddb0_host elif [[ "$value" == oa* ]]; then unset ircddb0_port elif [[ "$value" == aa* ]]; then unset ircddb0_password elif [[ "$value" == hb* ]]; then unset ircddb1_host elif [[ "$value" == ob* ]]; then unset ircddb1_port elif [[ "$value" == ab* ]]; then unset ircddb1_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 "a : G2 port address = "; EvaluateVar gateway_ip{,_d} echo -n "p : G2 port number = "; EvaluateVar gateway_port{,_d} fi 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 "h : 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" == a* ]]; then gateway_ip="$value" elif [[ "$key" == p* ]]; then gateway_port="$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" == h* ]]; 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" == a* ]]; then unset gateway_ip elif [[ "$value" == p* ]]; then unset gateway_port 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" == h* ]]; 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 clear if [ -z ${!mod} ]; then echo echo " Select a Module type" echo echo "1 : DVAP Dongle" echo "2 : DVRPTR V1" echo "3 : ICOM Terminal and Access Point Mode" echo "4 : MMDVM Modem (like DVMega or ZUMspot) D-Star ONLY!" echo "5 : MMDVMHost or DStarRepeater Sytem" echo echo " Anything else will return without selecting" echo echo -n "Select Module Type : " read key unused if [[ "$key" == 1 ]]; then eval ${mod}=dvap elif [[ "$key" == 2 ]]; then eval ${mod}=dvrptr elif [[ "$key" == 3 ]]; then eval ${mod}=itap elif [[ "$key" == 4 ]]; then eval ${mod}=mmdvmmodem elif [[ "$key" == 5 ]]; then eval ${mod}=mmdvmhost else return fi fi 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 "ar : Auto relink in the case of a timeout = "; 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 "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 echo -n "pw : in msec, packet wait time (test for timeout) = "; EvaluateVar {${mod},module_x}_packet_wait echo -n "hf : is an HF module = "; EvaluateVar {${mod},module_x}_is_hf fi if [[ "${!mod}" == 'dvap' ]]; then echo -n "fr : Frequency in MHz = "; EvaluateVar {${mod},dvap}_frequency echo -n "of : Offset in Hz = "; EvaluateVar {${mod},dvap}_offset echo -n "po : Power (in dBm from -12 to 10) = "; EvaluateVar {${mod},dvap}_power echo -n "sq : Squelch (in dBm from -128 to -45) = "; EvaluateVar {${mod},dvap}_squelch echo " You MUST specify either a serial number or a device path!" echo -n "dv : Device path (/dev/ttyUSBx) = "; EvaluateVar {${mod},dvap}_device echo -n "sn : Serial # (visible through the case) = "; EvaluateVar {${mod},dvap}_serial_number elif [[ "${!mod}" == 'dvrptr' ]]; then echo -n "tx : Transmit frequency, in MHz = "; EvaluateVar {${mod},dvrptr}_tx_frequency echo -n "rx : Receive frequency, in MHz = "; EvaluateVar {${mod},dvrtpr}_rx_frequency echo -n "sn : Serial # (run once and look in log) = "; EvaluateVar {${mod},dvrptr}_serial_number echo -n "rn : Callsign to turn RF on = "; EvaluateVar {${mod},dvrptr}_rf_on echo -n "rf : Callsign to turn RF off = "; EvaluateVar {${mod},dvrptr}_rf_off echo -n "rl : Receiver level = "; EvaluateVar {${mod},dvrptr}_rx_level echo -n "du : Is duplex = "; EvaluateVar {${mod},dvrptr}_duplex echo -n "td : Transmitter delay (in msec) for tx/rx switch = "; EvaluateVar {${mod},dvrptr}_tx_delay echo -n "rq : # of 2 sec interval before system reset = "; EvaluateVar {${mod},dvrptr}_rqst_count echo -n "ir : Inverse phase of receiver = "; EvaluateVar {${mod},dvrptr}_rx_invert echo -n "it : Inverse phase of transmitter = "; EvaluateVar {${mod},dvrptr}_tx_invert elif [[ "${!mod}" == 'itap' ]]; then echo -n "fr : Frequency in MHz = "; EvaluateVar {${mod},itap}_frequency echo -n "dv : USB device path = "; EvaluateVar {${mod},itap}_device echo -n "ap : Set to true if using Access Point Mode = "; EvaluateVar {${mod},itap}_ap_mode elif [[ "${!mod}" == 'mmdvmhost' ]]; then echo -n "dr : System is DStarRepeater, and _NOT_ MMDVMHost = "; EvaluateVar {${mod},mmdvmhost}_is_dstarrepeater echo -n "ip : bound IP address for communication to modem = "; EvaluateVar {${mod},mmdvmhost}_internal_ip echo -n "ti : IP of MMDVMHost or DStarRepeater = "; EvaluateVar {${mod},mmdvmhost}_target_ip echo -n "gp : Gateway port number = "; EvaluateVar {${mod},mmdvmhost}_gateway_port echo -n "lp : Local port number = "; EvaluateVar {${mod},mmdvmhost}_local_port echo -n "tx : Transmit frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_tx_frequency echo -n "rx : Receive frequency, in MHz = "; EvaluateVar {${mod},mmdvmhost}_rx_frequency elif [[ "${!mod}" == 'mmdvmmodem' ]]; then echo -n "dv : Device path = "; EvaluateVar {${mod},mmdvmmodem}_device echo -n "tx : Transmit frequency, in MHz = "; EvaluateVar {${mod},mmdvmmodem}_tx_frequency echo -n "rx : Receive frequency, in MHz = "; EvaluateVar {${mod},mmdvmmodem}_rx_frequency echo -n "to : Transmit offset, in MHz = "; EvaluateVar {${mod},mmdvmmodem}_tx_offset echo -n "r0 : Receive offset, in MHz = "; EvaluateVar {${mod},mmdvmmodem}_rx_offset echo -n "du : Is duplex = "; EvaluateVar {${mod},mmdvmmodem}_duplex if [ -n "$em" ]; then echo -n "it : Transmit invert = "; EvaluateVar {${mod},mmdvmmodem}_tx_invert echo -n "ir : Receive invert = "; EvaluateVar {${mod},mmdvmmodem}_rx_invert echo -n "pi : PTT invert = "; EvaluateVar {${mod},mmdvmmodem}_ptt_invert echo -n "td : Transmit delay (in msec) for tx/rx switch = "; EvaluateVar {${mod},mmdvmmodem}_tx_delay echo -n "tl : Transmit level (0-255) = "; EvaluateVar {${mod},mmdvmmodem}_tx_level echo -n "rl : Receive level (0-255) = "; EvaluateVar {${mod},mmdvmmodem}_rx_level echo -n "lv : RF level (0-255) = "; EvaluateVar {${mod},mmdvmmodem}_rf_level fi fi 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" == ap* ]]; then SetBooleanValue ${mod}_ap_mode "$value" elif [[ "$key" == ag* ]]; then eval ${mod}_agl="$value" elif [[ "$key" == ar* ]]; then SetBooleanValue ${mod}_auto_link "$value" elif [[ "$key" == cs* ]]; then eval ${mod}_callsign="${value^^}" elif [[ "$key" == dr* ]]; then SetBooleanValue ${mod}_is_dstarrepeater elif [[ "$key" == du* ]]; then SetBooleanValue ${mod}_duplex "$value" elif [[ "$key" == dv* ]]; then eval ${mod}_device="$value" unset ${mod}_serial_number elif [[ "$key" == fr* ]]; then eval ${mod}_frequency="$value" elif [[ "$key" == gp* ]]; then eval ${mod}_gateway_port="$value" elif [[ "$key" == hf* ]]; then SetBooleanValue ${mod}_is_hf "$value" elif [[ "$key" == in* ]]; then eval ${mod}_inactivity="$value" elif [[ "$key" == ir* ]]; then SetBooleanValue ${mod}_rx_invert "$value" elif [[ "$key" == ip* ]]; then eval ${mod}_internal_ip="$value" elif [[ "$key" == it* ]]; then SetBooleanValue ${mod}_tx_invert "$value" elif [[ "$key" == lp* ]]; then eval ${mod}_local_port="$value" elif [[ "$key" == lv* ]]; then eval ${mod}_rf_level="$value" elif [[ "$key" == of* ]]; then eval ${mod}_offset="$value" elif [[ "$key" == pi* ]]; then SetBooleanValue ${mod}_ptt_invert="$value" elif [[ "$key" == po* ]]; then eval ${mod}_power="$value" elif [[ "$key" == pw* ]]; then eval ${mod}_packet_wait="$value" elif [[ "$key" == ra* ]]; then eval ${mod}_range="$value" elif [[ "$key" == rf* ]]; then eval ${mod}_rf_off="$value" elif [[ "$key" == rl* ]]; then eval ${mod}_rx_level="$value" elif [[ "$key" == rn* ]]; then eval ${mod}_rf_on="$value" elif [[ "$key" == ro* ]]; then eval ${mod}_rx_offset="$value" elif [[ "$key" == rq* ]]; then eval ${mod}_rqst_count="$value" elif [[ "$key" == rx* ]]; then eval ${mod}_rx_frequency="$value" elif [[ "$key" == sn* ]]; then eval ${mod}_serial_number="${value^^}" unset {$mod}_device elif [[ "$key" == sq* ]]; then eval ${mod}_squelch="$value" elif [[ "$key" == td* ]]; then eval ${mod}_tx_delay="$value" elif [[ "$key" == ti* ]]; then eval ${mod}_target_ip="$value" elif [[ "$key" == tl* ]]; then eval ${mod}_tx_level="$value" elif [[ "$key" == to* ]]; then eval ${mod}_tx_offset="$value" elif [[ "$key" == tx* ]]; then eval ${mod}_tx_frequency="$value" elif [[ "$key" == xx* ]]; then unset ${mod}_{link_at_start,callsign,{,rx_,tx_}frequency,offset,range,agl} unset ${mod}_{inactivity,packet_wait,acknowledge,ack_delay,power,squelch,serial_number,rf_o{n,ff},{rx,tx,rf}_level} unset ${mod}_{duplex,tx_delay,rqst_count,{tx,rx,ptt}_invert,device,internal_ip,target_ip,{gateway,local}_port} unset ${mod}_{tx_offset,rx_offset,auto_link,ap_mode} unset ${mod} return elif [[ "$key" == u* ]]; then if [[ "$value" == ac* ]]; then unset ${mod}_acknowledge elif [[ "$value" == ad* ]]; then unset ${mod}_ack_delay elif [[ "$value" == ap* ]]; then unset ${mod}_ap_mode elif [[ "$value" == ar* ]]; then unset ${mod}_auto_link elif [[ "$value" == ag* ]]; then unset ${mod}_agl elif [[ "$value" == cs* ]]; then unset ${mod}_callsign elif [[ "$value" == dr* ]]; then unset ${mod}_is_dstarrepeater elif [[ "$value" == du* ]]; then unset ${mod}_duplex elif [[ "$value" == dv* ]]; then unset ${mod}_device elif [[ "$value" == fr* ]]; then unset ${mod}_frequency elif [[ "$value" == gp* ]]; then unset ${mod}_gateway_port elif [[ "$value" == in* ]]; then unset ${mod}_inactivity elif [[ "$value" == ir* ]]; then unset ${mod}_rx_invert elif [[ "$value" == ip* ]]; then unset ${mod}_internal_ip elif [[ "$value" == it* ]]; then unset ${mod}_tx_invert elif [[ "$value" == lp* ]]; then unset ${mod}_local_port elif [[ "$value" == ls* ]]; then unset ${mod}_link_at_start elif [[ "$value" == lv* ]]; then unset ${mod}_rf_level elif [[ "$value" == of* ]]; then unset ${mod}_offset elif [[ "$value" == pi* ]]; then unset ${mod}_ppt_invert elif [[ "$value" == po* ]]; then unset ${mod}_power elif [[ "$value" == pw* ]]; then unset ${mod}_packet_wait elif [[ "$value" == ra* ]]; then unset ${mod}_range elif [[ "$value" == rf* ]]; then unset ${mod}_rf_off elif [[ "$value" == rl* ]]; then unset ${mod}_rx_level elif [[ "$value" == rn* ]]; then unset ${mod}_rf_on elif [[ "$value" == ro* ]]; then unset ${mod}_rx_offset elif [[ "$value" == rq* ]]; then unset ${mod}_rqst_count elif [[ "$value" == rx* ]]; then unset ${mod}_rx_frequency elif [[ "$value" == sn* ]]; then unset ${mod}_serial_number elif [[ "$value" == sq* ]]; then unset ${mod}_squelch elif [[ "$value" == td* ]]; then unset ${mod}_tx_delay elif [[ "$value" == ti* ]]; then unset ${mod}_target_ip elif [[ "$value" == tl* ]]; then unset ${mod}_tx_level elif [[ "$value" == to* ]]; then unset ${mod}_tx_offset elif [[ "$value" == tx* ]]; then unset ${mod}_tx_frequency 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 to continue: " ans return fi outFile='./qn.cfg' echo "# Created on `date`" > $outFile # ircddb_ section echo "ircddb_login='$ircddb_login'" >> $outFile [ -z "${ircddb0_host+x}" ] || echo "ircddb0_host='${ircddb0_host}'" >> $outFile [ -z "${ircddb0_port+x}" ] || echo "ircddb0_port=${ircddb0_port}" >> $outFile [ -z "${ircddb0_password+x}" ] || echo "ircddb0_password='${ircddb0_password}'" >> $outFile [ -z "${ircddb1_host+x}" ] || echo "ircddb1_host='${ircddb1_host}'" >> $outFile [ -z "${ircddb1_port+x}" ] || echo "ircddb1_port=${ircddb1_port}" >> $outFile [ -z "${ircddb1_password+x}" ] || echo "ircddb1_password='${ircddb1_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}_is_hf; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile if [[ "${!p}" == "dvap" ]]; then q=${p}_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_power; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_squelch; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_serial_number; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile q=${p}_device; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile elif [[ "${!p}" == "dvrptr" ]]; then q=${p}_tx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_serial_number; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile q=${p}_rf_on; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile q=${p}_rf_off; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile q=${p}_rx_level; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_duplex; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_delay; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rqst_count; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_invert; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_invert; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile elif [[ "${!p}" == "itap" ]]; then q=${p}_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_device; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_ap_mode; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile elif [[ "${!p}" == "mmdvmhost" ]]; then q=${p}_is_dstarrepeater; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_internal_ip; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile q=${p}_target_ip; [ -z ${!q+x} ] || echo "${q}='${!q}'" >> $outFile q=${p}_gateway_port; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_local_port; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile elif [[ "${!p}" == "mmdvmmodem" ]]; then q=${p}_tx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_frequency; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_offset; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_offset; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_duplex; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_level; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_level; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rf_level; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_invert; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_rx_invert; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_ptt_invert; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_tx_delay; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile q=${p}_device; [ -z ${!q+x} ] || echo "${q}=${!q}" >> $outFile fi 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_port+x}" ] || echo "gateway_port=${gateway_port}" >> $outFile [ -z "${gateway_ip+x}" ] || echo "gateway_ip=${gateway_ip}" >> $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_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_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 # dash_ section [ -z "${dash_refresh+x}" ] || echo "dash_refresh=${dash_refresh}" >> $outFile [ -z "${dash_lastheard_count+x}" ] || echo "dash_lastheard_count=${dash_lastheard_count}" >> $outFile [ -z "${dash_show_order+x}" ] || echo "dash_show_order='${dash_show_order}'" >> $outFile clear cat $outFile echo read -p "File written! Press 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 Main Menu V#210708" echo echo -n "a : Module A - "; if [ -z $module_a ]; then echo ""; else echo "${module_a^^}"; fi echo -n "b : Module B - "; if [ -z $module_b ]; then echo ""; else echo "${module_b^^}"; fi echo -n "c : Module C - "; if [ -z $module_c ]; then echo ""; 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" echo "D : Dashboard Menu - Dashboard customization" 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" == D* ]]; then DashboardMenu 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