stages/dnf: support --exclude
This allows given packages to be excluded from the transaction. This is useful if you want to install a group with certain exceptions. A common thing to do in kicktstart files is: ``` rm -f /boot/*-rescue* ``` By instead excluding the dracut-rescue-config package we end up with: ``` "deleted_files": [ "/etc/kernel/postinst.d", "/usr/lib/dracut/dracut.conf.d/02-rescue.conf", "/usr/lib/kernel/install.d/51-dracut-rescue.install", "/boot/initramfs-0-rescue-ffffffffffffffffffffffffffffffff.img", "/boot/vmlinuz-0-rescue-ffffffffffffffffffffffffffffffff" ], ``` Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
adf5989de2
commit
8f9dd5ec7d
2 changed files with 6 additions and 0 deletions
|
|
@ -23,6 +23,9 @@
|
|||
"qemu-guest-agent",
|
||||
"xen-libs",
|
||||
"langpacks-en"
|
||||
],
|
||||
"exclude-packages": [
|
||||
"dracut-config-rescue"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ def main(tree, options):
|
|||
basearch = options["basearch"]
|
||||
operation = options.get("operation", "install")
|
||||
weak_deps = options.get("install_weak_deps", True)
|
||||
exclude_packages = options.get("exclude-packages", [])
|
||||
|
||||
with open("/tmp/dnf.conf", "w") as conf:
|
||||
for repoid, repo in enumerate(repos):
|
||||
|
|
@ -101,6 +102,8 @@ def main(tree, options):
|
|||
]
|
||||
|
||||
cmd = base_cmd + [operation] + packages
|
||||
for x in exclude_packages:
|
||||
cmd += ["--exclude", x]
|
||||
print(" ".join(cmd), flush=True)
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue