mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Merged feature/et-mode
This commit is contained in:
@@ -0,0 +1 @@
|
||||
none
|
||||
@@ -0,0 +1,21 @@
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 November 2024
|
||||
# Purpose : User systemd unit file for EmComm Tools ARDOP service
|
||||
#
|
||||
# Usage:
|
||||
# Check status : systemctl --user status et-service-ardop
|
||||
# Start service : systemctl --user start et-service-ardop
|
||||
# Stop service : systemctl --user stop et-service-ardop
|
||||
# Reload this config : systemctl --user daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=EmComm Tools ARDOP service
|
||||
# Disable conditional check for audio device. Allow et-ardop to enforce.
|
||||
#ConditionPathExists=/dev/et-audio
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/emcomm-tools/bin/et-ardop
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,22 @@
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 November 2024
|
||||
# Purpose : User systemd unit file for EmComm Tools Dire Wolf digipeater packet
|
||||
# : service.
|
||||
#
|
||||
# Usage:
|
||||
# Check status : systemctl --user status et-service-direwolf-digipeater
|
||||
# Start service : systemctl --user start et-service-direwolf-digipeater
|
||||
# Stop service : systemctl --user stop et-service-direwolf-digipeater
|
||||
# Reload this config : systemctl --user daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=EmComm Tools Dire Wolf simple packet service
|
||||
# Disable conditional check for audio device. Allow et-ardop to enforce.
|
||||
#ConditionPathExists=/dev/et-audio
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/emcomm-tools/bin/et-direwolf start digipeater
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,22 @@
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 November 2024
|
||||
# Purpose : User systemd unit file for EmComm Tools Dire Wolf simple packet
|
||||
# : service.
|
||||
#
|
||||
# Usage:
|
||||
# Check status : systemctl --user status et-service-direwolf-simple
|
||||
# Start service : systemctl --user start et-service-direwolf-simple
|
||||
# Stop service : systemctl --user stop et-service-direwolf-simple
|
||||
# Reload this config : systemctl --user daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=EmComm Tools Dire Wolf simple packet service
|
||||
# Disable conditional check for audio device. Allow et-ardop to enforce.
|
||||
#ConditionPathExists=/dev/et-audio
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/emcomm-tools/bin/et-direwolf start simple
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,19 @@
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 November 2024
|
||||
# Purpose : User systemd unit file for EmComm Tools Winlink over ARDOP
|
||||
#
|
||||
# Usage:
|
||||
# Check status : systemctl --user status et-service-winlink-ardop
|
||||
# Start service : systemctl --user start et-service-winlink-ardop
|
||||
# Stop service : systemctl --user stop et-service-winlink-ardop
|
||||
# Reload this config : systemctl --user daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=EmComm Tools Winlink ARDOP service
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/emcomm-tools/bin/et-winlink start-ardop
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,19 @@
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 November 2024
|
||||
# Purpose : User systemd unit file for EmComm Tools Winlink over packet
|
||||
#
|
||||
# Usage:
|
||||
# Check status : systemctl --user status et-service-winlink-packet
|
||||
# Start service : systemctl --user start et-service-winlink-packet
|
||||
# Stop service : systemctl --user stop et-service-winlink-packet
|
||||
# Reload this config : systemctl --user daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=EmComm Tools Winlink packet service
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/emcomm-tools/bin/et-winlink start-packet
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -36,6 +36,9 @@ CAT : ${execpi 10 et-system-info et-cat}
|
||||
GPS : ${execpi 10 et-system-info et-gps}
|
||||
Audio: ${execpi 10 et-system-info et-audio}
|
||||
|
||||
${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}MODE
|
||||
${font DejaVu Sans Mono:size=11}${color yellow}${execpi 10 et-system-info et-mode}
|
||||
|
||||
${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}OPERATOR
|
||||
${font DejaVu Sans Mono:size=11}${color yellow}Callsign: ${execpi 10 et-system-info callsign}
|
||||
Grid : ${execpi 10 et-system-info grid}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 5 November 2024
|
||||
# Date : 6 November 2024
|
||||
# Purpose : Wrapper script for starting ARDOP
|
||||
#
|
||||
# Preconditions:
|
||||
@@ -16,6 +16,14 @@
|
||||
|
||||
ARDOP_PORT=8515
|
||||
|
||||
notify_user() {
|
||||
notify-send \
|
||||
-t 10000 \
|
||||
--app-name="EmComm Tools" \
|
||||
"$1"
|
||||
}
|
||||
|
||||
|
||||
[ -z ${ET_LOG_DIR} ] && ET_LOG_DIR="${HOME}/.local/share/emcomm-tools"
|
||||
[ ! -e ${ET_LOG_DIR} ] && mkdir -p ${ET_LOG_DIR}
|
||||
|
||||
@@ -37,10 +45,12 @@ if [ -e /dev/et-audio ]; then
|
||||
|
||||
else
|
||||
et-log "Can't start ARDOP modem. No ET_AUDIO device detected."
|
||||
notify_user "Select radio and plug it in"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
et-log "No ET_AUDIO device plugged in. No supported audio device plugged it."
|
||||
et-log "No ET_AUDIO device plugged in. No supported audio device plugged in."
|
||||
notify_user "Select radio and plug it in"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 1 November 2024
|
||||
# Updated : 3 November 2024
|
||||
# Updated : 7 November 2024
|
||||
# Purpose : Wrapper script for starting Dire Wolf with PnP support
|
||||
#
|
||||
# Preconditions:
|
||||
@@ -21,8 +21,8 @@ usage() {
|
||||
echo " update-config - Update configuration for selected mode"
|
||||
echo ""
|
||||
echo " <type>"
|
||||
echo " digipeater-only - Run in RF-only digipeater mode"
|
||||
echo " simple-packet - Run in simple packet mode"
|
||||
echo " digipeater - Run in RF-only digipeater mode"
|
||||
echo " simple - Run in simple packet mode"
|
||||
}
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
@@ -32,10 +32,10 @@ fi
|
||||
|
||||
MODE=$2
|
||||
case "${MODE}" in
|
||||
digipeater-only)
|
||||
digipeater)
|
||||
DIREWOLF_TEMPLATE_CONF_FILE="${ET_HOME}/conf/template.d/packet/direwolf.${MODE}.conf"
|
||||
;;
|
||||
simple-packet)
|
||||
simple)
|
||||
DIREWOLF_TEMPLATE_CONF_FILE="${ET_HOME}/conf/template.d/packet/direwolf.${MODE}.conf"
|
||||
;;
|
||||
*)
|
||||
@@ -47,24 +47,27 @@ esac
|
||||
|
||||
notify_user() {
|
||||
notify-send \
|
||||
-t 5000 \
|
||||
-t 10000 \
|
||||
--app-name="EmComm Tools" \
|
||||
"$1"
|
||||
}
|
||||
|
||||
[ -z ${ET_LOG_DIR} ] && ET_LOG_DIR="${HOME}/.local/share/emcomm-tools"
|
||||
[ ! -e ${ET_LOG_DIR} ] && mkdir -p ${ET_LOG_DIR}
|
||||
|
||||
start() {
|
||||
update-config
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
RIGCTLD_OUT=$(systemctl status rigctld)
|
||||
systemctl is-active --quiet 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"
|
||||
CMD="direwolf -c ${DIREWOLF_CONF_FILE} -l ${ET_LOG_DIR} -t 0 -p"
|
||||
et-log "Starting Dire Wolf with: '${CMD}'"
|
||||
echo
|
||||
${CMD}
|
||||
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 November 2024
|
||||
# Updated : 7 November 2024
|
||||
# Purpose : Configures the system for a specific mode of operation
|
||||
|
||||
# Use a simple text file to save the state of the last mode selected
|
||||
MODE_STATUS_FILE="${HOME}/.config/emcomm-tools/et-mode"
|
||||
|
||||
# List of supported modes of operation
|
||||
MODE_ID_NONE="none"
|
||||
MODE_ID_APRS_DIGIPEATER="aprs-digipeater"
|
||||
MODE_ID_APRS_CLIENT="aprs-client"
|
||||
MODE_ID_WINLINK_ARDOP="winlink-ardop"
|
||||
MODE_ID_WINLINK_PACKET="winlink-packet"
|
||||
|
||||
# 1. Attempt to stop all EmComm Tools services regardless if they are running.
|
||||
# 2. Stop the applications first, then the modems
|
||||
stop_all_services() {
|
||||
systemctl --user stop et-service-winlink-ardop
|
||||
systemctl --user stop et-service-winlink-packet
|
||||
systemctl --user stop et-service-ardop
|
||||
systemctl --user stop et-service-direwolf-simple
|
||||
systemctl --user stop et-service-direwolf-digipeater
|
||||
}
|
||||
|
||||
exit_on_service_failure() {
|
||||
local systemd_unit_name="$1"
|
||||
systemctl is-active --user --quiet "${systemd_unit_name}"
|
||||
if [ $? -ne 0 ]; then
|
||||
et-log "Can't start mode. ${systemd_unit_name} failed to start."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
TIMEOUT=15 # Total time to wait in seconds
|
||||
INTERVAL=2 # Interval between checks in seconds
|
||||
|
||||
start_and_wait_for_service() {
|
||||
local systemd_unit_name="$1"
|
||||
local elapsed=0
|
||||
|
||||
et-log "Starting ${systemd_unit_name}..."
|
||||
systemctl --user start ${systemd_unit_name}
|
||||
|
||||
et-log "Waiting for ${systemd_unit_name} to become active..."
|
||||
|
||||
while ! systemctl is-active --user --quiet "${systemd_unit_name}"; do
|
||||
sleep "$INTERVAL"
|
||||
elapsed=$((elapsed + INTERVAL))
|
||||
if [ "$elapsed" -ge "$TIMEOUT" ]; then
|
||||
et-log "Timeout reached. ${systemd_unit_name} failed to start."
|
||||
exit 1
|
||||
fi
|
||||
et-log "Waiting for ${systemd_unit_name} to become active..."
|
||||
done
|
||||
|
||||
# Some applications even when started still need a bit of extra time to be available.
|
||||
# Add a short think time of 2 seconds. The ARDOP modem requies extra time.
|
||||
sleep 2
|
||||
|
||||
# Do one more check to ensure that we are running, otherwise exit.
|
||||
exit_on_service_failure ${systemd_unit_name}
|
||||
}
|
||||
|
||||
# Build list of options
|
||||
options=()
|
||||
options+=("${MODE_ID_NONE}" "No mode selected")
|
||||
options+=("${MODE_ID_APRS_CLIENT}" "APRS Client (YAAC)")
|
||||
options+=("${MODE_ID_APRS_DIGIPEATER}" "APRS Digipeater")
|
||||
options+=("${MODE_ID_WINLINK_ARDOP}" "Winlink ARDOP")
|
||||
options+=("${MODE_ID_WINLINK_PACKET}" "Winlink Packet")
|
||||
|
||||
# Prompt user for option and save exit status
|
||||
SELECTED_MODE=$(dialog --clear --menu "Select a mode:" 20 60 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||
exit_status=$?
|
||||
|
||||
tput sgr 0 && clear
|
||||
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
|
||||
stop_all_services
|
||||
|
||||
case ${SELECTED_MODE} in
|
||||
${MODE_ID_NONE})
|
||||
et-log "No mode selected"
|
||||
;;
|
||||
${MODE_ID_APRS_DIGIPEATER})
|
||||
systemctl --user start et-service-direwolf-digipeater
|
||||
et-log "APRS digipeater now running."
|
||||
;;
|
||||
${MODE_ID_APRS_CLIENT})
|
||||
start_and_wait_for_service et-service-direwolf-simple
|
||||
et-yaac start
|
||||
;;
|
||||
${MODE_ID_WINLINK_ARDOP})
|
||||
start_and_wait_for_service et-service-ardop
|
||||
start_and_wait_for_service et-service-winlink-ardop
|
||||
min http://localhost:8080
|
||||
;;
|
||||
${MODE_ID_WINLINK_PACKET})
|
||||
start_and_wait_for_service et-service-direwolf-simple
|
||||
start_and_wait_for_service et-service-winlink-packet
|
||||
min http://localhost:8080
|
||||
;;
|
||||
*)
|
||||
et-log "Mode ${SELECTED_MODE} not yet supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ${SELECTED_MODE} > ${MODE_STATUS_FILE}
|
||||
|
||||
else
|
||||
et-log "No mode selected"
|
||||
echo ${MODE_ID_NONE} > ${MODE_STATUS_FILE}
|
||||
exit 1
|
||||
fi
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 6 October 2024
|
||||
# Updated : 30 October 2024
|
||||
# Updated : 6 November 2024
|
||||
# Purpose : Utility script for dumping system information
|
||||
|
||||
function usage() {
|
||||
@@ -13,6 +13,7 @@ function usage() {
|
||||
echo " et-audio-card - Display audio card and device: <card>,<device>"
|
||||
echo " et-cat - Show state of CAT control interface"
|
||||
echo " et-gps - Show state of GPS interface"
|
||||
echo " et-mode - Show current mode"
|
||||
echo " grid - Current grid square defined by user"
|
||||
echo " ip - System IP address"
|
||||
echo " release - EmComm Tools release"
|
||||
@@ -167,6 +168,37 @@ case $1 in
|
||||
echo "Not connected"
|
||||
fi
|
||||
|
||||
;;
|
||||
et-mode)
|
||||
SELECTED_MODE=$(cat "${HOME}/.config/emcomm-tools/et-mode")
|
||||
|
||||
MODE_ID_NONE="none"
|
||||
MODE_ID_APRS_DIGIPEATER="aprs-digipeater"
|
||||
MODE_ID_APRS_CLIENT="aprs-client"
|
||||
MODE_ID_WINLINK_ARDOP="winlink-ardop"
|
||||
MODE_ID_WINLINK_PACKET="winlink-packet"
|
||||
|
||||
case ${SELECTED_MODE} in
|
||||
${MODE_ID_NONE})
|
||||
echo "Not selected"
|
||||
;;
|
||||
${MODE_ID_APRS_DIGIPEATER})
|
||||
echo "Digipeater"
|
||||
;;
|
||||
${MODE_ID_APRS_CLIENT})
|
||||
echo "APRS"
|
||||
;;
|
||||
${MODE_ID_WINLINK_ARDOP})
|
||||
echo "Winlink ARDOP"
|
||||
;;
|
||||
${MODE_ID_WINLINK_PACKET})
|
||||
echo "Winlink Packet"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown"
|
||||
;;
|
||||
esac
|
||||
|
||||
;;
|
||||
ip)
|
||||
hostname -I | awk '{print $1}'
|
||||
|
||||
Reference in New Issue
Block a user