From 10e4c116f7ee0d64014403304d374f1d3d363b4c Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:00:56 +0000 Subject: [PATCH 1/6] Update femto-usb-config-tool.sh Added a check for `dont_run_config_if_log_exists` --- .../usr/local/bin/femto-usb-config-tool.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 3ef0524..d2803e5 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 @@ -71,6 +71,12 @@ fi wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf" usb_config="/tmp/femtofox-config.txt" + # Check if the mounted USB drive contains a file femtofox-config.log +if [ -f "$mount_point/femtofox-config.log" ]; then + log_message "femtofox-config.log found on USB drive." + log_exists=true +fi + # Check if the mounted USB drive contains a file femtofox-config.txt if [ -f "$mount_point/femtofox-config.txt" ]; then log_message "femtofox-config.txt found on USB drive." @@ -88,6 +94,15 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then wifi_command="femto-network-config.sh" meshtastic_security_command="femto-meshtasticd-config.sh" + # Check if the log exits and if the dont_run_config_if_log_exists line is set in the script + if [[ log_exists && -n "$dont_run_config_if_log_exists" ]]; then + log_message "log exists and script is set to exit" + for _ in {1..5}; do #boot code + blink "1.5" && sleep 0.5 + done + exit_script 0 + fi + # Escape and read the fields from the USB config file if they exist while IFS='=' read -r key value; do value=$(echo "$value" | tr -d '"') From eb6bb3c37af44fdac7117d6a883d562ccba32f04 Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:38:46 +0000 Subject: [PATCH 2/6] Update femto-usb-config-tool.sh --- .../usr/local/bin/femto-usb-config-tool.sh | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 d2803e5..7fe9b4d 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 @@ -93,16 +93,8 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then update_wifi="false" wifi_command="femto-network-config.sh" meshtastic_security_command="femto-meshtasticd-config.sh" - - # Check if the log exits and if the dont_run_config_if_log_exists line is set in the script - if [[ log_exists && -n "$dont_run_config_if_log_exists" ]]; then - log_message "log exists and script is set to exit" - for _ in {1..5}; do #boot code - blink "1.5" && sleep 0.5 - done - exit_script 0 - fi - + dont_run_config_if_log_exists="false" + # Escape and read the fields from the USB config file if they exist while IFS='=' read -r key value; do value=$(echo "$value" | tr -d '"') @@ -115,9 +107,18 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_url) meshtastic_url=$(escape_sed "$value") ;; meshtastic_legacy_admin) meshtastic_legacy_admin=$(escape_sed "$value") ;; meshtastic_admin_key) meshtastic_admin_key=$(escape_sed "$value") ;; + dont_run_config_if_log_exists) dont_run_config_if_log_exists=$(escape_sed "$value") ;; esac done < <(grep -E '^(wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_admin_key)=' "$usb_config") + # Check if the log exits and if the dont_run_config_if_log_exists line is set in the script + if [[ $log_exists="true" && $dont_run_config_if_log_exists="true" ]]; then + log_message "log exists and script is set to exit" + for _ in {1..5}; do #boot code + blink "1.5" && sleep 0.5 + done + exit_script 1 + fi # Update wpa_supplicant.conf with the new values, if specified if [[ -n "$wifi_country" ]]; then From dd9277c55d9c438496c1f85d4adf295a3f9eafa0 Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:21:53 +0000 Subject: [PATCH 3/6] Update femto-usb-config-tool.sh --- .../usr/local/bin/femto-usb-config-tool.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 7fe9b4d..dbfb096 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 @@ -75,6 +75,8 @@ usb_config="/tmp/femtofox-config.txt" if [ -f "$mount_point/femtofox-config.log" ]; then log_message "femtofox-config.log found on USB drive." log_exists=true +else + log_exists=false fi # Check if the mounted USB drive contains a file femtofox-config.txt @@ -109,12 +111,12 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_admin_key) meshtastic_admin_key=$(escape_sed "$value") ;; dont_run_config_if_log_exists) dont_run_config_if_log_exists=$(escape_sed "$value") ;; esac - done < <(grep -E '^(wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_admin_key)=' "$usb_config") + done < <(grep -E '^(wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_admin_key|dont_run_if_log_exists)=' "$usb_config") - # Check if the log exits and if the dont_run_config_if_log_exists line is set in the script - if [[ $log_exists="true" && $dont_run_config_if_log_exists="true" ]]; then + # Check if the log exits and if the dont_run_if_log_exists line is set in the script + if $log_exists && [[ $dont_run_if_log_exists="true" ]]; then log_message "log exists and script is set to exit" - for _ in {1..5}; do #boot code + for _ in {1..2}; do #boot code blink "1.5" && sleep 0.5 done exit_script 1 From fe45a9485042ed029d594cabe7fd91ab6aad90a7 Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Wed, 8 Jan 2025 01:27:02 +0000 Subject: [PATCH 4/6] Update femto-usb-config-tool.sh --- .../usr/local/bin/femto-usb-config-tool.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 dbfb096..f7ee418 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 @@ -95,10 +95,14 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then update_wifi="false" wifi_command="femto-network-config.sh" meshtastic_security_command="femto-meshtasticd-config.sh" - dont_run_config_if_log_exists="false" + dont_run_if_log_exists="" # Escape and read the fields from the USB config file if they exist while IFS='=' read -r key value; do + # Skip lines starting with # + if [[ "$key" =~ ^# ]]; then + continue + fi value=$(echo "$value" | tr -d '"') case "$key" in wifi_ssid) wifi_ssid=$(escape_sed "$value") ;; @@ -109,12 +113,12 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_url) meshtastic_url=$(escape_sed "$value") ;; meshtastic_legacy_admin) meshtastic_legacy_admin=$(escape_sed "$value") ;; meshtastic_admin_key) meshtastic_admin_key=$(escape_sed "$value") ;; - dont_run_config_if_log_exists) dont_run_config_if_log_exists=$(escape_sed "$value") ;; + dont_run_if_log_exists) dont_run_if_log_exists=$(escape_sed "$value") ;; esac done < <(grep -E '^(wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_admin_key|dont_run_if_log_exists)=' "$usb_config") # Check if the log exits and if the dont_run_if_log_exists line is set in the script - if $log_exists && [[ $dont_run_if_log_exists="true" ]]; then + if $log_exists && [[ $dont_run_if_log_exists = "true" ]]; then log_message "log exists and script is set to exit" for _ in {1..2}; do #boot code blink "1.5" && sleep 0.5 From 3201106dde3ac973a37d3ae82275e8ac2ade8fcc Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:04:09 +0200 Subject: [PATCH 5/6] Update femto-usb-config-tool.sh --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f7ee418..2416c92 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 @@ -119,7 +119,7 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then # Check if the log exits and if the dont_run_if_log_exists line is set in the script if $log_exists && [[ $dont_run_if_log_exists = "true" ]]; then - log_message "log exists and script is set to exit" + log_message "\`dont_run_if_log_exists\` is set to \"true\" and log exists, ignoring..." for _ in {1..2}; do #boot code blink "1.5" && sleep 0.5 done From 4afe8a2167dea1859901694fbb84b6ae68955486 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:10:32 +0200 Subject: [PATCH 6/6] Update femto-usb-config-tool.sh --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2416c92..1328565 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 @@ -119,7 +119,7 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then # Check if the log exits and if the dont_run_if_log_exists line is set in the script if $log_exists && [[ $dont_run_if_log_exists = "true" ]]; then - log_message "\`dont_run_if_log_exists\` is set to \"true\" and log exists, ignoring..." + log_message "\`dont_run_if_log_exists\` is set to \"true\" and log exists, ignoring." for _ in {1..2}; do #boot code blink "1.5" && sleep 0.5 done