build_image: fall back to ro-mount automatically

A rootfs built with verification cannot be mounted rw, so have the
mount script try to mount things ro if the rw mount failed.

BUG=None
TEST=`./build_image && ./mount.sh` work

Change-Id: I291ece366e03e218b3cd9ff8f30bd9a6e9cf879d
Reviewed-on: https://gerrit.chromium.org/gerrit/35065
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-10-07 12:14:28 -04:00 committed by Gerrit
parent d6b6cf6751
commit ff73cef8a6

View File

@ -158,8 +158,12 @@ EOF
if [[ ${size} -gt 1 ]]; then
cat <<-EOF >>"${mount}"
mkdir -p ${dir}
sudo mount -o loop,offset=${start_b},sizelimit=${size_b} ${target} ${dir} || \
rmdir ${dir}
m=( sudo mount -o loop,offset=${start_b},sizelimit=${size_b} ${target} ${dir} )
if ! "\${m[@]}"; then
if ! "\${m[@]}" -o ro; then
rmdir ${dir}
fi
fi
EOF
cat <<-EOF >>"${umount}"
if [[ -d ${dir} ]]; then