summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-05-14 14:44:00 +0100
committerLeah Rowe <leah@libreboot.org>2023-05-14 14:44:00 +0100
commit557272fa39e10e8cf6154f723913ab5c494c6101 (patch)
tree6092f5ae4978ad8538b657e1bdfc01a6cf77feaf /resources
parent7b36ffc1e586664f06637b1a1bd07233d18ddb9e (diff)
download/mrc: stricter error handling
the cbfstool command within subshell now also exits with non-zero status, if it fails (most likely because extraction failed, for some reason, of the coreboot rom image for running through it)
Diffstat (limited to 'resources')
-rwxr-xr-xresources/scripts/download/mrc20
1 files changed, 12 insertions, 8 deletions
diff --git a/resources/scripts/download/mrc b/resources/scripts/download/mrc
index 63ec0100..ed0b38f3 100755
--- a/resources/scripts/download/mrc
+++ b/resources/scripts/download/mrc
@@ -51,8 +51,8 @@ main()
printf "Downloading Intel MRC blobs\n"
check_existing && exit 0
- build_dependencies
- fetch_mrc
+ build_dependencies || fail "could not build dependencies"
+ fetch_mrc || fail "could not fetch mrc.bin"
}
check_existing()
@@ -74,16 +74,17 @@ check_existing()
build_dependencies()
{
if [ ! -d "${cbdir}/" ]; then
- ./download coreboot default
+ ./download coreboot default || return 1
fi
if [ ! -f "${cbfstool}" ]; then
- ./build module cbutils default
+ ./build module cbutils default || return 1
fi
+ return 0
}
fetch_mrc()
{
- mkdir -p mrc/haswell/
+ mkdir -p mrc/haswell/ || return 1
(
cd mrc/haswell/
@@ -102,22 +103,25 @@ fetch_mrc()
extract_coreboot chromeos-firmwareupdate-${_board}
../../${cbfstool} coreboot-*.bin extract -f mrc.bin \
- -n mrc.bin -r RO_SECTION
+ -n mrc.bin -r RO_SECTION \
+ || fail "Could not fetch mrc.bin"
rm -f "chromeos-firmwareupdate-${_board}" coreboot-*.bin \
"${_file}" "root-a.ext2"
printf "\n\nmrc.bin saved to ${_mrc_complete}\n\n"
)
+
+ return 0
}
download_image()
{
- _url=${1}
+ url=${1}
_file=${2}
_sha1sum=${3}
echo "Downloading recovery image"
- curl "$_url" > "$_file.zip"
+ curl "$url" > "$_file.zip"
if [ "$(sha1sum ${_file}.zip | awk '{print $1}')" = "${_sha1sum}" ]
then
unzip -q "${_file}.zip"