summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-05-24 07:45:07 +0100
committerLeah Rowe <leah@libreboot.org>2023-05-24 07:45:07 +0100
commit2be1a8ea76cc33be4ec359155d2276046f1007a6 (patch)
tree45f39773d5d9521ed806bcd2fd37c8602c976830 /resources
parentd0171eeff33106d03b8314c18207b3a7673fbecf (diff)
download/coreboot: fix error handling in subshell
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'resources')
-rwxr-xr-xresources/scripts/download/coreboot19
1 files changed, 14 insertions, 5 deletions
diff --git a/resources/scripts/download/coreboot b/resources/scripts/download/coreboot
index 72597c57..2e78636b 100755
--- a/resources/scripts/download/coreboot
+++ b/resources/scripts/download/coreboot
@@ -149,16 +149,19 @@ prepare_new_coreboot_tree()
cp -R coreboot/coreboot "coreboot/${cbtree}" || exit 1
(
- cd "coreboot/${cbtree}" || exit 1
- git reset --hard ${cbrevision} || exit 1
- git submodule update --init --checkout || exit 1
+ cd "coreboot/${cbtree}" \
+ || err "cannot cd to coreboot/${cbtree}"
+ git reset --hard ${cbrevision} \
+ || err "cannot reset coreboot revision for tree, ${cbtree}"
+ git submodule update --init --checkout \
+ || err "cannot update coreboot submodules for tree, ${cbtree}"
for patch in ../../"${cbcfgsdir}"/"${cbtree}"/patches/*.patch; do
[ ! -f "${patch}" ] && \
continue
if ! git am "${patch}"; then
git am --abort
- exit 1
+ err "cannot patch ${cbtree}"
fi
done
@@ -166,9 +169,15 @@ prepare_new_coreboot_tree()
# but should *only* be a last resort
if [ -f "../../${cbcfgsdir}/${cbtree}/extra.sh" ]; then
"../../${cbcfgsdir}/${cbtree}/extra.sh" || \
- exit 1
+ err "${cbtree} extra.sh"
fi
)
}
+err()
+{
+ printf "ERROR: %s: %s\n" $0 $1 1>&2
+ exit 1
+}
+
main $@