Merged feature/et-user

This commit is contained in:
Gaston Gonzalez
2024-10-25 15:59:36 -07:00
6 changed files with 81 additions and 2 deletions
+3 -1
View File
@@ -1,6 +1,6 @@
# Author : Gaston Gonzalez
# Date : 23 April 2024
# Updated : 20 October 2024
# Updated : 25 October 2024
# Description : bash profile
# All user accounts should be in the 'et-data' group to allow data sharing with
@@ -24,3 +24,5 @@ NC='\x1B[0m'
echo -e "${YELLOW}"
cat /etc/motd
echo -e "${NC}"
export ET_USER_CONFIG=${HOME}/.config/emcomm-tools/user.json
@@ -0,0 +1,4 @@
{
"callsign": "N0CALL",
"grid": "DM33"
}
+4
View File
@@ -36,6 +36,10 @@ 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}OPERATOR
${font DejaVu Sans Mono:size=11}${color yellow}Callsign: ${execpi 10 et-system-info callsign}
Grid : ${execpi 10 et-system-info grid}
${font DejaVu Sans:bold:size=9}${color #805f4f}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release}
]];
+11
View File
@@ -39,6 +39,8 @@ update-config () {
JS8CALL_CONF_FILE="${HOME}/.config/JS8Call.ini"
JS8CALL_TEMPLATE_CONF_FILE=${ET_HOME}/conf/template.d/js8call/JS8Call.rigctl.ini
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
# Special case for the DigiRig Mobile when connected to a radio that does
# not support CAT control.
@@ -53,6 +55,15 @@ update-config () {
cp ${JS8CALL_TEMPLATE_CONF_FILE} ${JS8CALL_CONF_FILE}
et-log "Replaced JS8Call configuration with template: ${JS8CALL_TEMPLATE_CONF_FILE}"
# Update configuration with current callsign and grid
CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
GRID=$(cat ${ET_USER_CONFIG} | jq -r .grid)
sed -i "s|^MyCall.*|MyCall=${CALLSIGN}|" ${JS8CALL_CONF_FILE}
sed -i "s|^MyGrid.*|MyGrid=${GRID}|" ${JS8CALL_CONF_FILE}
et-log "Updated JS8Call configuration with user callsign '${CALLSIGN}' and grid: '${GRID}'"
# 1. Check if the symlink was created by the udev rules
if [ -e /dev/et-audio ]; then
+11 -1
View File
@@ -2,16 +2,18 @@
#
# Author : Gaston Gonzalez
# Date : 6 October 2024
# Updated : 23 October 2024
# Updated : 25 October 2024
# Purpose : Utility script for dumping system information
function usage() {
echo "Usage: $(basename $0) <command>"
echo " active-radio - Display model of active radio"
echo " callsign - Current callsign"
echo " et-audio - Show state of audio interface"
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 " grid - Current grid square defined by user"
echo " ip - System IP address"
echo " release - EmComm Tools release"
}
@@ -21,6 +23,8 @@ if [ $# -ne 1 ]; then
exit 1
fi
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
case $1 in
active-radio)
if [ -L "${ET_HOME}/conf/radios.d/active-radio.json" ]; then
@@ -29,6 +33,12 @@ case $1 in
echo "No radio selected"
fi
;;
callsign)
cat ${ET_USER_CONFIG} | jq -r .callsign
;;
grid)
cat ${ET_USER_CONFIG} | jq -r .grid
;;
et-audio)
# 1. Check if the symlink was created by the udev rules
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 25 October 2024
# Purpose : Set user-specific settings for EmComm Tools.
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
if [ ! -e ${ET_USER_CONFIG} ]; then
cp /etc/skel/.config/emcomm-tools/user.json ${ET_USER_CONFIG}
fi
CUR_CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
CUR_GRID=$(cat ${ET_USER_CONFIG} | jq -r .grid)
while true; do
read -e -p "Enter your callsign (current: ${CUR_CALLSIGN}): " callsign
read -e -p "Enter your maidenhead grid square (current: ${CUR_GRID}): " grid
callsign=${callsign:-"$CUR_CALLSIGN"}
grid=${grid:-"$CUR_GRID"}
echo
echo "Is the following correct?:"
echo "Callsign: $callsign"
echo "Grid Square: $grid"
read -p "(y/n): " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
cat <<EOF > "${ET_USER_CONFIG}"
{
"callsign": "${callsign}",
"grid": "${grid}"
}
EOF
echo "User settings updated..."
cat ${ET_USER_CONFIG} | jq .
break
elif [[ "$confirm" =~ ^[Nn]$ ]]; then
echo "Let's try again."
echo
else
echo "Please enter 'y' or 'n'."
fi
done