Skip to content

Commit ca4e8f1

Browse files
committed
10_linux: inform if no initrd is found for the kernel
1 parent b773360 commit ca4e8f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

util/grub.d/10_linux.in

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ for rd in ${GRUB_EARLY_INITRD_LINUX_STOCK[@]} \
9090
if [ -e "$KERNEL_DIR"/"$rd" ] ; then
9191
INITRD_EARLY="${INITRD_EARLY} ${KERNEL_DIR}/${rd}"
9292
fi
93+
INITRD_EARLY="${INITRD_EARLY##[ ]}"
9394
done
9495
# Returns the default page size suffix.
9596
# WARN $arch is the output of `uname -m`, which is not exactly the same as
@@ -297,14 +298,18 @@ get_initrd() {
297298
initrd.img-"$1" \
298299
initrd-"$1".gz ; do
299300
if [ -e "$KERNEL_DIR/$rd" ] ; then
300-
info "$(gettext_printf "Initial ramdisk image for kernel %s: %s" "$1" "${GRUB_KERNEL_DIR}${rd}")"
301+
info "$(gettext_printf "Initial ramdisk image for kernel '%s': '%s'" "$1" "${GRUB_KERNEL_DIR}${rd}")"
301302
ret="${ret} ${GRUB_KERNEL_DIR}${rd}"
302303
break
303304
else
304305
continue
305306
fi
306307
done
307-
printf "%s" "$ret"
308+
if [ -n "$ret" ] ; then
309+
printf "%s" "$ret"
310+
else
311+
info "$(gettext_printf "No initial ramdisk image found for kernel '%s'" "$1")"
312+
fi
308313
}
309314

310315
process_kernels() {

0 commit comments

Comments
 (0)