signer: improve error handling in update_legacy_bootloader()
BRANCH=None
BUG=chromium:590933
TEST=Ran sign_official_build.sh locally and booted the image on kvm
(using BIOS).
$ ./sign_official_build.sh base chromiumos_base_image.bin \
../../tests/devkeys chromiumos_base_image_signed.bin
Change-Id: I2e1aad6e2073dea8e92d6ee25ac6972a5d555d71
Reviewed-on: https://chromium-review.googlesource.com/331661
Commit-Ready: Amey Deshpande <ameyd@google.com>
Tested-by: Amey Deshpande <ameyd@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/image_signing/sign_official_build.sh b/scripts/image_signing/sign_official_build.sh
index a3f7c98..83f31c6 100755
--- a/scripts/image_signing/sign_official_build.sh
+++ b/scripts/image_signing/sign_official_build.sh
@@ -714,7 +714,11 @@
local esp_dir="$(make_temp_dir)"
# We use the 'unsafe' variant because the EFI system partition is vfat type
# and can be mounted in RW mode.
- _mount_image_partition_retry "${image}" "${esp_partnum}" "${esp_dir}"
+ if ! _mount_image_partition_retry "${image}" "${esp_partnum}" \
+ "${esp_dir}"; then
+ error "Could not mount EFI partition for updating legacy bootloader cfg."
+ return 1
+ fi
# If we can't find the dm parameter in the kernel config, bail out now.
local kernel_config=$(grab_kernel_config "${image}" "${dm_partno}")