|
|
594167 |
From 7e5ff353f8b35352f6c36233841754154b4f453b Mon Sep 17 00:00:00 2001
|
|
|
aa0848 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
aa0848 |
Date: Wed, 19 Jan 2022 12:15:16 +0100
|
|
|
aa0848 |
Subject: [PATCH] kernel-install: prefix errors with "Error:", exit immediately
|
|
|
aa0848 |
MIME-Version: 1.0
|
|
|
aa0848 |
Content-Type: text/plain; charset=UTF-8
|
|
|
aa0848 |
Content-Transfer-Encoding: 8bit
|
|
|
aa0848 |
|
|
|
aa0848 |
kernel-install would continue after errors… We don't want this, as it
|
|
|
aa0848 |
makes the results totally unpredicatable. If we didn't install the kernel
|
|
|
aa0848 |
or didn't do some important part of the setup, let's just return an error
|
|
|
aa0848 |
and let the user deal with it.
|
|
|
aa0848 |
|
|
|
aa0848 |
When looking at output, the error was often hard to distinguish, esp.
|
|
|
aa0848 |
with -v. Add "Error:" everywhere to make the output easier to parse.
|
|
|
aa0848 |
|
|
|
aa0848 |
(cherry picked from commit 680cec6b4ddb356d7dd087b197718712cb5c1662)
|
|
|
aa0848 |
|
|
|
aa0848 |
Related: #2065061
|
|
|
aa0848 |
---
|
|
|
aa0848 |
src/kernel-install/90-loaderentry.install | 10 +++++-----
|
|
|
aa0848 |
src/kernel-install/kernel-install | 12 ++++++------
|
|
|
aa0848 |
2 files changed, 11 insertions(+), 11 deletions(-)
|
|
|
aa0848 |
|
|
|
aa0848 |
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
|
|
|
aa0848 |
index 7b768457c1..6a396910cb 100644
|
|
|
aa0848 |
--- a/src/kernel-install/90-loaderentry.install
|
|
|
aa0848 |
+++ b/src/kernel-install/90-loaderentry.install
|
|
|
aa0848 |
@@ -83,27 +83,27 @@ if ! [ -d "$ENTRY_DIR_ABS" ]; then
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
|
|
|
aa0848 |
install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {
|
|
|
aa0848 |
- echo "Could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2
|
|
|
aa0848 |
+ echo "Error: could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
}
|
|
|
aa0848 |
|
|
|
aa0848 |
shift "$INITRD_OPTIONS_SHIFT"
|
|
|
aa0848 |
for initrd; do
|
|
|
aa0848 |
[ -f "$initrd" ] || {
|
|
|
aa0848 |
- echo "Initrd '$initrd' not a file." >&2
|
|
|
aa0848 |
+ echo "Error: initrd '$initrd' not a file." >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
}
|
|
|
aa0848 |
|
|
|
aa0848 |
initrd_basename="${initrd##*/}"
|
|
|
aa0848 |
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $ENTRY_DIR_ABS/$initrd_basename"
|
|
|
aa0848 |
install -g root -o root -m 0644 "$initrd" "$ENTRY_DIR_ABS/$initrd_basename" || {
|
|
|
aa0848 |
- echo "Could not copy '$initrd' to '$ENTRY_DIR_ABS/$initrd_basename'." >&2
|
|
|
aa0848 |
+ echo "Error: could not copy '$initrd' to '$ENTRY_DIR_ABS/$initrd_basename'." >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
}
|
|
|
aa0848 |
done
|
|
|
aa0848 |
|
|
|
aa0848 |
mkdir -p "${LOADER_ENTRY%/*}" || {
|
|
|
aa0848 |
- echo "Could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2
|
|
|
aa0848 |
+ echo "Error: could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
}
|
|
|
aa0848 |
|
|
|
aa0848 |
@@ -121,7 +121,7 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
|
|
|
aa0848 |
[ $# -eq 0 ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd $ENTRY_DIR/initrd"
|
|
|
aa0848 |
:
|
|
|
aa0848 |
} >"$LOADER_ENTRY" || {
|
|
|
aa0848 |
- echo "Could not create loader entry '$LOADER_ENTRY'." >&2
|
|
|
aa0848 |
+ echo "Error: could not create loader entry '$LOADER_ENTRY'." >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
}
|
|
|
aa0848 |
exit 0
|
|
|
aa0848 |
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
|
|
|
aa0848 |
index fe457c1070..a73a205d79 100755
|
|
|
aa0848 |
--- a/src/kernel-install/kernel-install
|
|
|
aa0848 |
+++ b/src/kernel-install/kernel-install
|
|
|
aa0848 |
@@ -73,7 +73,7 @@ else
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
|
|
|
aa0848 |
if [ $# -lt 1 ]; then
|
|
|
aa0848 |
- echo "Not enough arguments" >&2
|
|
|
aa0848 |
+ echo "Error: not enough arguments" >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
|
|
|
aa0848 |
@@ -150,12 +150,12 @@ IFS="
|
|
|
aa0848 |
case "$COMMAND" in
|
|
|
aa0848 |
add)
|
|
|
aa0848 |
if [ $# -lt 1 ]; then
|
|
|
aa0848 |
- echo "Command 'add' requires a kernel image" >&2
|
|
|
aa0848 |
+ echo "Error: command 'add' requires a kernel image" >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
|
|
|
aa0848 |
if ! [ -f "$1" ]; then
|
|
|
aa0848 |
- echo "Kernel image argument $1 not a file" >&2
|
|
|
aa0848 |
+ echo "Error: kernel image argument $1 not a file" >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
|
|
|
aa0848 |
@@ -165,9 +165,9 @@ case "$COMMAND" in
|
|
|
aa0848 |
# to serve as the indication to use or to not use the BLS
|
|
|
aa0848 |
if [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ]; then
|
|
|
aa0848 |
echo "+mkdir -v -p $ENTRY_DIR_ABS"
|
|
|
aa0848 |
- mkdir -v -p "$ENTRY_DIR_ABS"
|
|
|
aa0848 |
+ mkdir -v -p "$ENTRY_DIR_ABS" || exit 1
|
|
|
aa0848 |
else
|
|
|
aa0848 |
- mkdir -p "$ENTRY_DIR_ABS"
|
|
|
aa0848 |
+ mkdir -p "$ENTRY_DIR_ABS" || exit 1
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
fi
|
|
|
aa0848 |
|
|
|
aa0848 |
@@ -196,7 +196,7 @@ case "$COMMAND" in
|
|
|
aa0848 |
;;
|
|
|
aa0848 |
|
|
|
aa0848 |
*)
|
|
|
aa0848 |
- echo "Unknown command '$COMMAND'" >&2
|
|
|
aa0848 |
+ echo "Error: unknown command '$COMMAND'" >&2
|
|
|
aa0848 |
exit 1
|
|
|
aa0848 |
;;
|
|
|
aa0848 |
esac
|