[SCM] live-boot branch, debian-next, updated. debian/3.0_a25-1-21-gbae59cf
Daniel Baumann
daniel at debian.org
Sun Apr 1 20:08:03 UTC 2012
The following commit has been merged in the debian-next branch:
commit bae59cfc3b4e5272cb460b8918ad32a0faee4b60
Author: Tails developers <amnesia at boum.org>
Date: Thu Feb 9 12:16:06 2012 +0100
Make union mounting more sensible and robust.
...except that they're broken! But we're getting to that.
diff --git a/scripts/live b/scripts/live
index 08d6d74..d774284 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1485,7 +1485,8 @@ setup_unionfs ()
then
if [ -n "${PERSISTENT_READONLY}" ]
then
- root_backing="/${rootmnt}/live/persistent/$(basename ${cowdevice})-root"
+ mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/cow"
+ root_backing="${rootmnt}/live/persistent/$(basename ${cowdevice})-root"
mkdir -p ${root_backing}
else
root_backing="/cow"
@@ -1505,6 +1506,7 @@ setup_unionfs ()
rofscount=$(echo ${rofslist} |wc -w)
+ # XXX: we now ensure that there can only be one read-only filesystem. Should this be inside the EXPOSED_ROOT if?
if [ ${rofscount} -ne 1 ]
then
panic "only one RO file system supported with exposedroot: ${rofslist}"
@@ -1532,21 +1534,25 @@ setup_unionfs ()
#panic "unionmount does not support subunions (${cow_dirs})."
fi
- unionmountopts=""
- unionmountpoint=""
-
for dir in ${cow_dirs}; do
- unionrw="/cow${dir}"
- unionro="${rofs}${dir}"
unionmountpoint="${rootmnt}${dir}"
- mkdir -p ${unionrw}
+ mkdir -p ${unionmountpoint}
if [ "${UNIONTYPE}" = "unionmount" ]
then
# FIXME: handle PERSISTENT_READONLY
unionmountopts="-t ${cow_fstype} -o noatime,union,${cow_mountopt} ${cowdevice}"
mount_full $unionmountopts "${unionmountpoint}"
else
- do_union ${root_backing} ${unionrw} ${unionro} ${unionmountpoint}
+ cow_dir="/cow${dir}"
+ rofs_dir="${rofs}${dir}"
+ mkdir -p ${cow_dir}
+ if [ -n "${PERSISTENT_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
+ then
+ #mount -t tmpfs -o rw,noatime,mode=755 tmpfs "${cow_dir}"
+ do_union ${unionmountpoint} ${cow_dir} ${root_backing} ${rofs_dir}
+ else
+ do_union ${unionmountpoint} ${cow_dir} ${rofs_dir}
+ fi
fi || panic "mount ${UNIONTYPE} on ${unionmountpoint} failed with option ${unionmountopts}"
done
@@ -1743,10 +1749,10 @@ setup_unionfs ()
dest="$(mktemp -d ${persistent_backing}/links_source-XXXXXX)"
links_source="${dest}"
fi
- unionrw="$(echo ${dest} | sed -e "s|${rootmnt}|/cow/|")"
- mkdir -p ${unionrw}
- unionmountopts="noatime,${noxino_opt}dirs=${unionrw}=rw:${source}=${roopt}"
- do_union ${root_backing} ${unionrw} ${source} ${dest}
+ cow_dir="$(echo ${dest} | sed -e "s|${rootmnt}|/cow/|")"
+ mkdir -p ${cow_dir}
+ # XXX: broken! will be fixed in the next few commits...
+ do_union ${dest} ${cow_dir} ${source}
fi
if [ -n "${opt_linkfiles}" ]
diff --git a/scripts/live-helpers b/scripts/live-helpers
index 3de16e5..e7fef47 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -607,16 +607,16 @@ link_files ()
}
do_union () {
- root_backing="${1}"
- unionrw="${2}"
- unionro="${3}"
- unionmountpoint="${4}"
+ local unionmountpoint="${1}" # directory where the union is mounted
+ local unionrw="${2}" # branch where the union changes are stored
+ local unionro1="${3}" # first underlying read-only branch (optional)
+ local unionro2="${4}" # second underlying read-only branch (optional)
if [ "${UNIONTYPE}" = "aufs" ]
then
rw_opt="rw"
ro_opt="rr+wh"
- noxino_opt="noxino,"
+ noxino_opt="noxino"
elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
then
rw_opt="RW"
@@ -628,9 +628,16 @@ do_union () {
case "${UNIONTYPE}" in
unionfs-fuse)
- # FIXME: handle PERSISTENT_READONLY
unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid"
- unionmountopts="${unionmountopts} ${unionrw}=${rw_opt}:${unionro}=${ro_opt}"
+ unionmountopts="${unionmountopts} ${unionrw}=${rw_opt}"
+ if [ -n "${unionro1}" ]
+ then
+ unionmountopts="${unionmountopts}:${unionro1}=${ro_opt}"
+ fi
+ if [ -n "${unionro2}" ]
+ then
+ unionmountopts="${unionmountopts}:${unionro2}=${ro_opt}"
+ fi
( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384
unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \
( mkdir -p /run/sendsigs.omit.d
@@ -638,18 +645,21 @@ do_union () {
;;
overlayfs)
- # FIXME: is PERSISTENT_READONLY possible? (overlayfs only handles two dirs, but perhaps they can be chained?)
- unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}"
+ # XXX: can unionro2 be used? (overlayfs only handles two dirs, but perhaps they can be chained?)
+ # XXX: and can unionro1 be optional? i.e. can overlayfs skip lowerdir?
+ unionmountopts="-o noatime,lowerdir=${unionro1},upperdir=${unionrw}"
mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
;;
*)
- if [ -n "${PERSISTENT_READONLY}" ]
+ unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}"
+ if [ -n "${unionro1}" ]
then
- mount -t tmpfs -o rw,noatime,mode=755 tmpfs "${unionrw}"
- unionmountopts="-o noatime,${noxino_opt}dirs=${unionrw}=${rw_opt}:${root_backing}=${ro_opt}:${unionro}=${ro_opt}"
- else
- unionmountopts="-o noatime,${noxino_opt}dirs=${unionrw}=${rw_opt}:${unionro}=${ro_opt}"
+ unionmountopts="${unionmountopts}:${unionro1}=${ro_opt}"
+ fi
+ if [ -n "${unionro2}" ]
+ then
+ unionmountopts="${unionmountopts}:${unionro2}=${ro_opt}"
fi
mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
;;
--
live-boot
More information about the debian-live-changes
mailing list