Exemple #1
0
def failed(why):
    sys.stderr.write("Failed %s\n" % why)
    systemwide_lock.release_lock()
    sys.exit(1)
Exemple #2
0
def failed(why):
    sys.stderr.write("Failed %s\n" % why)
    systemwide_lock.release_lock()
    sys.exit(1)
Exemple #3
0
 if not systemwide_lock.get_lock():
     failed("to acquire update lock")
 u = Updater()
 print "Getting update metadata..."
 if not u.get_manifest():
     failed("to download update metadata")
 print u.purported_manifest
 print "Validating update signature..."
 if not u.parse_manifest():  # includes signature validity checking
     failed("to validate signature of update metdata")
 print "Checking whether to update..."
 if advise_only:
     # In this case, the update script is being run merely to check
     # and inform the user whether an update is available, not to
     # install it.
     systemwide_lock.release_lock()
     if u.is_newer():
         print "An update is available."
         sys.exit(0)
     else:
         print "No installable update is available."
         sys.exit(1)
 if u.is_newer():
     print "Downloading new firmware image..."
     if not u.download_file():
         failed("to download firmware image")
     print "Validating downloaded image..."
     if u.valid_firmware():
         print "Installing image..."
         if not u.do_update():
             failed("to install update")
Exemple #4
0
 print "Validating update signature..."
 if not u.parse_manifest():  # includes signature validity checking
     failed("to validate signature of update metdata")
 
 print "Checking whether to update..."
 if advise_only:
     # In this case, the update script is being run merely to check
     # and inform the user whether an update is available, not to
     # install it.
     # Store the current time (in Javascript format) in the
     # file that tracks when we last checked for updates.
     if u.is_newer():
         print "Updating " + update_check_file + " to indicate update is available."
         with open(update_check_file, "w") as f:
             f.write(repr(time.time()*1000) + "   Y")
         systemwide_lock.release_lock()
         sys.exit(0)
     else:
         print "Updating " + update_check_file + " to indicate no installable update available."
         with open(update_check_file, "w") as f:
             f.write(repr(time.time()*1000) + "   N")
         systemwide_lock.release_lock()
         sys.exit(1)
 if u.is_newer():
     print "Updating " + update_check_file + " to indicate update is available."
     with open(update_check_file, "w") as f:
         f.write(repr(time.time()*1000) + "   Y")
     print "Downloading new firmware image..."
     if not u.download_file():
         failed("to download firmware image")
     print "Validating downloaded image..."