]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(install.d): prevent failure when kernel-install command is not `add`
authorAndrew Gunnerson <accounts+github@chiller3.com>
Fri, 3 May 2024 02:12:46 +0000 (22:12 -0400)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Fri, 3 May 2024 21:57:33 +0000 (17:57 -0400)
PR #195 added `:?` checks to ensure that required variables are set, but
the checks also apply to KERNEL_IMAGE, which isn't present when running
`kernel-install remove <version>`. This commit removes the check from
that variable, similar to what systemd's `90-loadentry.install` does.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
install.d/50-dracut.install
install.d/51-dracut-rescue.install

index 1f896d6fad743e791233c4b3023b39e8191eaa65..14f87721641ee3d77a29cc6a1cb30d518187daa9 100755 (executable)
@@ -4,7 +4,7 @@ COMMAND="${1:?}"
 KERNEL_VERSION="${2:?}"
 #shellcheck disable=SC2034
 BOOT_DIR_ABS="$3"
-KERNEL_IMAGE="${4:?}"
+KERNEL_IMAGE="$4"
 
 # If the initrd was provided on the kernel command line, we shouldn't generate our own.
 if [[ "$COMMAND" != "add" || "$#" -gt 4 ]]; then
index f65c558a7787f0b42624d913792a871bf07e62a9..25f75557a40511b88e4fb2cc8464915bff621d68 100755 (executable)
@@ -5,7 +5,7 @@ export LANG=C
 COMMAND="${1:?}"
 KERNEL_VERSION="${2:?}"
 BOOT_DIR_ABS="${3%/*}/0-rescue"
-KERNEL_IMAGE="${4:?}"
+KERNEL_IMAGE="$4"
 
 # If the initrd was provided on the kernel command line, we shouldn't generate our own.
 if [[ "$COMMAND" = "add" && "$#" -gt 4 ]]; then