Subject: Support union mounts with overlay, as in Linux 4.0
From: Felipe Sateler <ffsateler@debian.org>
Date: Sat, 23 May 2015 17:00:30 -0300

Bug: https://github.com/codelibre-net/schroot/issues/1 (defunct)
Signed-off-by: Felipe Sateler <ffsateler@debian.org>
Signed-off-by: Antonio Terceiro <terceiro@debian.org>

--- a/etc/setup.d/10mount
+++ b/etc/setup.d/10mount
@@ -122,6 +122,9 @@
             overlayfs)
                 CHROOT_UNION_MOUNT_OPTIONS="lowerdir=${CHROOT_UNION_UNDERLAY_DIRECTORY},upperdir=${CHROOT_UNION_OVERLAY_DIRECTORY}"
                 ;;
+            overlay)
+                mkdir -p ${CHROOT_UNION_OVERLAY_DIRECTORY}/upper ${CHROOT_UNION_OVERLAY_DIRECTORY}/work
+                CHROOT_UNION_MOUNT_OPTIONS="lowerdir=${CHROOT_UNION_UNDERLAY_DIRECTORY},upperdir=${CHROOT_UNION_OVERLAY_DIRECTORY}/upper,workdir=${CHROOT_UNION_OVERLAY_DIRECTORY}/work"
         esac
     fi
 
--- a/man/schroot.conf.5.man
+++ b/man/schroot.conf.5.man
@@ -447,8 +447,8 @@
 .TP
 \f[CBI]union\-type=\fP\f[CI]type\fP
 Set the union filesystem type.  Currently supported filesystems are
-\[oq]aufs\[cq], \[oq]overlayfs\[cq] and \[oq]unionfs\[cq].  The default is
-\[oq]none\[cq], which disables this feature.
+\[oq]aufs\[cq], \[oq]overlayfs\[cq], \[oq]overlay\[cq] (as of Linux 4.0+) and
+\[oq]unionfs\[cq].  The default is \[oq]none\[cq], which disables this feature.
 .TP
 \f[CBI]union\-mount\-options=\fP\f[CI]options\fP
 Union filesystem mount options (branch configuration), used for mounting the
--- a/sbuild/sbuild-chroot-facet-union.cc
+++ b/sbuild/sbuild-chroot-facet-union.cc
@@ -136,6 +136,7 @@
 chroot_facet_union::set_union_type (std::string const& type)
 {
   if (type == "aufs" ||
+      type == "overlay" ||
       type == "overlayfs" ||
       type == "unionfs" ||
       type == "none")
