Merge remote-tracking branch 'grml'
[live-boot-grml.git] / components / 9990-misc-helpers.sh
index a97615b..39e609d 100755 (executable)
@@ -114,7 +114,7 @@ check_dev ()
                                ISO_DEVICE=$(dirname ${ISO_DEVICE})
                                [ -b "$ISO_DEVICE" ] && break
                                i=$(($i -1))
-                       done
+                       done
                fi
 
                if [ "$ISO_DEVICE" = "/" ]
@@ -1080,18 +1080,18 @@ find_persistence_media ()
                        result=$(probe_for_file_name "${overlays}" ${dev})
                        if [ -n "${result}" ]
                        then
-                               local loopdevice
+                               local loopdevice
                                loopdevice=${result##*=}
-                               if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && is_luks_partition ${loopdevice}
+                               if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && is_luks_partition ${loopdevice}
                                then
-                                       local luksfile
+                                       local luksfile
                                        luksfile=""
                                        if luksfile=$(open_luks_device "${loopdevice}")
                                        then
-                                               result=${result%%=*}
+                                               result=${result%%=*}
                                                result="${result}=${luksfile}"
                                        else
-                                               losetup -d $loopdevice
+                                               losetup -d $loopdevice
                                                result=""
                                        fi
                                fi
@@ -1310,15 +1310,14 @@ do_union ()
                        ;;
 
                overlay)
-                       # 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 overlay (unionro = ${unionro})."
-                       elif [ -z "${unionro}"  ]
+                       # XXX: can unionro be optional? i.e. can overlay skip lowerdir?
+                       if [ -z "${unionro}" ]
                        then
                                panic "overlay needs at least one lower filesystem (read-only branch)."
                        fi
+                       # Multiple lower layers can now be given using the the colon (":") as a
+                       # separator character between the directory names.
+                       unionro="$(echo ${unionro} | sed -e 's| |:|g')"
                        # overlayfs requires:
                        # + a workdir to become mounted
                        # + workdir and upperdir to reside under the same mount