Skip to content

Commit

Permalink
kernel-install: 90-loaderentry: error out on nonexistent initrds inst…
Browse files Browse the repository at this point in the history
…ead of swallowing them quietly
  • Loading branch information
nabijaczleweli committed Jan 4, 2022
1 parent 76b1274 commit 742561e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/kernel-install/90-loaderentry.install
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {

shift "$INITRD_OPTIONS_SHIFT"
for initrd; do
[ -f "$initrd" ] || continue
[ -f "$initrd" ] || {
echo "Initrd '$initrd' not a file." >&2
exit 1
}

initrd_basename="${initrd##*/}"
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $ENTRY_DIR_ABS/$initrd_basename"
Expand All @@ -108,9 +111,6 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
exit 1
}

# Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
[ $# -eq 0 ] && set -- "initrd"

[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Creating $LOADER_ENTRY"
{
echo "title $PRETTY_NAME"
Expand All @@ -119,8 +119,10 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
echo "options $BOOT_OPTIONS"
echo "linux $ENTRY_DIR/linux"
for initrd; do
[ -f "$ENTRY_DIR_ABS/${initrd##*/}" ] && echo "initrd $ENTRY_DIR/${initrd##*/}"
echo "initrd $ENTRY_DIR/${initrd##*/}"
done
# Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
[ $# -eq 0 ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd $ENTRY_DIR/initrd"
:
} >"$LOADER_ENTRY" || {
echo "Could not create loader entry '$LOADER_ENTRY'." >&2
Expand Down

0 comments on commit 742561e

Please sign in to comment.