kernel-install kernelimage path quoted incorrectly.
The executed mkinitcpio command by 50-mkinitcpio.install
, currently is:
mkinitcpio -k 6.0.12-hardened1-1-hardened --kernelimage ''\''/usr/lib/modules/6.0.12-hardened1-1-hardened/vmlinuz'\''' --microcode ''\''/boot/intel-ucode.img'\''' -U /efi/EFI/Linux/46e5b7b51f69426fade60fe0cc165d7a-6.0.12-hardened1-1-hardened.efi
The apostrophies inside the double quotes become literal and escaped when putting together the mkinitpcion invocation.
My idea would be to use eval to fix this, i.e.:
diff --git a/50-mkinitcpio.install b/50-mkinitcpio.install
index a5e051b..b0dc4dd 100644
--- a/50-mkinitcpio.install
+++ b/50-mkinitcpio.install
@@ -49,7 +49,7 @@ case $COMMAND in
add)
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "+ mkinitcpio -k $KERNEL_VERSION $KERNEL_IMAGE_FLAGS $MICROCODE $IMAGE_GENERATION_FLAG $IMAGE_PATH"
#shellcheck disable=SC2046
- mkinitcpio -k "$KERNEL_VERSION" $KERNEL_IMAGE_FLAGS $MICROCODE $IMAGE_GENERATION_FLAG "$IMAGE_PATH"
+ eval "mkinitcpio -k \"$KERNEL_VERSION\" $KERNEL_IMAGE_FLAGS $MICROCODE $IMAGE_GENERATION_FLAG \"$IMAGE_PATH\""
;;
remove)
This was objected against by multiple people. What is the recommended way to fix this issue? Using bash arrays for the arguments?
CC: @nl6720, @lobachevsky
Edited by nl6720