Added public and private key settings to usb config tool

This commit is contained in:
nagumii 2025-01-23 18:35:30 +02:00
parent 9b1010f982
commit bd729fa3fd

View file

@ -120,10 +120,12 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
timezone) timezone=$(escape_sed "$value") ;;
meshtastic_url) meshtastic_url=$(escape_sed "$value") ;;
meshtastic_legacy_admin) meshtastic_legacy_admin=$(escape_sed "$value") ;;
meshtastic_public_key) meshtastic_public_key=$(escape_sed "$value") ;;
meshtastic_private_key) meshtastic_private_key=$(escape_sed "$value") ;;
meshtastic_admin_key) meshtastic_admin_key=$(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")
done < <(grep -E '^(wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_public_key|meshtastic_private_key|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
@ -222,7 +224,21 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
log_message "Updating Meshtastic URL."
found_config="true"
fi
if [[ -n "$meshtastic_public_key" ]]; then
meshtastic_public_key="$(echo "$meshtastic_public_key" | sed 's/\\//g')" # remove weirdo windows characters
log_message "Updating Meshtastic public key."
found_config="true"
meshtastic_security_command+=" -U \"$meshtastic_public_key\"" # add to the command list
fi
if [[ -n "$meshtastic_private_key" ]]; then
meshtastic_private_key="$(echo "$meshtastic_private_key" | sed 's/\\//g')" # remove weirdo windows characters
log_message "Updating Meshtastic private key."
found_config="true"
meshtastic_security_command+=" -R \"$meshtastic_private_key\"" # add to the command list
fi
if [[ -n "$meshtastic_admin_key" ]]; then
meshtastic_admin_key=$(echo "$meshtastic_admin_key" | sed 's/\\//g') # remove weirdo windows characters
if [ "$meshtastic_admin_key" = "clear" ]; then