]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(install.d): correctly install pre-genned image and die if no args
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>
Wed, 17 Apr 2024 19:33:04 +0000 (21:33 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Wed, 17 Apr 2024 20:17:52 +0000 (16:17 -0400)
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
install.d/50-dracut.install
install.d/51-dracut-rescue.install

index 82fab8d5dbe9044fd20c2faa703ce91e6ce60c8f..1f896d6fad743e791233c4b3023b39e8191eaa65 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/bash
 
-COMMAND="$1"
-KERNEL_VERSION="$2"
+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
@@ -34,8 +34,8 @@ if [[ -f ${KERNEL_IMAGE%/*}/$IMAGE ]]; then
     # we found an initrd or uki.efi at the same place as the kernel
     # use this and don't generate a new one
     [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \
-        "There is an ${IMAGE} image at the same place as the kernel, skipping generating a new one"
-    cp --reflink=auto "$IMAGE_PREGENERATED" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
+        "There is an $IMAGE image at the same place as the kernel, skipping generating a new one"
+    cp --reflink=auto "${KERNEL_IMAGE%/*}/$IMAGE" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
         && chown root:root "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
         && chmod 0600 "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
         && exit 0
index f473ad494bd706df56e6c06323cbab2e1af03f1a..f65c558a7787f0b42624d913792a871bf07e62a9 100755 (executable)
@@ -2,10 +2,10 @@
 
 export LANG=C
 
-COMMAND="$1"
-KERNEL_VERSION="$2"
+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