Skip to content

Commit 742561e

Browse files
kernel-install: 90-loaderentry: error out on nonexistent initrds instead of swallowing them quietly
1 parent 76b1274 commit 742561e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/kernel-install/90-loaderentry.install

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {
9393

9494
shift "$INITRD_OPTIONS_SHIFT"
9595
for initrd; do
96-
[ -f "$initrd" ] || continue
96+
[ -f "$initrd" ] || {
97+
echo "Initrd '$initrd' not a file." >&2
98+
exit 1
99+
}
97100

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

111-
# Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
112-
[ $# -eq 0 ] && set -- "initrd"
113-
114114
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Creating $LOADER_ENTRY"
115115
{
116116
echo "title $PRETTY_NAME"
@@ -119,8 +119,10 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
119119
echo "options $BOOT_OPTIONS"
120120
echo "linux $ENTRY_DIR/linux"
121121
for initrd; do
122-
[ -f "$ENTRY_DIR_ABS/${initrd##*/}" ] && echo "initrd $ENTRY_DIR/${initrd##*/}"
122+
echo "initrd $ENTRY_DIR/${initrd##*/}"
123123
done
124+
# Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
125+
[ $# -eq 0 ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd $ENTRY_DIR/initrd"
124126
:
125127
} >"$LOADER_ENTRY" || {
126128
echo "Could not create loader entry '$LOADER_ENTRY'." >&2

0 commit comments

Comments
 (0)