diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-01-19 12:15:16 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-01-28 16:17:47 +0100 |
commit | 680cec6b4ddb356d7dd087b197718712cb5c1662 (patch) | |
tree | 9586fbea8d344e80aba0e1cf88244eb6410f674d /src/kernel-install | |
parent | kernel-install: k-i already creates $ENTRY_DIR_ABS, no need to do it again (diff) | |
download | systemd-680cec6b4ddb356d7dd087b197718712cb5c1662.tar.xz systemd-680cec6b4ddb356d7dd087b197718712cb5c1662.zip |
kernel-install: prefix errors with "Error:", exit immediately
kernel-install would continue after errors… We don't want this, as it
makes the results totally unpredicatable. If we didn't install the kernel
or didn't do some important part of the setup, let's just return an error
and let the user deal with it.
When looking at output, the error was often hard to distinguish, esp.
with -v. Add "Error:" everywhere to make the output easier to parse.
Diffstat (limited to 'src/kernel-install')
-rw-r--r-- | src/kernel-install/90-loaderentry.install | 10 | ||||
-rwxr-xr-x | src/kernel-install/kernel-install | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install index 7b768457c1..6a396910cb 100644 --- a/src/kernel-install/90-loaderentry.install +++ b/src/kernel-install/90-loaderentry.install @@ -83,27 +83,27 @@ if ! [ -d "$ENTRY_DIR_ABS" ]; then fi install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || { - echo "Could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2 + echo "Error: could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2 exit 1 } shift "$INITRD_OPTIONS_SHIFT" for initrd; do [ -f "$initrd" ] || { - echo "Initrd '$initrd' not a file." >&2 + echo "Error: initrd '$initrd' not a file." >&2 exit 1 } initrd_basename="${initrd##*/}" [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $ENTRY_DIR_ABS/$initrd_basename" install -g root -o root -m 0644 "$initrd" "$ENTRY_DIR_ABS/$initrd_basename" || { - echo "Could not copy '$initrd' to '$ENTRY_DIR_ABS/$initrd_basename'." >&2 + echo "Error: could not copy '$initrd' to '$ENTRY_DIR_ABS/$initrd_basename'." >&2 exit 1 } done mkdir -p "${LOADER_ENTRY%/*}" || { - echo "Could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2 + echo "Error: could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2 exit 1 } @@ -121,7 +121,7 @@ mkdir -p "${LOADER_ENTRY%/*}" || { [ $# -eq 0 ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd $ENTRY_DIR/initrd" : } >"$LOADER_ENTRY" || { - echo "Could not create loader entry '$LOADER_ENTRY'." >&2 + echo "Error: could not create loader entry '$LOADER_ENTRY'." >&2 exit 1 } exit 0 diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install index fe457c1070..a73a205d79 100755 --- a/src/kernel-install/kernel-install +++ b/src/kernel-install/kernel-install @@ -73,7 +73,7 @@ else fi if [ $# -lt 1 ]; then - echo "Not enough arguments" >&2 + echo "Error: not enough arguments" >&2 exit 1 fi @@ -150,12 +150,12 @@ IFS=" case "$COMMAND" in add) if [ $# -lt 1 ]; then - echo "Command 'add' requires a kernel image" >&2 + echo "Error: command 'add' requires a kernel image" >&2 exit 1 fi if ! [ -f "$1" ]; then - echo "Kernel image argument $1 not a file" >&2 + echo "Error: kernel image argument $1 not a file" >&2 exit 1 fi @@ -165,9 +165,9 @@ case "$COMMAND" in # to serve as the indication to use or to not use the BLS if [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ]; then echo "+mkdir -v -p $ENTRY_DIR_ABS" - mkdir -v -p "$ENTRY_DIR_ABS" + mkdir -v -p "$ENTRY_DIR_ABS" || exit 1 else - mkdir -p "$ENTRY_DIR_ABS" + mkdir -p "$ENTRY_DIR_ABS" || exit 1 fi fi @@ -196,7 +196,7 @@ case "$COMMAND" in ;; *) - echo "Unknown command '$COMMAND'" >&2 + echo "Error: unknown command '$COMMAND'" >&2 exit 1 ;; esac |