Files
emcomm-tools-os-community/overlay/opt/emcomm-tools/bin/et-reticulum
T

88 lines
2.1 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 12 May 2026
# Updated : 14 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. Optional modem started
# 3. Reticulum started
. /opt/emcomm-tools/bin/et-common
APP="Reticulum"
RETICULUM_CONF_DIR="${HOME}/.reticulum"
RETICULUM_CONF_FILE="${RETICULUM_CONF_DIR}/config"
options=()
files=()
index=1
while IFS= read -r file; do
name=$(basename "$file")
files[$index]="$name"
options+=("$index" "$name")
((index++))
done < <(find "${HOME}/.reticulum" -type f -name 'config.blueprint.*')
choice=$(dialog \
--title "Reticulum Configuration" \
--menu "Choose a blueprint:" \
15 60 10 \
"${options[@]}" \
2>&1 >/dev/tty)
EXIT_STATUS=$?
tput sgr0 && clear
if [[ ${EXIT_STATUS} -ne 0 ]]; then
et-log "No blueprint configuration selected"
exit ${EXIT_STATUS}
fi
SELECTED_CONF="${files[$choice]}"
if [[ ! -e "${RETICULUM_CONF_DIR}" ]]; then
et-log "Creating missing configuration directory: ${RETICULUM_CONF_DIR}"
mkdir -p "${RETICULUM_CONF_DIR}"
fi
ACTIVE_CONF_FILE="${RETICULUM_CONF_DIR}/${SELECTED_CONF}"
if [[ ! -e ${ACTIVE_CONF_FILE} ]]; then
et-log "${ACTIVE_CONF_FILE} does not exist."
exit 1
fi
et-log "Using ${ACTIVE_CONF_FILE}"
if [[ -e "${RETICULUM_CONF_FILE}" ]]; then
et-log "Removing previous Reticulum configuration: ${RETICULUM_CONF_FILE}"
rm "${RETICULUM_CONF_FILE}"
fi
et-log "Linking new configuration..."
ln -v -s "${ACTIVE_CONF_FILE}" "${RETICULUM_CONF_FILE}"
# Update replacement tokens
# Callsign
[[ -z "$ET_USER_CONFIG" ]] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
sed -i "s|{{ET_CALLSIGN}}|${CALLSIGN}|g" ${RETICULUM_CONF_FILE}
# AX.25 KISS interface
sed -i "s|{{ET_RETICULUM_INTERFACE_AX25KISS_ENABLED}}|no|g" ${RETICULUM_CONF_FILE}
# RNode (LoRA) interface
sed -i "s|{{ET_RETICULUM_INTERFACE_RNODE_ENABLED}}|yes|g" ${RETICULUM_CONF_FILE}
CMD="rnsd"
et-log "Starting Reticulum: ${CMD}"
${CMD}