summaryrefslogtreecommitdiff
path: root/scripts/image_signing/common_minimal.sh
diff options
context:
space:
mode:
authorEdward Hyunkoo Jee <edjee@google.com>2018-04-21 02:07:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-04-25 23:00:07 -0700
commit6c17ef7446373d7a474671a3bd2dd2a4cce58741 (patch)
tree03af440a485d7ceea565a95f8dbca3e8b9c8bd7b /scripts/image_signing/common_minimal.sh
parent112571461c4a484b784c1856206d5790dd7959c6 (diff)
downloadvboot-6c17ef7446373d7a474671a3bd2dd2a4cce58741.tar.gz
image_signing: clean up UEFI signing/verifying code
Follow up the code review comments on CL:995175, which was merged as 1493e938e45535f86b7132a83123c6319eacb217 ("image_signing: sign UEFI binaries") BUG=b:62189155 TEST=See CL:*613656 BRANCH=none Change-Id: Ic01bfbbfe39fbfb85c0f313ab62bbcd3e2fbb9a3 Reviewed-on: https://chromium-review.googlesource.com/1024919 Commit-Ready: Edward Jee <edjee@google.com> Tested-by: Edward Jee <edjee@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'scripts/image_signing/common_minimal.sh')
-rw-r--r--scripts/image_signing/common_minimal.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/image_signing/common_minimal.sh b/scripts/image_signing/common_minimal.sh
index d7ecc10e..3a0dccf9 100644
--- a/scripts/image_signing/common_minimal.sh
+++ b/scripts/image_signing/common_minimal.sh
@@ -254,9 +254,10 @@ mount_image_partition() {
# Mount the image's ESP (EFI System Partition) on a newly created temporary
# directory.
-# Prints out the newly created temporary directory path if succeeded, prints
-# out nothing if ESP doesn't exist, print out "MOUNT_FAILED" if mount failed.
-# Args: IMAGE ESP_PARTNUM
+# Prints out the newly created temporary directory path if succeeded.
+# If the image doens't have an ESP partition, returns 0 without print anything.
+# Args: IMAGE
+# Returns: 0 if succeeded, 1 otherwise.
mount_image_esp() {
local image="$1"
local ESP_PARTNUM=12
@@ -264,19 +265,19 @@ mount_image_esp() {
local esp_offset=$(( $(partoffset "${image}" "${ESP_PARTNUM}") ))
# Check if the image has an ESP partition.
if [[ "${esp_offset}" == "0" ]]; then
- return
+ return 0
fi
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.
- if ! $(_mount_image_partition_retry "${image}" "${ESP_PARTNUM}" \
- "${esp_dir}" > /dev/null); then
- echo "MOUNT_FAILED"
- return
+ if ! _mount_image_partition_retry "${image}" "${ESP_PARTNUM}" \
+ "${esp_dir}" >/dev/null; then
+ return 1
fi
echo "${esp_dir}"
+ return 0
}
# Extract a partition to a file