diff options
| author | Tails developers <amnesia@boum.org> | 2012-02-08 16:26:39 +0100 |
|---|---|---|
| committer | Daniel Baumann <daniel@debian.org> | 2012-04-01 22:06:21 +0200 |
| commit | 13bb5656427cd5ad5475ceb48fe973c2f3b41f8c (patch) | |
| tree | 915fdc73c2951e4bf33f78075f2a7c913a772a1d /scripts/live-helpers | |
| parent | 56627dfef6afd7f94f0bd8d76122eefb0b115826 (diff) | |
| download | live-boot-13bb5656427cd5ad5475ceb48fe973c2f3b41f8c.tar.gz live-boot-13bb5656427cd5ad5475ceb48fe973c2f3b41f8c.zip | |
Refactor union mounting into its own function.
Diffstat (limited to 'scripts/live-helpers')
| -rw-r--r-- | scripts/live-helpers | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/live-helpers b/scripts/live-helpers index aacfe93..3ec1e7b 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -608,3 +608,53 @@ link_files () fi done } + +do_union () { + root_backing="${1}" + unionrw="${2}" + unionro="${3}" + unionmountpoint="${4}" + + if [ "${UNIONTYPE}" = "aufs" ] + then + rw_opt="rw" + ro_opt="rr+wh" + noxino_opt="noxino," + elif [ "${UNIONTYPE}" = "unionfs-fuse" ] + then + rw_opt="RW" + ro_opt="RO" + else + rw_opt="rw" + ro_opt="ro" + fi + + 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}" + ( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384 + unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \ + ( mkdir -p /run/sendsigs.omit.d + pidof unionfs-fuse >> /run/sendsigs.omit.d/unionfs-fuse || true ) + ;; + + overlayfs) + # FIXME: is PERSISTENT_READONLY possible? (overlayfs only handles two dirs, but perhaps they can be chained?) + unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}" + mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" + ;; + + *) + if [ -n "${PERSISTENT_READONLY}" ] + 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}" + fi + mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" + ;; + esac +} |
