Additional error messages for offline flashing.

This commit is contained in:
Michael Faragher 2023-02-22 12:49:24 -06:00
parent b381a61be8
commit 5b3d26a90a
1 changed files with 12 additions and 1 deletions

View File

@ -831,6 +831,9 @@ class RNode():
print(" WARNING! This device is NOT verifiable and should NOT be trusted.") print(" WARNING! This device is NOT verifiable and should NOT be trusted.")
print(" Someone could have added privacy-breaking or malicious code to it.") print(" Someone could have added privacy-breaking or malicious code to it.")
print(" ") print(" ")
print(" Please verify the signing key is present on this machine.")
print(" Autogenerated keys will not match another machine's signature.")
print(" ")
print(" Proceed at your own risk and responsibility! If you created this") print(" Proceed at your own risk and responsibility! If you created this")
print(" device yourself, please read the documentation on how to sign your") print(" device yourself, please read the documentation on how to sign your")
print(" device to avoid this warning.") print(" device to avoid this warning.")
@ -948,6 +951,7 @@ def ensure_firmware_file(fw_filename):
RNS.log("Failed to retrive latest version information for your board.") RNS.log("Failed to retrive latest version information for your board.")
RNS.log("Check your internet connection and try again.") RNS.log("Check your internet connection and try again.")
RNS.log("If you don't have Internet access currently, use the --fw-version option to manually specify a version.") RNS.log("If you don't have Internet access currently, use the --fw-version option to manually specify a version.")
RNS.log("You can also use --extract to copy the firmware from a known-good RNode of the same model.")
exit() exit()
import shutil import shutil
@ -972,6 +976,7 @@ def ensure_firmware_file(fw_filename):
os.makedirs(UPD_DIR+"/"+selected_version) os.makedirs(UPD_DIR+"/"+selected_version)
if not os.path.isfile(UPD_DIR+"/"+selected_version+"/"+fw_filename): if not os.path.isfile(UPD_DIR+"/"+selected_version+"/"+fw_filename):
RNS.log("Firmware "+UPD_DIR+"/"+selected_version+"/"+fw_filename+" not found.")
RNS.log("Downloading missing firmware file: "+fw_filename+" for version "+selected_version) RNS.log("Downloading missing firmware file: "+fw_filename+" for version "+selected_version)
urlretrieve(update_target_url, UPD_DIR+"/"+selected_version+"/"+fw_filename) urlretrieve(update_target_url, UPD_DIR+"/"+selected_version+"/"+fw_filename)
RNS.log("Firmware file downloaded") RNS.log("Firmware file downloaded")
@ -986,6 +991,7 @@ def ensure_firmware_file(fw_filename):
selected_hash = release_info.split()[1] selected_hash = release_info.split()[1]
except Exception as e: except Exception as e:
RNS.log("Could not read locally cached release information.") RNS.log("Could not read locally cached release information.")
RNS.log("Ensure "+UPD_DIR+"/"+selected_version+"/"+fw_filename+".version exists and has the correct format and hash.")
RNS.log("You can clear the cache with the --clear-cache option and try again.") RNS.log("You can clear the cache with the --clear-cache option and try again.")
if selected_hash == None: if selected_hash == None:
@ -1132,6 +1138,11 @@ def main():
if args.fw_version != None: if args.fw_version != None:
selected_version = args.fw_version selected_version = args.fw_version
try:
check_float = float(selected_version)
except ValueError:
RNS.log("Selected version \""+selected_version+"\" does not appear to be a number.")
exit()
if args.force_update: if args.force_update:
force_update = True force_update = True
@ -2937,4 +2948,4 @@ def extract_recovery_esptool():
exit(181) exit(181)
if __name__ == "__main__": if __name__ == "__main__":
main() main()