signer: improve error handling in update_legacy_bootloader()
authorAmey Deshpande <ameyd@google.com>
Tue, 8 Mar 2016 20:05:53 +0000 (12:05 -0800)
committerchrome-bot <chrome-bot@chromium.org>
Wed, 9 Mar 2016 03:43:11 +0000 (19:43 -0800)
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>
scripts/image_signing/sign_official_build.sh

index a3f7c98..83f31c6 100755 (executable)
@@ -714,7 +714,11 @@ update_legacy_bootloader() {
   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}")