dst_path = "%s/rootfs/%s" % (dest_path, src_path)
overlay_dirs += [(src_path, dst_path)]
+# do we have the new overlay fs which requires workdir, or the older
+# overlayfs which does not?
+have_new_overlay = False
+with open("/proc/filesystems", "r") as fd:
+ for line in fd:
+ if line == "nodev\toverlay\n":
+ have_new_overlay = True
+
# Generate pre-mount script
with open(os.path.join(dest_path, "pre-mount"), "w+") as fd:
os.fchmod(fd.fileno(), 0o755)
count = 0
for entry in overlay_dirs:
target = "%s/delta%s" % (dest_path, count)
+ workdir = "%s/work%s" % (dest_path, count)
fd.write("mkdir -p %s %s\n" % (target, entry[1]))
+ if have_new_overlay:
+ fd.write("mkdir -p %s\n" % workdir)
if args.storage_type == "tmpfs":
fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (target))
+ if have_new_overlay:
+ fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (workdir))
fd.write("getfacl -a %s | setfacl --set-file=- %s || true\n" % (entry[0], target))
fd.write("getfacl -a %s | setfacl --set-file=- %s || true\n" % (entry[0], entry[1]))
+ if have_new_overlay:
+ fd.write("getfacl -a %s | setfacl --set-file=- %s || true\n" % (entry[0], workdir))
if args.union_type == "overlayfs":
- fd.write("mount -n -t overlayfs"
+ if have_new_overlay:
+ fd.write("mount -n -t overlay"
+ " -oupperdir=%s,lowerdir=%s,workdir=%s none %s\n" % (
+ target,
+ entry[0],
+ workdir,
+ entry[1]))
+ else:
+ fd.write("mount -n -t overlayfs"
" -oupperdir=%s,lowerdir=%s none %s\n" % (
target,
entry[0],