]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-initramfs-restore.sh): correct initrd globbing
authorBenjamin Drung <benjamin.drung@canonical.com>
Mon, 24 Jun 2024 15:11:26 +0000 (17:11 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Mon, 24 Jun 2024 23:10:38 +0000 (19:10 -0400)
Quoting the globbing `*` will prevent Bash from use globbing. So only
quote the kernel version variable that could potentially contain spaces.

Fixes: 28820e205328 ("feat(dracut.sh): make initramfs-${kernel}.img filename configurable")
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
dracut-initramfs-restore.sh

index 4491ad3d88b9b99a1d18b0355bf0a8131294f0c8..fd4c3c0b7896c80d94c4b0be329d1b01d0a41102 100755 (executable)
@@ -46,7 +46,7 @@ elif mountpoint -q /efi; then
 elif mountpoint -q /boot/efi; then
     IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
 else
-    files=("/boot/initr*${KERNEL_VERSION}*")
+    files=(/boot/initr*"${KERNEL_VERSION}"*)
     if [ "${#files[@]}" -ge 1 ] && [ -e "${files[0]}" ]; then
         IMG="${files[0]}"
     elif [[ -f /boot/initramfs-linux.img ]]; then