From: Tails developers Date: Mon, 26 Mar 2012 14:29:19 +0000 (+0200) Subject: Add 'bind' option for the default behaviour of custom mounts (bind-mount). X-Git-Tag: debian/3.0_a26-1~6 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;h=161e3e634a4f975f4d72fc2cfd715d9741fe9d16;hp=65dc1e4b2ba0d3e086308d4ad3104a1ce3a098cd;p=live-boot-grml.git Add 'bind' option for the default behaviour of custom mounts (bind-mount). --- diff --git a/manpages/en/live.persist.5 b/manpages/en/live.persist.5 index eff56da..68c2c81 100644 --- a/manpages/en/live.persist.5 +++ b/manpages/en/live.persist.5 @@ -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 diff --git a/scripts/live-helpers b/scripts/live-helpers index 5306cf5..d8bd613 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -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}"