mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Config - Initial support for EmComm Tools user configuration. This is a WiP and will likely change
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Author : Gaston Gonzalez
|
||||
# Date : 25 October 2024
|
||||
# Purpose : Set user-specific settings for EmComm Tools.
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user