summaryrefslogtreecommitdiff
path: root/scripts/image_signing/tag_image.sh
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2021-05-28 03:55:09 -0400
committerCommit Bot <commit-bot@chromium.org>2021-06-05 09:08:22 +0000
commite1b08d4312a514b2d29ae0db51a699c1a1d96fba (patch)
tree270c78ac6300619f69954a70096c925f8c7cf8e7 /scripts/image_signing/tag_image.sh
parent2eed98d9763552563e2320f372dc7e790729518b (diff)
downloadvboot-e1b08d4312a514b2d29ae0db51a699c1a1d96fba.tar.gz
image_signing: support mounted rootfs in more scripts
Update these scripts to accept a rootfs dir as input so we don't have to loopback+mount+umount with every invocation. This speeds up the overall runs. BUG=None TEST=scripts still work against image & rootfs dirs BRANCH=None Change-Id: I23050faebefd0a19e8ad44cdb76d7cc49c28e570 Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2923827 Reviewed-by: George Engelbrecht <engeg@google.com>
Diffstat (limited to 'scripts/image_signing/tag_image.sh')
-rwxr-xr-xscripts/image_signing/tag_image.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/image_signing/tag_image.sh b/scripts/image_signing/tag_image.sh
index 8a010121..fb9492e7 100755
--- a/scripts/image_signing/tag_image.sh
+++ b/scripts/image_signing/tag_image.sh
@@ -196,9 +196,13 @@ if [[ -z "${IMAGE}" || ! -f "${IMAGE}" ]]; then
fi
# First round, mount as read-only and check if we need any modifications.
-loopdev=$(loopback_partscan "${IMAGE}")
-rootfs=$(make_temp_dir)
-mount_loop_image_partition_ro "${loopdev}" 3 "${rootfs}"
+if [[ -d "${IMAGE}" ]]; then
+ rootfs="${IMAGE}"
+else
+ loopdev=$(loopback_partscan "${IMAGE}")
+ rootfs=$(make_temp_dir)
+ mount_loop_image_partition_ro "${loopdev}" 3 "${rootfs}"
+fi
# we don't have tags in stateful partition yet...
# stateful_dir=$(make_temp_dir)
@@ -210,8 +214,10 @@ process_all_lsb_mods "${rootfs}" ${FLAGS_FALSE}
if [ ${g_modified} = ${FLAGS_TRUE} ]; then
# Remount as RW. We can't use `mount -o rw,remount` because of the bits in
# the ext4 header we've set to block that. See enable_rw_mount for details.
- sudo umount "${rootfs}"
- mount_loop_image_partition "${loopdev}" 3 "${rootfs}"
+ if [[ ! -d "${IMAGE}" ]]; then
+ sudo umount "${rootfs}"
+ mount_loop_image_partition "${loopdev}" 3 "${rootfs}"
+ fi
# second round, apply the modification to image.
process_all_tags "${rootfs}" ${FLAGS_TRUE}