Exemplo n.º 1
0
    print("An update requires a reboot to complete")
    while True:
        res = input("Restart now? (Y/N) ")
        if res.lower() == "n":
            print("Reboot your machine manually to finish the update.")
            break
        if res.lower() != "y":
            continue
        # reboot using logind
        obj = dbus.SystemBus().get_object("org.freedesktop.login1",
                                          "/org/freedesktop/login1")
        obj.Reboot(True, dbus_interface="org.freedesktop.login1.Manager")


if __name__ == "__main__":
    ARGS = parse_args()
    CLIENT = Fwupd.Client()
    check_exists(ARGS.exe)
    try:
        is_restore_required = set_conf_only_trusted(CLIENT, False)
        directory = tempfile.mkdtemp()
        guid, deviceid, version = find_uefi_device(CLIENT, ARGS.deviceid)
        cab = generate_cab(ARGS.exe, directory, guid, version)
        install(CLIENT, cab, deviceid, True, True)
    except Exception as e:
        print(e)

    if is_restore_required:
        set_conf_only_trusted(CLIENT, True)
    prompt_reboot()
Exemplo n.º 2
0
 def _status_cb(self, client, _gparamstring):
     self._info("Status: {}".format(
         Fwupd.status_to_string(client.get_status())))
Exemplo n.º 3
0
def status_changed(client, spec, progress):  #pylint: disable=unused-argument
    """Signal emitted by fwupd daemon indicating status changed"""
    progress.status_changed(client.get_percentage(),
                            Fwupd.status_to_string(client.get_status()))
Exemplo n.º 4
0
def status_changed(client, spec, progress): #pylint: disable=unused-argument
    """Signal emitted by fwupd daemon indicating status changed"""
    progress.status_changed(client.get_percentage(),
                            Fwupd.status_to_string(client.get_status()))