From: Jan Blunck Date: Mon, 2 Sep 2013 15:27:41 +0000 (+0200) Subject: Remount writable when moving the mountpoint of the persistence device. X-Git-Tag: debian/4.0_a14-1~4 X-Git-Url: http://git.grml.org/?p=live-boot-grml.git;a=commitdiff_plain;h=e74c8d150c05d266f87bf15b330999b19acec269 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. --- 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.