summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorChristian Rößler2015-09-07 12:57:09 +0200
committerChristian Rößler2015-09-07 12:57:09 +0200
commitf69b57c595a8c43d192bc6550babf105f942588d (patch)
treeaff89473f98893b441ecde11d2f19c3ea4bd1832 /remote
parent[chroot] WARNING: NEEDS BETTER TESTING! Adapted to new overlayfs mount syntax. (diff)
downloadtm-scripts-f69b57c595a8c43d192bc6550babf105f942588d.tar.gz
tm-scripts-f69b57c595a8c43d192bc6550babf105f942588d.tar.xz
tm-scripts-f69b57c595a8c43d192bc6550babf105f942588d.zip
[chroot] Script changes: better commentary
Diffstat (limited to 'remote')
-rw-r--r--remote/includes/chroot.inc13
1 files changed, 8 insertions, 5 deletions
diff --git a/remote/includes/chroot.inc b/remote/includes/chroot.inc
index 5461898f..eb5c59d7 100644
--- a/remote/includes/chroot.inc
+++ b/remote/includes/chroot.inc
@@ -65,14 +65,16 @@ chroot_prepare_mounts() {
[ "x$(mount | grep -E "^/ on ${CHROOT_BINDDIR}" | grep -v '\(.*ro.*\)')" != "x" ] \
&& perror "CHROOT_BINDDIR '${CHROOT_BINDDIR}' is not read-only! Aborting..."
- # safe, go on to make the overlay
+ # Note: The overlay fs mount syntax seems to be changed between Ubuntu 14.04.2 and 14.04.3 (Kernel 3.13 and 3.19). Instead of
+ # checking overlay-modinfo (which may fail if overlayfs is not incorporated as module) or kernel versions, we simply try to
+ # mount 'old school' first and then, if that fails, the new way to mount with workdir. See differences in mount syntax below.
pinfo "Now mounting overlayfs. Trying old mount syntax (up to Kernel 3.13) ..."
mount -t overlayfs overlayfs -o lowerdir="${CHROOT_BINDDIR}",upperdir="${CHROOT_UPPERDIR}" "${CHROOT_MOUNTDIR}" 2>/dev/null
if [ $? -ne 0 ]; then
- pinfo "Old mount syntax failed. Trying mount syntax (Kernel 3.19+) ..."
- # We have to use a overlayfs workdir which _must_ be on the same filesystem as CHROOT_UPPERDIR. So
+ pinfo "Old mount syntax failed. Trying new mount syntax (Kernel 3.19+) ..."
+ # We have to use a overlayfs workdir which _must_ be in the same filesystem as CHROOT_UPPERDIR. So
# we traverse to the directory below CHROOT_UPPERDIR and mkdir/mktemp a workdir there. In the possible
- # case that CHROOT_UPPERDIR is the root dir of a filesystem there's nothing we can do.
+ # case that CHROOT_UPPERDIR is the root dir of a filesystem there's nothing we can do but exit.
CHROOT_WORKDIR="$(mktemp -d $(dirname ${CHROOT_UPPERDIR})/workdirXXX)" \
|| perror "Could not mkdir overlayfs workdir $CHROOT_WORKDIR for new overlayfs mount syntax."
# Now we try to mount the overlayfs in the new fashion:
@@ -235,8 +237,9 @@ chroot_cleanup_mounts() {
pinfo "Nothing chroot-related is mounted - exiting."
fi
+ # In case of 'new' overlayfs mount - should perhaps be handled via flag...
if [ -d "${CHROOT_WORKDIR}" ]; then
- # Too much of a coward to rm -rf somewhere. Both directories have to be empty so we use rmdir.
+ # Too much of a coward to rm -rf somewhere. Both directories should be empty so we use rmdir.
rmdir "${CHROOT_WORKDIR}/work" && pinfo "rmdir-ed CHROOT_WORKDIR/work ${CHROOT_WORKDIR}/work needed for new overlayfs mount syntax." \
|| pinfo "Could not rmdir CHROOT_WORKDIR/work ${CHROOT_WORKDIR}/work - clean it by hand."
rmdir "${CHROOT_WORKDIR}" && pinfo "rmdir-ed CHROOT_WORKDIR ${CHROOT_WORKDIR} needed for new overlayfs mount syntax." \