From 9431219a44bbaac4b3e76307bd263a1db50ed639 Mon Sep 17 00:00:00 2001 From: Septatrix <24257556+Septatrix@users.noreply.github.com> Date: Wed, 8 Jan 2025 22:20:14 +0100 Subject: [PATCH] Use hosts preferred dnf version in mkosi-initrd --- mkosi/initrd.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mkosi/initrd.py b/mkosi/initrd.py index 8efa0142d..6673605a0 100644 --- a/mkosi/initrd.py +++ b/mkosi/initrd.py @@ -200,13 +200,14 @@ def main() -> None: if Path("/etc/kernel/cmdline").exists(): cmdline += ["--kernel-command-line", Path("/etc/kernel/cmdline").read_text()] - # Prefer dnf as dnf5 has not yet officially replaced it and there's a much bigger chance that there - # will be a populated dnf cache directory. + # Resolve dnf binary to determine which version the host uses by default + # (to avoid preferring dnf5 if the host uses dnf4) + # as there's a much bigger chance that it has a populated dnf cache directory. run( cmdline, stdin=sys.stdin, stdout=sys.stdout, - env={"MKOSI_DNF": dnf.name} if (dnf := find_binary("dnf", "dnf5")) else {}, + env={"MKOSI_DNF": dnf.resolve().name} if (dnf := find_binary("dnf")) else {}, ) if args.output_dir: -- 2.47.2