Merge pull request #236 from faragher/master

Additional error messages for offline flashing.
This commit is contained in:
markqvist 2023-03-02 11:31:31 +01:00 committed by GitHub
commit a06ae40797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -831,6 +831,9 @@ class RNode():
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(" ")
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(" device yourself, please read the documentation on how to sign your")
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("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("You can also use --extract to copy the firmware from a known-good RNode of the same model.")
exit()
import shutil
@ -972,6 +976,7 @@ def ensure_firmware_file(fw_filename):
os.makedirs(UPD_DIR+"/"+selected_version)
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)
urlretrieve(update_target_url, UPD_DIR+"/"+selected_version+"/"+fw_filename)
RNS.log("Firmware file downloaded")
@ -986,6 +991,7 @@ def ensure_firmware_file(fw_filename):
selected_hash = release_info.split()[1]
except Exception as e:
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.")
if selected_hash == None:
@ -1132,6 +1138,11 @@ def main():
if args.fw_version != None:
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:
force_update = True
@ -2937,4 +2948,4 @@ def extract_recovery_esptool():
exit(181)
if __name__ == "__main__":
main()
main()