image_signing: ensure_no_password.sh: support mounted rootfs dirs

BRANCH=None
BUG=chromium:714598
TEST=signing images still works

Change-Id: Icc848e49b35aa29c1a1206fa9f351be6ec252b13
Reviewed-on: https://chromium-review.googlesource.com/852675
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
This commit is contained in:
Mike Frysinger
2017-05-07 01:36:46 -04:00
committed by chrome-bot
parent 1a5e02c7a9
commit 46b7e0dae4

View File

@@ -10,15 +10,24 @@ set -e
# Load common constants and variables.
. "$(dirname "$0")/common.sh"
if [ $# -ne 1 ]; then
main() {
if [[ $# -ne 1 ]]; then
echo "Usage $0 <image>"
exit 1
fi
fi
IMAGE=$1
ROOTFS=$(make_temp_dir)
mount_image_partition_ro "$IMAGE" 3 "$ROOTFS"
local image="$1"
if ! no_chronos_password $ROOTFS; then
local rootfs
if [[ -d "${image}" ]]; then
rootfs="${image}"
else
rootfs=$(make_temp_dir)
mount_image_partition_ro "${image}" 3 "${rootfs}"
fi
if ! no_chronos_password "${rootfs}"; then
die "chronos password is set! Shouldn't be for release builds."
fi
fi
}
main "$@"