From e74c8d150c05d266f87bf15b330999b19acec269 Mon Sep 17 00:00:00 2001 From: Jan Blunck Date: Mon, 2 Sep 2013 17:27:41 +0200 Subject: [PATCH] Remount writable when moving the mountpoint of the persistence device. If the persistence device has been mounted before, e.g. for mounting the rootfs image file, then we should try to remount it writable. This way the result for both cases, 1. was and 2. was not mounted before, are identical. --- components/9990-misc-helpers.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh index c502d59..4c8383d 100755 --- a/components/9990-misc-helpers.sh +++ b/components/9990-misc-helpers.sh @@ -722,15 +722,24 @@ mount_persistence_media () fi elif [ "${backing}" != "${old_backing}" ] then - if mount --move ${old_backing} ${backing} >/dev/null + if ! mount --move ${old_backing} ${backing} >/dev/null then - echo ${backing} - return 0 - else [ -z "${probe}" ] && log_warning_msg "Failed to move persistence media ${device}" rmdir "${backing}" return 1 fi + mount_opts="rw,noatime" + if [ -n "${PERSISTENCE_READONLY}" ] + then + mount_opts="ro,noatime" + fi + if ! mount -o "remount,${mount_opts}" "${backing}" >/dev/null + then + log_warning_msg "Failed to remount persistence media ${device} writable" + # Don't unmount or rmdir the new mountpoint in this case + fi + echo ${backing} + return 0 else # This means that $device has already been mounted on # the place expected by live-boot, so we're done. -- 2.1.4