From: Septatrix <24257556+Septatrix@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:20:14 +0000 (+0100) Subject: Use hosts preferred dnf version in mkosi-initrd X-Git-Tag: v25~72^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3323%2Fhead;p=thirdparty%2Fmkosi.git Use hosts preferred dnf version in mkosi-initrd --- 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: