Skip to content

Instantly share code, notes, and snippets.

@xenithorb
Last active April 18, 2016 14:23
Show Gist options
  • Save xenithorb/d93acfbcb807d0a2825c6702796a63ee to your computer and use it in GitHub Desktop.
Save xenithorb/d93acfbcb807d0a2825c6702796a63ee to your computer and use it in GitHub Desktop.
Just upgrade packages for Bodhi Update ID
#!/usr/bin/env python3
#
# Usage:
# chmod +x get_bodhi_update.py
# sudo ./get_bodhi_update.py FEDORA-2016-d67632bb64
#
import sys, json, requests, subprocess
bodhi_server = "https://bodhi.fedoraproject.org/updates/"
bodhi_id = sys.argv[1]
# Lucky for us Bodhi outputs JSON when curl'd
json_doc = requests.get(bodhi_server + bodhi_id)
print(json_doc.status_code, json_doc.url)
payload = json.loads(json_doc.text)
packages = payload['update']['title'].split()
subprocess.call(["dnf", "--enablerepo=updates-testing", "upgrade"] + packages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment