mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Merge pull request #13 from thetechprepper/feature/chattervox
Added plug-and-play support for Chattervox (chat) as a new mode
This commit is contained in:
Executable
+153
@@ -0,0 +1,153 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Author : Gaston Gonzalez
|
||||||
|
# Date : 5 December 2024
|
||||||
|
# Updated : 6 December 2024
|
||||||
|
# Purpose : Wrapper script for starting chattervox with PnP support
|
||||||
|
#
|
||||||
|
# Preconditions:
|
||||||
|
# 1. Supported radio and audio interface are connected and properly detected
|
||||||
|
# 2. Dire Wolf is started
|
||||||
|
#
|
||||||
|
# Postconditions:
|
||||||
|
# 1. On first start, configuration is created and signing key is generated.
|
||||||
|
# 2. chattervox is started in chat mode
|
||||||
|
|
||||||
|
CHATTERVOX_CONF_DIR=${HOME}/.chattervox
|
||||||
|
CHATTERVOX_CONF_FILE=${CHATTERVOX_CONF_DIR}/config.json
|
||||||
|
CHATTERVOX_KEYSTORE_FILE=${CHATTERVOX_CONF_DIR}/keystore.json
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "usage: $(basename $0) <command>"
|
||||||
|
echo " <command>"
|
||||||
|
echo " start - Start chat"
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_config() {
|
||||||
|
|
||||||
|
CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
|
||||||
|
|
||||||
|
cat <<EOF > "${CHATTERVOX_CONF_FILE}"
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"callsign": "${CALLSIGN}",
|
||||||
|
"ssid": 0,
|
||||||
|
"keystoreFile": "${HOME}/.chattervox/keystore.json",
|
||||||
|
"kissPort": "kiss://localhost:8001",
|
||||||
|
"kissBaud": 9600,
|
||||||
|
"feedbackDebounce": 20000
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Generate keystore file if it does not exist
|
||||||
|
if [ ! -e ${CHATTERVOX_KEYSTORE_FILE} ]; then
|
||||||
|
chattervox genkey
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Grab existing or newly generated signing key if available
|
||||||
|
SIGNING_KEY=$(cat ${CHATTERVOX_KEYSTORE_FILE} | jq -e -r .${CALLSIGN}[0].public)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
et-log "Generating signing key for ${CALLSIGN}..."
|
||||||
|
chattervox genkey
|
||||||
|
SIGNING_KEY=$(cat ${CHATTERVOX_KEYSTORE_FILE} | jq -e -r .${CALLSIGN}[0].public)
|
||||||
|
else
|
||||||
|
et-log "Signing key already exits for ${CALLSIGN}."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cat <<EOF > "${CHATTERVOX_CONF_FILE}"
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"callsign": "${CALLSIGN}",
|
||||||
|
"ssid": 0,
|
||||||
|
"keystoreFile": "${HOME}/.chattervox/keystore.json",
|
||||||
|
"kissPort": "kiss://localhost:8001",
|
||||||
|
"kissBaud": 9600,
|
||||||
|
"feedbackDebounce": 20000,
|
||||||
|
"signingKey": "${SIGNING_KEY}"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
update-config
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
|
||||||
|
RIGCTLD_OUT=$(ps -ef | grep [d]irewolf)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
et-log "Can't start chattervox. Dire Wolf not running."
|
||||||
|
notify_user "Can't start chattervox. Dire Wolf not running."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CWD_DIR=$(pwd)
|
||||||
|
|
||||||
|
CMD="chattervox chat"
|
||||||
|
et-log "Starting chattervox with: ${CMD}"
|
||||||
|
|
||||||
|
${CMD}
|
||||||
|
|
||||||
|
else
|
||||||
|
et-log "Error updating configuration. Can't start chattervox"
|
||||||
|
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 chattervox. No callsign set. Run: et-user."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ ! -e ${CHATTERVOX_CONF_DIR} ] && mkdir ${CHATTERVOX_CONF_DIR}
|
||||||
|
|
||||||
|
if [ ! -e ${CHATTERVOX_CONF_FILE} ]; then
|
||||||
|
et-log "chattervox configuration does not exist creating: ${CHATTERVOX_CONF_FILE}..."
|
||||||
|
generate_config
|
||||||
|
|
||||||
|
else
|
||||||
|
et-log "Chattervox configuration already exists, checking for change in et-user..."
|
||||||
|
|
||||||
|
CUR_CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
|
||||||
|
CONFIGURED_CALLSIGN=$(cat ${CHATTERVOX_CONF_FILE} | jq -r .callsign)
|
||||||
|
|
||||||
|
if [ "${CUR_CALLSIGN}" != "${CONFIGURED_CALLSIGN}" ]; then
|
||||||
|
et-log "User callsign has changed from ${CUR_CALLSIGN} to ${CONFIGURED_CALLSIGN}"
|
||||||
|
generate_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
update-config)
|
||||||
|
update-config
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid command."
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Author : Gaston Gonzalez
|
# Author : Gaston Gonzalez
|
||||||
# Date : 6 November 2024
|
# Date : 6 November 2024
|
||||||
# Updated : 3 December 2024
|
# Updated : 5 December 2024
|
||||||
# Purpose : Configures the system for a specific mode of operation
|
# Purpose : Configures the system for a specific mode of operation
|
||||||
|
|
||||||
# Use a simple text file to save the state of the last mode selected
|
# Use a simple text file to save the state of the last mode selected
|
||||||
@@ -13,6 +13,7 @@ MODE_ID_NONE="none"
|
|||||||
MODE_ID_APRS_DIGIPEATER="aprs-digipeater"
|
MODE_ID_APRS_DIGIPEATER="aprs-digipeater"
|
||||||
MODE_ID_APRS_CLIENT="aprs-client"
|
MODE_ID_APRS_CLIENT="aprs-client"
|
||||||
MODE_ID_BBS_CLIENT="bbs-client"
|
MODE_ID_BBS_CLIENT="bbs-client"
|
||||||
|
MODE_ID_CHAT_CLIENT="chat-chattervox"
|
||||||
MODE_ID_PACKET_DIGIPEATER="packet-digipeater"
|
MODE_ID_PACKET_DIGIPEATER="packet-digipeater"
|
||||||
MODE_ID_WINLINK_ARDOP="winlink-ardop"
|
MODE_ID_WINLINK_ARDOP="winlink-ardop"
|
||||||
MODE_ID_WINLINK_PACKET="winlink-packet"
|
MODE_ID_WINLINK_PACKET="winlink-packet"
|
||||||
@@ -66,13 +67,14 @@ options=()
|
|||||||
options+=("${MODE_ID_NONE}" "No mode selected")
|
options+=("${MODE_ID_NONE}" "No mode selected")
|
||||||
options+=("${MODE_ID_APRS_CLIENT}" "APRS Client (YAAC)")
|
options+=("${MODE_ID_APRS_CLIENT}" "APRS Client (YAAC)")
|
||||||
options+=("${MODE_ID_BBS_CLIENT}" "BBS Client (Paracon)")
|
options+=("${MODE_ID_BBS_CLIENT}" "BBS Client (Paracon)")
|
||||||
|
options+=("${MODE_ID_CHAT_CLIENT}" "Chat (chattervox)")
|
||||||
options+=("${MODE_ID_APRS_DIGIPEATER}" "APRS Digipeater")
|
options+=("${MODE_ID_APRS_DIGIPEATER}" "APRS Digipeater")
|
||||||
options+=("${MODE_ID_PACKET_DIGIPEATER}" "Packet Digipeater")
|
options+=("${MODE_ID_PACKET_DIGIPEATER}" "Packet Digipeater")
|
||||||
options+=("${MODE_ID_WINLINK_ARDOP}" "Winlink over HF (ARDOP)")
|
options+=("${MODE_ID_WINLINK_ARDOP}" "Winlink over HF (ARDOP)")
|
||||||
options+=("${MODE_ID_WINLINK_PACKET}" "Winlink over VHF/UHF (AX.25 Packet)")
|
options+=("${MODE_ID_WINLINK_PACKET}" "Winlink over VHF/UHF (AX.25 Packet)")
|
||||||
|
|
||||||
# Prompt user for option and save exit status
|
# Prompt user for option and save exit status
|
||||||
SELECTED_MODE=$(dialog --clear --menu "Select a mode:" 15 65 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
SELECTED_MODE=$(dialog --clear --menu "Select a mode:" 16 65 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||||
exit_status=$?
|
exit_status=$?
|
||||||
|
|
||||||
tput sgr 0 && clear
|
tput sgr 0 && clear
|
||||||
@@ -100,6 +102,11 @@ if [ $exit_status -eq 0 ]; then
|
|||||||
et-log "Starting Paracon."
|
et-log "Starting Paracon."
|
||||||
et-paracon start
|
et-paracon start
|
||||||
;;
|
;;
|
||||||
|
${MODE_ID_CHAT_CLIENT})
|
||||||
|
start_and_wait_for_service et-service-direwolf-simple
|
||||||
|
et-log "Starting chattervox"
|
||||||
|
et-chattervox start
|
||||||
|
;;
|
||||||
${MODE_ID_PACKET_DIGIPEATER})
|
${MODE_ID_PACKET_DIGIPEATER})
|
||||||
systemctl --user start et-service-direwolf-packet-digipeater
|
systemctl --user start et-service-direwolf-packet-digipeater
|
||||||
et-log "Packet digipeater now running."
|
et-log "Packet digipeater now running."
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Author : Gaston Gonzalez
|
# Author : Gaston Gonzalez
|
||||||
# Date : 6 October 2024
|
# Date : 6 October 2024
|
||||||
# Updated : 3 December 2024
|
# Updated : 5 December 2024
|
||||||
# Purpose : Utility script for dumping system information
|
# Purpose : Utility script for dumping system information
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
@@ -177,6 +177,7 @@ case $1 in
|
|||||||
MODE_ID_NONE="none"
|
MODE_ID_NONE="none"
|
||||||
MODE_ID_APRS_DIGIPEATER="aprs-digipeater"
|
MODE_ID_APRS_DIGIPEATER="aprs-digipeater"
|
||||||
MODE_ID_BBS_CLIENT="bbs-client"
|
MODE_ID_BBS_CLIENT="bbs-client"
|
||||||
|
MODE_ID_CHAT_CLIENT="chat-chattervox"
|
||||||
MODE_ID_PACKET_DIGIPEATER="packet-digipeater"
|
MODE_ID_PACKET_DIGIPEATER="packet-digipeater"
|
||||||
MODE_ID_APRS_CLIENT="aprs-client"
|
MODE_ID_APRS_CLIENT="aprs-client"
|
||||||
MODE_ID_WINLINK_ARDOP="winlink-ardop"
|
MODE_ID_WINLINK_ARDOP="winlink-ardop"
|
||||||
@@ -201,6 +202,9 @@ case $1 in
|
|||||||
${MODE_ID_BBS_CLIENT})
|
${MODE_ID_BBS_CLIENT})
|
||||||
echo "BBS Client"
|
echo "BBS Client"
|
||||||
;;
|
;;
|
||||||
|
${MODE_ID_CHAT_CLIENT})
|
||||||
|
echo "Chat (chattervox)"
|
||||||
|
;;
|
||||||
${MODE_ID_PACKET_DIGIPEATER})
|
${MODE_ID_PACKET_DIGIPEATER})
|
||||||
echo "Packet Digipeater"
|
echo "Packet Digipeater"
|
||||||
;;
|
;;
|
||||||
|
|||||||
Executable
+42
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Author : Gaston Gonzalez
|
||||||
|
# Date : 4 December 2024
|
||||||
|
# Purpose : Install chattervox protocol
|
||||||
|
set -e
|
||||||
|
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
|
||||||
|
trap 'et-log "\"${last_command}\" command failed with exit code $?."' ERR
|
||||||
|
|
||||||
|
. ./env.sh
|
||||||
|
|
||||||
|
NAME=chattervox
|
||||||
|
VERSION=0.7.0
|
||||||
|
TARBALL=chattervox-linux-x64.tar.gz
|
||||||
|
INSTALL_DIR="/opt/${NAME}-${VERSION}"
|
||||||
|
LINK_PATH="/opt/${NAME}"
|
||||||
|
|
||||||
|
et-log "Installing ${NAME} ${VERSION}..."
|
||||||
|
|
||||||
|
URL=https://github.com/brannondorsey/chattervox/releases/download/v${VERSION}/chattervox-linux-x64.tar.gz
|
||||||
|
|
||||||
|
et-log "Downloading: ${URL}"
|
||||||
|
curl -s -L -o ${TARBALL} --fail ${URL}
|
||||||
|
|
||||||
|
CWD_DIR=`pwd`
|
||||||
|
|
||||||
|
tar -xzf ${TARBALL}
|
||||||
|
|
||||||
|
if [ -e chattervox-linux-x64 ]; then
|
||||||
|
mv chattervox-linux-x64 ${INSTALL_DIR}
|
||||||
|
mkdir -p ${INSTALL_DIR}/bin
|
||||||
|
mv ${INSTALL_DIR}/chattervox ${INSTALL_DIR}/bin/
|
||||||
|
mv ${INSTALL_DIR}/serialport.node ${INSTALL_DIR}/bin/
|
||||||
|
rm -v ${TARBALL}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -e ${LINK_PATH} ] && rm ${LINK_PATH}
|
||||||
|
ln -s ${INSTALL_DIR} ${LINK_PATH}
|
||||||
|
|
||||||
|
stow -v -d /opt ${NAME} -t /usr/local
|
||||||
|
|
||||||
|
cd $CWD_DIR
|
||||||
+2
-1
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Author : Gaston Gonzalez
|
# Author : Gaston Gonzalez
|
||||||
# Date : 16 March 2024
|
# Date : 16 March 2024
|
||||||
# Updated : 28 November 2024
|
# Updated : 4 December 2024
|
||||||
# Purpose : Main installer for EmComm Tools OS Community
|
# Purpose : Main installer for EmComm Tools OS Community
|
||||||
|
|
||||||
. ./env.sh
|
. ./env.sh
|
||||||
@@ -40,6 +40,7 @@ exitIfNotRoot
|
|||||||
./install-yaac.sh
|
./install-yaac.sh
|
||||||
./install-bbs-client.sh
|
./install-bbs-client.sh
|
||||||
./install-bbs-server.sh
|
./install-bbs-server.sh
|
||||||
|
./install-chattervox.sh
|
||||||
|
|
||||||
# Install modems
|
# Install modems
|
||||||
./install-ardop.sh
|
./install-ardop.sh
|
||||||
|
|||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author : Gaston Gonzalez
|
||||||
|
# Date : 4 December 2024
|
||||||
|
# Purpose : Test chattervox installation
|
||||||
|
|
||||||
|
OUT=$(chattervox -v | grep "0.7.0")
|
||||||
|
exit $?
|
||||||
Reference in New Issue
Block a user