Skip to content

Instantly share code, notes, and snippets.

@arindamchoudhury
Last active September 22, 2015 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arindamchoudhury/3612d5ca2ec65ff5b617 to your computer and use it in GitHub Desktop.
Save arindamchoudhury/3612d5ca2ec65ff5b617 to your computer and use it in GitHub Desktop.
client = PackageKitGlib.Client()
print 'refreshing cache'
client.refresh_cache(False, None, lambda p, t, d: True, None)
print 'cache refreshing done'
print 'getting updates'
res = client.get_updates(PackageKitGlib.FilterEnum.NONE, None, lambda p, t, d: True, None)
packages = []
for pkg in res.get_package_array():
packages.append(pkg.get_id())
# updating the system
if packages:
print 'installing packages'
res = client.install_packages(False, packages, None, lambda p, t, d: True, None)
list_restart_array= res.get_require_restart_array()
restart_worst = res.get_require_restart_worst()
print res.get_exit_code() == PackageKitGlib.ExitEnum.SUCCESS
print restart_worst
print list_restart_array
for item in list_restart_array:
print item.props.package_id
print item.props.restart
else:
print 'upto date'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment