diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 70a0dac..d9c2fec 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -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 } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 5096583..5bf0574 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -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."