Add 'bind' option for the default behaviour of custom mounts (bind-mount).
authorTails developers <amnesia@boum.org>
Mon, 26 Mar 2012 14:29:19 +0000 (16:29 +0200)
committerDaniel Baumann <daniel@debian.org>
Thu, 5 Apr 2012 05:54:42 +0000 (07:54 +0200)
manpages/en/live.persist.5
scripts/live-helpers

index eff56da..68c2c81 100644 (file)
@@ -67,8 +67,10 @@ relevant if you want to nest custom mounts, which otherwise would
 cause errors, or if you want to make the whole media root available
 (similar to the now deprecated \fBhome-rw\fR type of persistence).
 .PP
-The following options will override the default bind-mount behaviour
-of custom mounts, and are mutually exclusive:
+The following options are mutually exclusive (only the last given one
+will be in effect):
+.IP "\fBbind\fR" 4
+Bind-mount the source directory to \fIDIR\fR. This is the default.
 .IP "\fBlinkfiles\fR" 4
 Create the directory structure of the source directory on the
 persistent media in \fIDIR\fR and create symbolic links from the
index 5306cf5..d8bd613 100644 (file)
@@ -1323,7 +1323,7 @@ get_custom_mounts ()
                                        linkfiles)
                                                opt_linkfiles="yes"
                                                ;;
-                                       union)
+                                       union|bind)
                                                ;;
                                        *)
                                                log_warning_msg "Skipping custom mount with unkown option: ${opt}"
@@ -1389,25 +1389,27 @@ activate_custom_mounts ()
 
        while read device source dest options # < ${custom_mounts}
        do
+               local opt_bind="yes"
                local opt_linkfiles=""
                local opt_union=""
                for opt in $(echo ${options} | tr ',' ' ');
                do
                        case "${opt}" in
+                               bind)
+                                       opt_bind="yes"
+                                       unset opt_linkfiles opt_union
+                                       ;;
                                linkfiles)
                                        opt_linkfiles="yes"
+                                       unset opt_bind opt_union
                                        ;;
                                union)
                                        opt_union="yes"
+                                       unset opt_bind opt_linkfiles
                                        ;;
                        esac
                done
 
-               if [ -n "${opt_linkfiles}" ] && [ -n "${opt_union}" ]
-               then
-                       log_warning_msg "Skipping custom mount ${dest} with options ${options}: \"linkfiles\" and \"union\" are mutually exclusive options"
-               fi
-
                if [ -n "$(what_is_mounted_on "${dest}")" ]
                then
                        log_warning_msg "Skipping custom mount ${dest}: $(what_is_mounted_on "${dest}") is already mounted there"
@@ -1455,7 +1457,8 @@ activate_custom_mounts ()
                                mkdir -p "${source}"
                                chown_ref "${dest}" "${source}"
                                chmod_ref "${dest}" "${source}"
-                       else
+                       elif [ -n "${opt_bind}" ]
+                       then
                                # ensure that $dest is not copied *into* $source
                                mkdir -p "$(dirname ${source})"
                                cp -a "${dest}" "${source}"