From c3515f96f68525cf9dad67043cddf97a4fbf1708 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Sun, 3 Nov 2024 08:57:53 -0700 Subject: [PATCH 1/5] Java - Upgraded Java to JDK 20; added Initial support for light-weight test cases --- tests/run-test-suite.sh | 15 +++++++++++++++ tests/test-java.sh | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100755 tests/run-test-suite.sh create mode 100755 tests/test-java.sh diff --git a/tests/run-test-suite.sh b/tests/run-test-suite.sh new file mode 100755 index 0000000..67904b7 --- /dev/null +++ b/tests/run-test-suite.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 3 November 2024 +# Purpose : Post installation validation script + +PATH=.:$PATH + +ls test-*.sh | while read test_case; do + eval ${test_case} + if [[ $? -eq 0 ]]; then + printf "%20s %s\n" "${test_case}" "[PASSED]" + else + printf "%20s %s\n" "${test_case}" "[FAILED]" + fi +done diff --git a/tests/test-java.sh b/tests/test-java.sh new file mode 100755 index 0000000..76c3791 --- /dev/null +++ b/tests/test-java.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 3 November 2024 +# Purpose : Test Java installation + +# We need to redirect stderr to stdout otherwise grep will not match. +JAVA_OUT=$(java -version 2>&1 | grep 20.0.1) +exit $? From 725d53a0cdfe22739411de0fea33baefeecaa2ac Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Sun, 3 Nov 2024 09:38:38 -0700 Subject: [PATCH 2/5] Packet - Initial installer for YAAC. --- scripts/install-base.sh | 4 ++-- scripts/install-yaac.sh | 41 +++++++++++++++++++++++++++++++++++++++++ scripts/install.sh | 4 +++- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 scripts/install-yaac.sh diff --git a/scripts/install-base.sh b/scripts/install-base.sh index daf0d37..c07b837 100755 --- a/scripts/install-base.sh +++ b/scripts/install-base.sh @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 16 March 2024 -# Updated : 6 October 2024 +# Updated : 11 November 2024 # Purpose : Install base tools and configuration set -e @@ -21,7 +21,7 @@ apt install \ gpg \ jq \ net-tools \ - openjdk-11-jdk \ + openjdk-20-jdk \ openssh-server \ screen \ stow \ diff --git a/scripts/install-yaac.sh b/scripts/install-yaac.sh new file mode 100755 index 0000000..2e6e2b3 --- /dev/null +++ b/scripts/install-yaac.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 3 November 2024 +# Purpose : Install YAAC +set -e +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +trap 'et-log "\"${last_command}\" command failed with exit code $?."' ERR + +VERSION=latest +ZIP_FILE=YAAC.zip +INSTALL_DIR=/opt/yaac-${VERSION} +LINK_PATH=/opt/yaac + +et-log "Installing YAAC..." + +if [ ! -e ${ET_DIST_DIR}/${ZIP_FILE} ]; then + + URL=https://www.ka2ddo.org/ka2ddo/${ZIP_FILE} + + et-log "Downloading YAAC: ${URL}" + curl -s -L -o ${ZIP_FILE} --fail ${URL} + + [ ! -e ${ET_DIST_DIR} ] && mkdir ${ET_DIST_DIR} + [ ! -e ${ET_SRC_DIR} ] && mkdir ${ET_SRC_DIR} + + mv -v ${ZIP_FILE} ${ET_DIST_DIR} +fi + +CWD_DIR=$(pwd) + +if [ ! -e ${INSTALL_DIR} ]; then + mkdir -v ${INSTALL_DIR} && cd ${INSTALL_DIR} + unzip ${ET_DIST_DIR}/${ZIP_FILE} +else + et-log "${INSTALL_DIR} already exists." +fi + +[ -e ${LINK_PATH} ] && rm ${LINK_PATH} +ln -s ${INSTALL_DIR} ${LINK_PATH} + +cd ${CWD_DIR} diff --git a/scripts/install.sh b/scripts/install.sh index 9f825a4..7fda58c 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 16 March 2024 -# Updated : 30 October 2024 +# Updated : 3 November 2024 # Purpose : Main installer for EmComm Tools OS Community . ./env.sh @@ -35,6 +35,8 @@ exitIfNotRoot ./install-conky.sh +# Install packet tool chain ./install-direwolf.sh +./install-yaac.sh ./install-audio-tools.sh From 9b732ea20802c4f93ac4ab65e4cbfecec5352521 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Sun, 3 Nov 2024 10:27:54 -0700 Subject: [PATCH 3/5] Dire Wolf - Fixed bug in et-direwolf. Added check to ensure that the systemd rigctld service is running before starting direwolf --- overlay/opt/emcomm-tools/bin/et-direwolf | 9 +++++++++ overlay/opt/emcomm-tools/bin/et-radio | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/overlay/opt/emcomm-tools/bin/et-direwolf b/overlay/opt/emcomm-tools/bin/et-direwolf index c9cfbd1..239e540 100755 --- a/overlay/opt/emcomm-tools/bin/et-direwolf +++ b/overlay/opt/emcomm-tools/bin/et-direwolf @@ -2,6 +2,7 @@ # # Author : Gaston Gonzalez # Date : 1 November 2024 +# Updated : 3 November 2024 # Purpose : Wrapper script for starting Dire Wolf with PnP support # # Preconditions: @@ -55,6 +56,14 @@ start() { update-config if [ $? -eq 0 ]; then + + RIGCTLD_OUT=$(systemctl status rigctld) + if [ $? -ne 0 ]; then + et-log "Can't start Dire Wolf. rigctld not running. Ensure radio is selected." + notify_user "Can't start Dire Wolf. rigctld not running." + exit 1 + fi + CMD="direwolf -c ${DIREWOLF_CONF_FILE} -t 0 -p" et-log "Starting Dire Wolf with: '${CMD}'" echo diff --git a/overlay/opt/emcomm-tools/bin/et-radio b/overlay/opt/emcomm-tools/bin/et-radio index d1ba6e2..1754a39 100755 --- a/overlay/opt/emcomm-tools/bin/et-radio +++ b/overlay/opt/emcomm-tools/bin/et-radio @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 11 October 2024 -# Updated : 28 October 2024 +# Updated : 3 November 2024 # Purpose : A script for managaing plug-and-play radios set -e @@ -48,6 +48,9 @@ if [ $exit_status -eq 0 ]; then printf "\nConfiguration Notes\n" cat ${ACTIVE_RADIO} | jq -r '.notes[] | "* \(.)"' + + + printf "\n** Plug in radio. If already connected, reconnect it.\n" else echo "No radio selected." fi From b9ce23337ef00ad3f4be12783a70a93222c49d97 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Sun, 3 Nov 2024 12:21:38 -0700 Subject: [PATCH 4/5] YAAC - Initial minimum configuration for YAAC to support GPS and rig control --- .../.java/.userPrefs/org/ka2ddo/prefs.xml | 3 ++ .../org/ka2ddo/yaac/Beacons/MYCALL/prefs.xml | 33 +++++++++++++++++++ .../org/ka2ddo/yaac/Beacons/prefs.xml | 3 ++ .../org/ka2ddo/yaac/DigipeatAlias/prefs.xml | 7 ++++ .../org/ka2ddo/yaac/Ports/prefs.xml | 6 ++++ 5 files changed, 52 insertions(+) create mode 100644 overlay/etc/skel/.java/.userPrefs/org/ka2ddo/prefs.xml create mode 100644 overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/MYCALL/prefs.xml create mode 100644 overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/prefs.xml create mode 100644 overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/DigipeatAlias/prefs.xml create mode 100644 overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml diff --git a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/prefs.xml b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/prefs.xml new file mode 100644 index 0000000..9c99288 --- /dev/null +++ b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/prefs.xml @@ -0,0 +1,3 @@ + + + diff --git a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/MYCALL/prefs.xml b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/MYCALL/prefs.xml new file mode 100644 index 0000000..c2dd1c8 --- /dev/null +++ b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/MYCALL/prefs.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/prefs.xml b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/prefs.xml new file mode 100644 index 0000000..9c99288 --- /dev/null +++ b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Beacons/prefs.xml @@ -0,0 +1,3 @@ + + + diff --git a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/DigipeatAlias/prefs.xml b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/DigipeatAlias/prefs.xml new file mode 100644 index 0000000..38d870b --- /dev/null +++ b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/DigipeatAlias/prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml new file mode 100644 index 0000000..e9c5da6 --- /dev/null +++ b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml @@ -0,0 +1,6 @@ + + + + + + From 3b356a9686369bb79713cb9c7ef934e3b9383f7d Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Sun, 3 Nov 2024 12:50:09 -0700 Subject: [PATCH 5/5] YAAC - Added plug-and-play configuration support for YAAC --- .../org/ka2ddo/yaac/Ports/prefs.xml | 2 +- overlay/opt/emcomm-tools/bin/et-yaac | 95 +++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100755 overlay/opt/emcomm-tools/bin/et-yaac diff --git a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml index e9c5da6..61b8ec5 100644 --- a/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml +++ b/overlay/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml @@ -1,6 +1,6 @@ - + diff --git a/overlay/opt/emcomm-tools/bin/et-yaac b/overlay/opt/emcomm-tools/bin/et-yaac new file mode 100755 index 0000000..94048f3 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-yaac @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 3 November 2024 +# Purpose : Wrapper script for starting YAAC with PnP support +# +# Preconditions: +# 1. Supported radio and audio interface are connected and properly detected +# 2. Dire Wolf is started +# +# Postconditions: +# 1. YAAC is started +# 2. Callsign is updated in YAAC + +YAAC_CONF_DIR=${HOME}/.java/.userPrefs/org/ka2ddo/yaac +YAAC_CONF_FILE_PORTS=${YAAC_CONF_DIR}/Ports/prefs.xml +YAAC_CONF_FILE_PORTS_TEMPLATE=/etc/skel/.java/.userPrefs/org/ka2ddo/yaac/Ports/prefs.xml + +usage() { + echo "usage: $(basename $0) " + echo " " + echo " start - Start YAAC" + echo " update-config - Update configuration for selected mode" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +notify_user() { + notify-send \ + -t 5000 \ + --app-name="EmComm Tools" \ + "$1" +} + +start() { + update-config + + if [ $? -eq 0 ]; then + + RIGCTLD_OUT=$(ps -ef | grep [d]irewolf) + if [ $? -ne 0 ]; then + et-log "Can't start YAAC. Dire Wolf not running." + notify_user "Can't start YAAC. Dire Wolf not running." + exit 1 + fi + + CMD="java -jar /opt/yaac/YAAC.jar" + et-log "Starting YAAC with: ${CMD}" + + ${CMD} + + else + et-log "Error updating configuration. Can't start YAAC" + exit 1 + fi +} + +update-config () { + + [ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json" + + CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign) + + if [ "${CALLSIGN}" = "N0CALL" ]; then + notify_user "Can't start YAAC. No callsign set. Run: et-user." + exit 1 + fi + + et-log "Updating YAAC ports file: ${YAAC_CONF_FILE_PORTS}..." + cp -v ${YAAC_CONF_FILE_PORTS_TEMPLATE} ${YAAC_CONF_FILE_PORTS} + sed -i "s|N0CAL|${CALLSIGN}|g" ${YAAC_CONF_FILE_PORTS} + + echo "Generated the configuration below..." + echo + cat ${YAAC_CONF_FILE_PORTS} + echo + +} + +case $1 in + start) + start + ;; + update-config) + update-config + ;; + *) + echo "Invalid command." + usage + exit 1 + ;; +esac