From 36873fbd3adfe3b4104ca90cc82aebb9805f5865 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Tue, 8 Jan 2019 22:25:17 -0700 Subject: [PATCH] qnadmin started --- BUILDING | 42 ++++++--- Makefile | 12 +-- README.md | 6 +- qnadmin | 196 ++++++++++++++++++++++++++++++++++++++++++ configure => qnconfig | 2 +- 5 files changed, 240 insertions(+), 18 deletions(-) create mode 100755 qnadmin rename configure => qnconfig (99%) diff --git a/BUILDING b/BUILDING index 677b684..5d5943a 100644 --- a/BUILDING +++ b/BUILDING @@ -30,11 +30,17 @@ already have all or most of these but it still doesn't hurt to be sure: sudo apt-get update sudo apt-get upgrade -sudo apt-get install make g++ unzip git libconfig++-dev +sudo apt-get install make g++ unzip git If you are building a QnetGateway + MMDVMHost system, please use the instructions in the MMDVM.README file. If you are building a QnetGateway for an Icom repeater, -use the qn.icom.cfg configuration file as a starting point for your configuration. +you'll need to switch branches of this repository after downloading it (see below): + +git checkout lastudp + +Then you can use the qn.icom.cfg configuration file as a starting point for your +configuration. + If you are building a QnetGateway for a DVAP or a DVRPTR_V1 read on... git clone git://github.com/n7tae/QnetGateway.git @@ -44,7 +50,6 @@ dvrptr ircddb gateway. The first thing to do is change to the build directory with "cd QnetGateway" and then choose a target to make. There are targets for each of the supported devices: -. "make icom" will build all programs needed for the Icom repeater. . "make itap" will build all programs needed for Icom Terminal mode. . "make dvap" will build all programs needed for the DVAP Dongle. . "make dvrptr" will build all programs needed for the DVRPTR_V1. @@ -53,20 +58,37 @@ choose a target to make. There are targets for each of the supported devices: . "make" will build all the QnetGateway executables. This is useful if you are experimenting around with lots of different devices. -Next, create your qn.cfg configuration file. There are three example for you to look -at: -. qn.everything.cfg contains all parameter with lengthly comments about what +Next, create your qn.cfg configuration file. Use the menu-driven configuration +script. Type: + +./configure + +You can configure up to three different modules: a, b and/or c. + +The configure script will show you the default values of every parameter the +QnetGateway programs use. In most cases, the defaults are just fine and you don't +need to override them with your own values. Mostly you need to specify you callsign +for the IRC login, specify at least one module and most users will want to enable +the D-Plus legacy authorization. For a DVAP Dongle or a DVRPTR V1, there are some +parameters that must be specified, like the serial number. After you are happy with +your configuration, be sure to write it out. After you install and try out your +system, you may find that you need to change some configuration values. In that +case just start the configure script again. It will read the current qn.cfg file +when it start. + +Of course, you can always build your own qn.cfg file. There are three example for +you to look at: +. qn.everything.cfg contains all parameter with comments about what each parameter does. The definitions that are commented out are defined with their default value. . qn.dvap.cfg is the simplest possible configuration for a 2m DVAP. If you have a 70cm DVAP rename the module to "b" and change the frequency. -. qn.icom.cfg is the starting place for configuring an Icom repeater. Please note - that QnetGateway doesn't support the 23cm data only module in the Icom repeater - stack. +. qn.mmdvm.cfg is the starting place for configuring an MMDVMHost repeater. Be sure + the module assignment agrees with the module configured in your MMDVM.cfg file. . qn.itap.cfg is a simple configuration file for Icom's Terminal and Access Point Mode. Please read ITAP.README for more information. -Remeber the everything file or the icom file contain detailed comments about all of +Remeber the 'everything' file file contain detailed comments about all of the values you can set. Just read through it and edit accordingly. In the end you will need a configuration file called "qn.cfg". diff --git a/Makefile b/Makefile index 5f96df4..b93b78d 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ installbase : $(BASE_PROGRAMS) gwys.txt qn.cfg /bin/cp -f system/qngateway.service $(SYSDIR) systemctl enable qngateway.service systemctl daemon-reload - systemctl start qngateway.service +# systemctl start qngateway.service ######### QnetLink ######### /bin/cp -f qnlink $(BINDIR) /bin/cp -f announce/*.dat $(CFGDIR) @@ -98,7 +98,7 @@ installbase : $(BASE_PROGRAMS) gwys.txt qn.cfg /bin/cp -f system/qnlink.service $(SYSDIR) systemctl enable qnlink.service systemctl daemon-reload - systemctl start qnlink.service +# systemctl start qnlink.service installrelay : qnrelay ######### QnetRelay ######### @@ -106,7 +106,7 @@ installrelay : qnrelay /bin/cp -f system/qnrelay$(MODULE).service $(SYSDIR) systemctl enable qnrelay$(MODULE).service systemctl daemon-reload - systemctl start qnrelay$(MODULE).service +# systemctl start qnrelay$(MODULE).service ######### MMDVMHost ######### installitap : qnitap @@ -115,7 +115,7 @@ installitap : qnitap /bin/cp -f system/qnitap$(MODULE).service $(SYSDIR) systemctl enable qnitap$(MODULE).service systemctl daemon-reload - systemctl start qnitap$(MODULE).service +# systemctl start qnitap$(MODULE).service installdvap : qndvap ######### QnetDVAP ######### @@ -123,7 +123,7 @@ installdvap : qndvap /bin/cp -f system/qndvap$(MODULE).service $(SYSDIR) systemctl enable qndvap$(MODULE).service systemctl daemon-reload - systemctl start qndvap$(MODULE).service +# systemctl start qndvap$(MODULE).service installdvrptr : qndvrptr ######### QnetDVRPTR ######### @@ -131,7 +131,7 @@ installdvrptr : qndvrptr /bin/cp -f system/qndvrptr$(MODULE).service $(SYSDIR) systemctl enable qndvrptr$(MODULE).service systemctl daemon-reload - systemctl start qndvrptr$(MODULE).service +# systemctl start qndvrptr$(MODULE).service installdtmf : qndtmf /bin/ln -s $(shell pwd)/qndtmf $(BINDIR) diff --git a/README.md b/README.md index 2adf1ab..a81b4dc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,11 @@ The QnetGateway is an D-Star IRCDDB gateway application that supports MMDVMHost The Qnet Gateway program now includes support for Icom's new Terminal mode. Access Point mode is still having some performance issues and we will be working on this. For more information, please read the ITAP.README file. -For building a QnetGateway + MMDVMHost system, see the MMDVM.README file. To build QnetGateway that uses a DVAP Dongle or DVRPTR V1, see the BUILDING file. +For building a QnetGateway + MMDVMHost system, see the MMDVM.README file. To build QnetGateway that uses a DVAP Dongle or DVRPTR V1, see the BUILDING file. To build QnetGateway for an Icom Repeater Stack, switch to another branch after cloning the repository: + +``` +git checkout lastudp +``` To get started, clone the software to your Linux device: diff --git a/qnadmin b/qnadmin new file mode 100755 index 0000000..b05b7e4 --- /dev/null +++ b/qnadmin @@ -0,0 +1,196 @@ +#!/bin/bash +# +# Copyright (c) 2019 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 . + +InstallSystem () { + make ${1}installbase + if [ $ndvap .gt 0 ]; then + if [ $ndvap .eq 1 ]; then + make ${1}installdvap + else + make MODULE=$advap[0] ${1}installdvap + make MODULE=$advap[1] ${1}installdvap + if [ $ndvap .eq 3 ]; then + make MODULE=$advap[2] ${1}installdvap + endif + fi + fi + if [ $ndvrptr .gt 0 ]; then + if [ $ndvrptr .eq 1 ]; then + make ${1}installdvrptr + else + make MODULE=$advrptr[0] ${1}installdvrptr + make MODULE=$advrptr[1] ${1}installdvrptr + if [ $ndvrptr .eq 3 ]; then + make MODULE=$advrptr[2] ${1}installdvrptr + endif + fi + fi + if [ $nitap .gt 0 ]; then + if [ $nitap .eq 1 ]; then + make ${1}installitap + else + make MODULE=$aitap[0] ${1}installitap + make MODULE=$aitap[1] ${1}installitap + if [ $nitap .eq 3 ]; then + make MODULE=$aitap[2] ${1}installitap + endif + fi + fi + if [ $nmmdvm .gt 0 ]; then + if [ $nmmdvm .eq 1 ]; then + make ${1}installrelay + else + make MODULE=$ammdvm[0] ${1}installrelay + make MODULE=$ammdvm[1] ${1}installrelay + if [ $nmmdvm .eq 3 ]; then + make MODULE=$advap[2] ${1}installrelay + endif + fi + fi +} + +BaseStatus () { + ActiveGate=$( systemctl show -p ActiveState --value qngateway ) + SubGate=$( systemctl show -p SubState --value qngateway ) + ActiveLink=$( systemctl show -p ActiveState --value qnlink ) + SubLink=$( systemctl show -p SubState --value qnlink ) + ActiveDTMF=$( systemctl show -p ActiveState --value qndtmf ) + SubDTMF=$( systemctl show -p SubState --value qndtmf ) + echo -n "QnetGateway " + if [[ "$ActiveGate" == "inactive" ]]; then + echo "is not installed" + else + echo "ActiveState os $ActiveGate SubState is $SubGate" + fi + echo -n "QnetLink " + if [[ "$ActiveLink" == "inactive" ]]; then + echo "is not installed" + else + echo "ActiveState is $ActiveLink SubState is $SubLink" + fi + echo -n "DTMF " + if [[ "$ActiveDTMF" == "inactive" ]]; then + echo "is not installed" + else + echo "ActiveState is $ActiveDTMF SubState is $SubDTMF" + fi +} + +ModuleStatus () { + if [ -z ${3} ]; then + echo "Module ${2^^} - EMPTY" + else + mcvar="n${3}" + if [[ ${!mcar} > 1 ]]; then + process="${3}${2}" + else + process="${3}" + fi + ActiveState=$( systemctl show -p ActiveState --value $process ) + SubState=$( systemctl show -p SubState --value $process ) + echo -n "Module ${2^^} - ${3^^}" + if [[ "$ActiveState" == "inactive" ]]; then + echo " is not installed" + else + echo " ActiveState is $ActiveState SubState is $SubState" + fi + fi +} + +# get defined modules from the config file +if [ -e qn.cfg ]; then + source <( grep "^module_[abc]=" qn.cfg ) + if [ -z "$module_a" ] && [ -z "$module_b" ] && [ -z "$module_c" ]; then + echo "No moudules defined in the qn.cfg file!" + exit 1 + fi +else + "ERROR: can't find the qn.cfg file" + exit 1 +fi + +# get the installation directory from the make file +if [ -e makefile ]; then + MAKEFILE=makefile +elif [ -e Makefile ]; then + MAKEFILE=Makefile +else + echo "ERROR: There is no Makefile or makefile" + exit 1 +fi +source <( grep "^BINDIR=" $MAKEFILE ) +if [ -z $BINDIR ]; then + echo "ERROR: The BINDIR definition in $MAKEFILE is empty!" + exit 1 +fi +if [ ! -d "$BINDIR" ]; then + echo "ERROR: The BINDIR directory $BINDIR is not a directory!" + exit 1 +fi + +ndvap=0 +ndvrptr=0 +nitap=0 +nmmdvm=0 + +for m in a b c ; do + mod=module_${m} + if [ -z ${!mod} ]; then continue; fi + type=${!mod} + if [[ "$type" == 'dvap' ]]; then + advap[${ndvap}]=${m} + ndvap=$((ndvap + 1)) + elif [[ "$type" == 'dvrptr' ]]; then + advrptr[$ndvap]=${m} + ndvrptr=$((ndvrptr + 1)) + elif [[ "$type" == 'itap' ]]; then + aitap[${nitap}]=${m} + nitap=$((nitap + 1)) + elif [[ "$type" == 'mmdvm' ]]; then + ammdvm[${nmmdvm}]=${m} + nmmdvm=$((nmmdvm + 1)) + fi +done + +MODULE_COUNT=$((ndvap + ndvrptr + nitap + nmmdvm)) + +while [[ "$ans" != q* ]]; do + clear + echo + echo " Qnet Administration Menu" + echo + BaseStatus + ModuleStatus 0 a "$module_a" + ModuleStatus 1 b "$module_b" + ModuleStatus 2 c "$module_c" + echo + if [[ "$ActiveGate" == "inactive" ]] || [[ "$ActiveLink" == "inactive" ]]; then + echo "i : Install configured system" + echo "d : Install DTMF" + fi + echo + read -p "q to quit. Command: " ans + + # EXECUTE COMMANDS + if [[ "$ans" == i* ]]; then + InstallSystem + elif [[ "$ans" == d* ]]; then + make installdtmf + fi +done + +exit 0 diff --git a/configure b/qnconfig similarity index 99% rename from configure rename to qnconfig index 4193014..f40c461 100755 --- a/configure +++ b/qnconfig @@ -62,7 +62,7 @@ EndMenu () { LinkMenu () { key='' - while [[ "$key" != q* ]];do + while [[ "$key" != q* ]]; do clear echo echo " Link/D-Plus Menu"