mirror of
https://github.com/femtofox/femtofox.git
synced 2026-10-25 18:40:20 -04:00
Add meshtastic_cli to usb config tool
This commit is contained in:
parent
ff37008b0f
commit
4550289068
2 changed files with 15 additions and 5 deletions
|
|
@ -44,11 +44,12 @@ meshtastic_update() {
|
|||
local command="$1"
|
||||
local attempts=$2
|
||||
local ref="$3: "
|
||||
echo "${ref:+$ref}meshtastic --host $command"
|
||||
echo "Submitting to Meshtastic..."
|
||||
for retries in $(seq 1 $attempts); do
|
||||
local output=$(meshtastic --host $command 2>&1 | tee $(if [ -e /dev/tty ]; then echo /dev/tty; else echo /dev/ttyFIQ0; fi))
|
||||
logger $output
|
||||
if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then
|
||||
output=$(meshtastic --host --info | tee /dev/fd/2)
|
||||
logger "$output"
|
||||
if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno|failed|Failed"; then
|
||||
if [ "$retries" -lt $attempts ]; then
|
||||
local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..."
|
||||
echo "$msg"
|
||||
|
|
@ -177,8 +178,10 @@ get_meshtastic_settings() {
|
|||
|
||||
eval "url_primary_channel='$(echo "$meshtastic_info" | sed -n 's/^Primary channel URL: //p')'"
|
||||
[[ "$1" != *"quiet"* ]] && echo "url_primary_channel:$url_primary_channel"
|
||||
eval "url_all_channels='$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')'"
|
||||
[[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels"
|
||||
if echo "$meshtastic_info" | grep -q "^Complete URL (includes all channels): "; then
|
||||
url_all_channels=$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')
|
||||
[[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -270,6 +270,13 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
|
|||
meshtastic_security_command+=" -o \"$meshtastic_legacy_admin\"" # add to the command list
|
||||
fi
|
||||
|
||||
# get meshtastic_cli= lines and run them
|
||||
while IFS='=' read -r key value; do
|
||||
log_message "Meshtastic CLI command found."
|
||||
femto-meshtasticd-config.sh -m "$value" 3 "Meshtastic CLI command" 2>&1 | tee -a /tmp/femtofox-config.log
|
||||
found_config=true
|
||||
done < <(grep '^meshtastic_cli=' "$usb_config" | sed -E 's/^meshtastic_cli=["]?(.*[^"])["]?$/meshtastic_cli=\1/')
|
||||
|
||||
if [ "$found_config" = true ]; then #if we found a config file containing valid data
|
||||
if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi
|
||||
log_message "Making changes to wifi settings and restarting wifi."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue