Remove cow dir contents that are in the way for custom mounts.
authorTails developers <amnesia@boum.org>
Thu, 22 Mar 2012 18:43:55 +0000 (19:43 +0100)
committerDaniel Baumann <daniel@debian.org>
Thu, 5 Apr 2012 05:50:24 +0000 (07:50 +0200)
This is mostly relevant if you activate persistence post boot; in that
case you (or live-config) may have modified or added some file, which
makes it appear in the cow dir. If you later activate a persistent
volume which contains that file, the old file will "block" the one
from the persistent volume, which likely isn't what you expect.

scripts/live-helpers

index db6d25c..0ab36b9 100644 (file)
@@ -1490,6 +1490,13 @@ activate_custom_mounts ()
                        else
                                cow_dir="/live/cow/${dest}"
                        fi
+                       if [ -e "${cow_dir}" ]
+                       then
+                               # If an earlier custom mount has files here
+                               # it will "block" the current mount's files
+                               # which is undesirable
+                               rm -rf "${cow_dir}"
+                       fi
                        mkdir -p ${cow_dir}
                        chown --reference "${source}" "${cow_dir}"
                        chmod --reference "${source}" "${cow_dir}"