From b3120441722365e74200d14644b5ebbb597cf372 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 16 Jan 2014 23:16:18 -0800 Subject: [PATCH] fix(build_image): Set read-only hack on correct filesystem. Check if the disk layout is a /usr layout and if so hack the USR-A partition, not whatever is mounted to /. Also use the new functionality in disk_util for this as it can look up partitions by label. --- build_library/prod_image_util.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/build_library/prod_image_util.sh b/build_library/prod_image_util.sh index 7bf2929107..50e6a80354 100755 --- a/build_library/prod_image_util.sh +++ b/build_library/prod_image_util.sh @@ -33,15 +33,16 @@ setup_prod_image() { sudo chown root:root "$key_location/update-payload-key.pub.pem" sudo chmod 644 "$key_location/update-payload-key.pub.pem" - # Make the filesystem un-mountable as read-write. - if [ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]; then - warn "Disabling r/w mount of the root filesystem" - sudo mount -o remount,ro "${root_fs_dir}" - root_dev=$(awk -v mnt="${root_fs_dir}" \ - '$2 == mnt { print $1 }' /proc/mounts) - disable_rw_mount "$root_dev" - fi - cleanup_mounts "${root_fs_dir}" trap - EXIT + + # Make the filesystem un-mountable as read-write. + if [ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]; then + local ro_label="ROOT-A" + if [[ "${disk_layout}" == *-usr ]]; then + ro_label="USR-A" + fi + "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \ + tune --disable2fs_rw "${BUILD_DIR}/${image_name}" "${ro_label}" + fi }