Patch by Steven Shiau <steven@nchc.org.tw>. The only changes so far are:
[live-boot-grml.git] / components / 9990-misc-helpers.sh
index fb139ec..315e3b1 100755 (executable)
@@ -1292,23 +1292,8 @@ do_union ()
                        rw_opt="rw"
                        ro_opt="rr+wh"
                        noxino_opt="noxino"
-                       ;;
-
-               unionfs-fuse)
-                       rw_opt="RW"
-                       ro_opt="RO"
-                       ;;
 
-               *)
-                       rw_opt="rw"
-                       ro_opt="ro"
-                       ;;
-       esac
-
-       case "${UNIONTYPE}" in
-               unionfs-fuse)
-                       unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid"
-                       unionmountopts="${unionmountopts} ${unionrw}=${rw_opt}"
+                       unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}"
                        if [ -n "${unionro}" ]
                        then
                                for rofs in ${unionro}
@@ -1316,36 +1301,36 @@ do_union ()
                                        unionmountopts="${unionmountopts}:${rofs}=${ro_opt}"
                                done
                        fi
-                       ( 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 )
+                       mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
                        ;;
 
-               overlayfs)
-                       # XXX: can multiple unionro be used? (overlayfs only handles two dirs, but perhaps they can be chained?)
-                       # XXX: and can unionro be optional? i.e. can overlayfs skip lowerdir?
+               overlay)
+                       rw_opt="rw"
+                       ro_opt="ro"
+
+                       # XXX: can multiple unionro be used? (overlay only handles two dirs, but perhaps they can be chained?)
+                       # XXX: and can unionro be optional? i.e. can overlay skip lowerdir?
                        if echo ${unionro} | grep -q " "
                        then
-                               panic "Multiple lower filesystems are currently not supported with overlayfs (unionro = ${unionro})."
+                               panic "Multiple lower filesystems are currently not supported with overlay (unionro = ${unionro})."
                        elif [ -z "${unionro}"  ]
                        then
-                               panic "Overlayfs needs at least one lower filesystem (read-only branch)."
+                               panic "overlay needs at least one lower filesystem (read-only branch)."
                        fi
                        unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}"
-                       mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
-                       ;;
-
-               *)
-                       unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}"
-                       if [ -n "${unionro}" ]
+                       if ! mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" 2>/dev/null
                        then
-                               for rofs in ${unionro}
-                               do
-                                       unionmountopts="${unionmountopts}:${rofs}=${ro_opt}"
-                               done
+                               # Ref: kiwi from OpenSuse kiwi-7.02.18-1.1
+                               # overlayfs in version >= v22 behaves differently
+                               # + renamed from overlayfs to overlay
+                               # + requires a workdir to become mounted
+                               # + requires workdir and upperdir to reside under the same mount
+                               # + requires workdir and upperdir to be in separate subdirs
+                               mkdir ${unionrw}/rw
+                               mkdir ${unionrw}/work
+                               unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}/rw,workdir=${unionrw}/work"
+                               mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
                        fi
-                       mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
                        ;;
        esac
 }