diff options
author | Jan Blunck <jblunck@vyatta.com> | 2013-09-02 17:27:41 +0200 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2013-09-13 14:15:52 +0200 |
commit | e74c8d150c05d266f87bf15b330999b19acec269 (patch) | |
tree | 0878b00d951edffc644600952ea9ffe2c4f5411d /components/9990-misc-helpers.sh | |
parent | 608d41f64972697b7389678d63d1391daa2fab42 (diff) | |
download | live-boot-e74c8d150c05d266f87bf15b330999b19acec269.tar.gz live-boot-e74c8d150c05d266f87bf15b330999b19acec269.zip |
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.
Diffstat (limited to 'components/9990-misc-helpers.sh')
-rwxr-xr-x | components/9990-misc-helpers.sh | 17 |
1 files 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. |