kernel-install: fix dracut initrd detection (240 backward compatibility) (#11570)
authorMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Sun, 27 Jan 2019 16:32:21 +0000 (17:32 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 27 Jan 2019 16:32:21 +0000 (17:32 +0100)
commitd279b185c004fdaf7913778f052ec2ab249cd473
treedd42cd77f0eb7db0d95eac72ad0a187f812e6793
parentccfe70a6eefe4346184b5f6fd7eaf37840e9cec2
kernel-install: fix dracut initrd detection (240 backward compatibility) (#11570)

* kernel-install: fix initrd when called as installkernel

Running make install from the kernel runs e.g.:
installkernel 4.20.5 arch/x86/boot/bzImage System.map "/boot"

Since 0912c0b80eb24fb9a4e1cc4abf274a1358b9943d this would
cal 90-loaderentry.install with those arguments:
add 4.20.5 /boot/... arch/x86/boot/bzImage System.map "/boot"

The two last arguments would then be handled as the initrd files.
As System.map exists in current directory but not in /boot/...
it would get copied there, and used as initrd intead of the initrd
which has been generated by dracut.

With this change, nothing changes when kernel-install is called
directly, but when it's called as installkernel, we now pass
thos arguments to 90-loaderentry.install:
add 4.20.5 /boot/... arch/x86/boot/bzImage initrd
initrd is thus detected as the file to use for the initrd, and as it
exists, nothing is copied over and the initrd line generated is
consistent with what one would expect

* kernel-install: fix dracut initrd detection when called directly

This brings back the systemd 240 behaviour when called directly too

* kernel-install: unify initrd fallback

* kernel-install: move initrd fallback handling to 90-loaderentry.install

* kernel-install: move initrd fallback just before creating loader entry
src/kernel-install/90-loaderentry.install
src/kernel-install/kernel-install