mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 10:44:12 +00:00
trivial: simple_client: add a refresh metadata function
This commit is contained in:
parent
88dc597125
commit
a13ba4e8a1
@ -1,10 +1,17 @@
|
|||||||
if get_option('firmware-packager')
|
if get_option('firmware-packager')
|
||||||
install_data('firmware_packager.py',
|
install_data('firmware_packager.py',
|
||||||
install_dir : 'share/fwupd')
|
install_dir : 'share/fwupd')
|
||||||
install_data('simple_client.py',
|
|
||||||
install_dir : 'share/fwupd')
|
|
||||||
install_data('add_capsule_header.py',
|
install_data('add_capsule_header.py',
|
||||||
install_dir : 'share/fwupd')
|
install_dir : 'share/fwupd')
|
||||||
install_data('install_dell_bios_exe.py',
|
install_data('install_dell_bios_exe.py',
|
||||||
install_dir : 'share/fwupd')
|
install_dir : 'share/fwupd')
|
||||||
|
con2 = configuration_data()
|
||||||
|
con2.set('FWUPD_VERSION', fwupd_version)
|
||||||
|
configure_file(
|
||||||
|
input : 'simple_client.py',
|
||||||
|
output : 'simple_client.py',
|
||||||
|
configuration : con2,
|
||||||
|
install: true,
|
||||||
|
install_dir: 'share/fwupd',
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
@ -62,13 +62,23 @@ def parse_args():
|
|||||||
help="Reinstall payloads(default False)",
|
help="Reinstall payloads(default False)",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"command", choices=["get-devices", "get-details", "install"], help="What to do"
|
"command", choices=["get-devices", "get-details", "install", "refresh"], help="What to do"
|
||||||
)
|
)
|
||||||
parser.add_argument('cab', nargs='?', help='CAB file')
|
parser.add_argument('cab', nargs='?', help='CAB file')
|
||||||
parser.add_argument('deviceid', nargs='?', help='DeviceID to operate on(optional)')
|
parser.add_argument('deviceid', nargs='?', help='DeviceID to operate on(optional)')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def refresh(client):
|
||||||
|
"""Uses fwupd client to refresh metadata"""
|
||||||
|
remotes = client.get_remotes()
|
||||||
|
client.set_user_agent_for_package("simple_client", "@FWUPD_VERSION@")
|
||||||
|
for remote in remotes:
|
||||||
|
if not remote.get_enabled():
|
||||||
|
continue
|
||||||
|
if remote.get_kind() != Fwupd.RemoteKind.DOWNLOAD:
|
||||||
|
continue
|
||||||
|
client.refresh_remote(remote)
|
||||||
|
|
||||||
def get_devices(client):
|
def get_devices(client):
|
||||||
"""Use fwupd client to fetch devices"""
|
"""Use fwupd client to fetch devices"""
|
||||||
@ -140,6 +150,8 @@ if __name__ == '__main__':
|
|||||||
elif ARGS.command == "get-details":
|
elif ARGS.command == "get-details":
|
||||||
check_exists(ARGS.cab)
|
check_exists(ARGS.cab)
|
||||||
get_details(CLIENT, ARGS.cab)
|
get_details(CLIENT, ARGS.cab)
|
||||||
|
elif ARGS.command == "refresh":
|
||||||
|
refresh(CLIENT)
|
||||||
elif ARGS.command == "install":
|
elif ARGS.command == "install":
|
||||||
check_exists(ARGS.cab)
|
check_exists(ARGS.cab)
|
||||||
install(CLIENT, ARGS.cab, ARGS.deviceid, ARGS.allow_older, ARGS.allow_reinstall)
|
install(CLIENT, ARGS.cab, ARGS.deviceid, ARGS.allow_older, ARGS.allow_reinstall)
|
||||||
|
Loading…
Reference in New Issue
Block a user