diff --git a/overlay/etc/skel/.bash_profile b/overlay/etc/skel/.bash_profile index 836ca2c..85352f9 100644 --- a/overlay/etc/skel/.bash_profile +++ b/overlay/etc/skel/.bash_profile @@ -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 diff --git a/overlay/etc/skel/.config/emcomm-tools/user.json b/overlay/etc/skel/.config/emcomm-tools/user.json new file mode 100644 index 0000000..2d66dd5 --- /dev/null +++ b/overlay/etc/skel/.config/emcomm-tools/user.json @@ -0,0 +1,4 @@ +{ + "callsign": "N0CALL", + "grid": "DM33" +} diff --git a/overlay/etc/skel/.conkyrc b/overlay/etc/skel/.conkyrc index 1173e7d..6a20cd7 100644 --- a/overlay/etc/skel/.conkyrc +++ b/overlay/etc/skel/.conkyrc @@ -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} ]]; diff --git a/overlay/opt/emcomm-tools/bin/et-js8call b/overlay/opt/emcomm-tools/bin/et-js8call index 02d0d88..d92ec47 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8call +++ b/overlay/opt/emcomm-tools/bin/et-js8call @@ -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 diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index df82ac7..fcc9879 100755 --- a/overlay/opt/emcomm-tools/bin/et-system-info +++ b/overlay/opt/emcomm-tools/bin/et-system-info @@ -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) " 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: ," 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 diff --git a/overlay/opt/emcomm-tools/bin/et-user b/overlay/opt/emcomm-tools/bin/et-user new file mode 100755 index 0000000..e58e454 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-user @@ -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 < "${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 +