diff --git a/overlay/opt/emcomm-tools/bin/et-reticulum b/overlay/opt/emcomm-tools/bin/et-reticulum new file mode 100755 index 0000000..f535731 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-reticulum @@ -0,0 +1,134 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 12 May 2026 +# Purpose : Wrapper script for starting Reticulum with PnP support +# +# Preconditions: +# 1. Supported radio and audio interface are connected and properly detected +# +# Postconditions: +# 1. Reticulum configuration updated +# 2. Dire Wolf started +# 3. Reticulum started +. /opt/emcomm-tools/bin/et-common + +APP="Reticulum" +RETICULUM_CONF_FILE="${HOME}/.reticulum/config" + +usage() { + echo "usage: $(basename $0) " + echo " " + echo " start - Start ${APP} in selected mode" + echo " update-config - Update configuration for selected mode" + echo "" + echo " " + echo " 1200 - Run with AX.25 interface over VHF/UHF (1200 baud)" + echo " 300 - Run with AX.25 interface over HF (300 baud)" +} + +if [ $# -ne 2 ]; then + usage + exit 1 +fi + +MODE=$2 +case "${MODE}" in + 1200) + RETICULUM_TEMPLATE_CONF_FILE="${ET_HOME}/conf/template.d/reticulum/config.ax25.1200" + RETICULUM_PACKET_INTERFACE_SERVICE=et-service-direwolf-simple + ;; + 300) + RETICULUM_TEMPLATE_CONF_FILE="${ET_HOME}/conf/template.d/reticulum/config.ax25.300" + RETICULUM_PACKET_INTERFACE_SERVICE=et-service-direwolf-300 + ;; + *) + et-log "Can't start ${APP}. Mode '${MODE}' not supported" + usage + exit 1 + ;; +esac + +if [[ ! -e "${RETICULUM_TEMPLATE_CONF_FILE}" ]]; then + et-log "${RETICULUM_TEMPLATE_CONF_FILE} does not exist. Exiting." + notify-user "Config file does not exist. Can't start Reticulum." + exit 1 +fi + +start() { + update_config + + if [[ $? -eq 0 ]]; then + + systemctl is-active --quiet ${RETICULUM_PACKET_INTERFACE_SERVICE} + if [[ $? -ne 0 ]]; then + et-log "Can't start ${APP}. direwolf not running. Ensure radio is selected." + notify-user "Can't start ${APP}. direwolf not running." + exit 1 + fi + + CMD="rnsd" + et-log "Starting ${APP} with: '${CMD}'" + echo + ${CMD} + else + et-log "Error updating configuration. Can't start ${APP}" + exit 1 + fi +} + + +update_config () { + + et-log "Attempting to start ${APP} in mode: '${MODE}'" + + [[ -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 ${APP}. No callsign set. Run: et-user." + exit 1 + fi + + # 1. Check if the audio symlink was created by the udev rules + if [[ -e /dev/et-audio ]]; then + + # Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule + APLAY_OUT=$(arecord -l | grep ET_AUDIO) + if [[ $? -eq 0 ]]; then + + # Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + + else + et-log "No ET_AUDIO device detected." + notify-user "Can't start ${APP}. No ET_AUDIO device detected." + exit 1 + fi + else + et-log "No ET_AUDIO device plugged in." + notify-user "Can't start ${APP}. No supported audio device plugged in." + exit 1 + fi + + et-log "Creating '${RETICULUM_CONF_FILE}' from template '${RETICULUM_TEMPLATE_CONF_FILE}'" + cp ${RETICULUM_TEMPLATE_CONF_FILE} ${RETICULUM_CONF_FILE} + + # Update callsign + sed -i "s|{{ET_CALLSIGN}}|${CALLSIGN}|g" ${RETICULUM_CONF_FILE} +} + +case $1 in + start) + start + ;; + update-config) + update_config + ;; + *) + echo "Invalid command." + usage + exit 1 + ;; +esac diff --git a/overlay/opt/emcomm-tools/conf/template.d/reticulum/config.ax25.1200 b/overlay/opt/emcomm-tools/conf/template.d/reticulum/config.ax25.1200 new file mode 100644 index 0000000..4c55d13 --- /dev/null +++ b/overlay/opt/emcomm-tools/conf/template.d/reticulum/config.ax25.1200 @@ -0,0 +1,128 @@ +# This is the default Reticulum config file. +# You should probably edit it to include any additional, +# interfaces and settings you might need. + +# Only the most basic options are included in this default +# configuration. To see a more verbose, and much longer, +# configuration example, you can run the command: +# rnsd --exampleconfig + + +[reticulum] + + # If you enable Transport, your system will route traffic + # for other peers, pass announces and serve path requests. + # This should only be done for systems that are suited to + # act as transport nodes, ie. if they are stationary and + # always-on. This directive is optional and can be removed + # for brevity. + + enable_transport = False + + + # By default, the first program to launch the Reticulum + # Network Stack will create a shared instance, that other + # programs can communicate with. Only the shared instance + # opens all the configured interfaces directly, and other + # local programs communicate with the shared instance over + # a local socket. This is completely transparent to the + # user, and should generally be turned on. This directive + # is optional and can be removed for brevity. + + share_instance = Yes + + + # If you want to run multiple *different* shared instances + # on the same system, you will need to specify different + # instance names for each. On platforms supporting domain + # sockets, this can be done with the instance_name option: + + instance_name = default + + +# Some platforms don't support domain sockets, and if that +# is the case, you can isolate different instances by +# specifying a unique set of ports for each: + +# shared_instance_port = 37428 +# instance_control_port = 37429 + + +# If you want to explicitly use TCP for shared instance +# communication, instead of domain sockets, this is also +# possible, by using the following option: + +# shared_instance_type = tcp + + +# You can configure whether Reticulum should discover +# available interfaces from other Transport Instances over +# the network. If this option is enabled, Reticulum will +# collect interface information discovered from the network. + +# discover_interfaces = No + + +# You can configure Reticulum to panic and forcibly close +# if an unrecoverable interface error occurs, such as the +# hardware device for an interface disappearing. This is +# an optional directive, and can be left out for brevity. +# This behaviour is disabled by default. + +# panic_on_interface_error = No + + +# If you're connecting to a large external network, you +# can use one or more external blackhole list to block +# spammy and excessive announces onto your network. This +# funtionality is especially useful if you're hosting public +# entrypoints or gateways. The list source below provides a +# functional example, but better, more timely maintained +# lists probably exist in the community. + +# blackhole_sources = 521c87a83afb8f29e4455e77930b973b + + +[logging] + # Valid log levels are 0 through 7: + # 0: Log only critical information + # 1: Log errors and lower log levels + # 2: Log warnings and lower log levels + # 3: Log notices and lower log levels + # 4: Log info and lower (this is the default) + # 5: Verbose logging + # 6: Debug logging + # 7: Extreme logging + + loglevel = 4 + + +# The interfaces section defines the physical and virtual +# interfaces Reticulum will use to communicate on. This +# section will contain examples for a variety of interface +# types. You can modify these or use them as a basis for +# your own config, or simply remove the unused ones. + +[interfaces] + + # This interface enables communication with other + # link-local Reticulum nodes over UDP. It does not + # need any functional IP infrastructure like routers + # or DHCP servers, but will require that at least link- + # local IPv6 is enabled in your operating system, which + # should be enabled by default in almost any OS. See + # the Reticulum Manual for more configuration options. + + [[Default Interface]] + type = AutoInterface + enabled = No + + [[Packet Radio AX25 KISS]] + type = AX25KISSInterface + enabled = Yes + + callsign = {{ET_CALLSIGN}} + ssid = 1 + + port = /tmp/kisstnc + mtu = 256 diff --git a/overlay/opt/emcomm-tools/conf/template.d/reticulum/config.ax25.300 b/overlay/opt/emcomm-tools/conf/template.d/reticulum/config.ax25.300 new file mode 100644 index 0000000..4c55d13 --- /dev/null +++ b/overlay/opt/emcomm-tools/conf/template.d/reticulum/config.ax25.300 @@ -0,0 +1,128 @@ +# This is the default Reticulum config file. +# You should probably edit it to include any additional, +# interfaces and settings you might need. + +# Only the most basic options are included in this default +# configuration. To see a more verbose, and much longer, +# configuration example, you can run the command: +# rnsd --exampleconfig + + +[reticulum] + + # If you enable Transport, your system will route traffic + # for other peers, pass announces and serve path requests. + # This should only be done for systems that are suited to + # act as transport nodes, ie. if they are stationary and + # always-on. This directive is optional and can be removed + # for brevity. + + enable_transport = False + + + # By default, the first program to launch the Reticulum + # Network Stack will create a shared instance, that other + # programs can communicate with. Only the shared instance + # opens all the configured interfaces directly, and other + # local programs communicate with the shared instance over + # a local socket. This is completely transparent to the + # user, and should generally be turned on. This directive + # is optional and can be removed for brevity. + + share_instance = Yes + + + # If you want to run multiple *different* shared instances + # on the same system, you will need to specify different + # instance names for each. On platforms supporting domain + # sockets, this can be done with the instance_name option: + + instance_name = default + + +# Some platforms don't support domain sockets, and if that +# is the case, you can isolate different instances by +# specifying a unique set of ports for each: + +# shared_instance_port = 37428 +# instance_control_port = 37429 + + +# If you want to explicitly use TCP for shared instance +# communication, instead of domain sockets, this is also +# possible, by using the following option: + +# shared_instance_type = tcp + + +# You can configure whether Reticulum should discover +# available interfaces from other Transport Instances over +# the network. If this option is enabled, Reticulum will +# collect interface information discovered from the network. + +# discover_interfaces = No + + +# You can configure Reticulum to panic and forcibly close +# if an unrecoverable interface error occurs, such as the +# hardware device for an interface disappearing. This is +# an optional directive, and can be left out for brevity. +# This behaviour is disabled by default. + +# panic_on_interface_error = No + + +# If you're connecting to a large external network, you +# can use one or more external blackhole list to block +# spammy and excessive announces onto your network. This +# funtionality is especially useful if you're hosting public +# entrypoints or gateways. The list source below provides a +# functional example, but better, more timely maintained +# lists probably exist in the community. + +# blackhole_sources = 521c87a83afb8f29e4455e77930b973b + + +[logging] + # Valid log levels are 0 through 7: + # 0: Log only critical information + # 1: Log errors and lower log levels + # 2: Log warnings and lower log levels + # 3: Log notices and lower log levels + # 4: Log info and lower (this is the default) + # 5: Verbose logging + # 6: Debug logging + # 7: Extreme logging + + loglevel = 4 + + +# The interfaces section defines the physical and virtual +# interfaces Reticulum will use to communicate on. This +# section will contain examples for a variety of interface +# types. You can modify these or use them as a basis for +# your own config, or simply remove the unused ones. + +[interfaces] + + # This interface enables communication with other + # link-local Reticulum nodes over UDP. It does not + # need any functional IP infrastructure like routers + # or DHCP servers, but will require that at least link- + # local IPv6 is enabled in your operating system, which + # should be enabled by default in almost any OS. See + # the Reticulum Manual for more configuration options. + + [[Default Interface]] + type = AutoInterface + enabled = No + + [[Packet Radio AX25 KISS]] + type = AX25KISSInterface + enabled = Yes + + callsign = {{ET_CALLSIGN}} + ssid = 1 + + port = /tmp/kisstnc + mtu = 256