Winlink - Initial support for setting Winlink passwd

This commit is contained in:
Gaston Gonzalez
2024-11-04 16:47:24 -07:00
parent 0feede9d3c
commit dc2e5feafd
3 changed files with 16 additions and 13 deletions
@@ -1,4 +1,5 @@
{
"callsign": "N0CALL",
"grid": "DM33"
"grid": "DM33",
"winlinkPasswd": "NOPASS"
}
+7 -2
View File
@@ -2,6 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 25 October 2024
# Updated: 4 November 2024
# Purpose: Set user-specific settings for EmComm Tools.
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
@@ -12,18 +13,22 @@ fi
CUR_CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
CUR_GRID=$(cat ${ET_USER_CONFIG} | jq -r .grid)
CUR_WINLINK_PASSWD=$(cat ${ET_USER_CONFIG} | jq -r .winlinkPasswd)
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
read -e -p "Enter your Winlink password: " winlink_passwd
callsign=${callsign:-"$CUR_CALLSIGN"}
grid=${grid:-"$CUR_GRID"}
winlink_passwd=${winlink_passwd:-"$CUR_WINLINK_PASSWD"}
echo
echo "Is the following correct?:"
echo "Callsign: $callsign"
echo "Grid Square: $grid"
echo "Winlink Password: *******"
read -p "(y/n): " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
@@ -31,12 +36,12 @@ while true; do
cat <<EOF > "${ET_USER_CONFIG}"
{
"callsign": "${callsign}",
"grid": "${grid}"
"grid": "${grid}",
"winlinkPasswd": "${winlink_passwd}"
}
EOF
echo "User settings updated..."
cat ${ET_USER_CONFIG} | jq .
break
elif [[ "$confirm" =~ ^[Nn]$ ]]; then
echo "Let's try again."
+4 -7
View File
@@ -11,6 +11,7 @@
# Postconditions:
# 1. Callsign and Winlink password are updated
# 2. pat http is started
set -e
PAT_CONF_FILE=${HOME}/.config/pat/config.json
PAT_CONF_FILE_TEMPLATE=/etc/skel/.config/pat/config.json
@@ -62,6 +63,7 @@ update_config () {
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign)
WINLINK_PASSWD=$(cat ${ET_USER_CONFIG} | jq -r .winlinkPasswd)
if [ "${CALLSIGN}" = "N0CALL" ]; then
notify_user "Can't start Pat. No callsign set. Run: et-user."
@@ -70,14 +72,9 @@ update_config () {
et-log "Updating Pat configuration file: ${PAT_CONF_FILE}..."
cp -v ${PAT_CONF_FILE_TEMPLATE} ${PAT_CONF_FILE}
sed -i "s|{{ET_CALLSIGN}}|${CALLSIGN}|g" ${PAT_CONF_FILE}
#systemctl status gpsd --no-pager > /dev/null
#if [ $? -ne 0 ]; then
# et-log "GPS not connected. Removing GPS port from configuration."
# sed -i '/GPSD/d' ${YAAC_CONF_FILE_PORTS}
#fi
sed -i "s|{{ET_WINLINK_PASSWD}}|${WINLINK_PASSWD}|g" ${PAT_CONF_FILE}
}
case $1 in