From 05c039812689666d3386f39f211a3f5e11308239 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot <groot@kde.org>
Date: Tue, 8 Oct 2019 16:19:39 +0200
Subject: [PATCH] [unpackfs] Support multiple items better

 - it's ok if item one creates directories where item two will write,
   so don't check for existence of all directories on start-up.

Reported by ArcoLinux.
---
 src/modules/unpackfs/main.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py
index b6cdd76a0..0c511b959 100644
--- a/src/modules/unpackfs/main.py
+++ b/src/modules/unpackfs/main.py
@@ -378,6 +378,7 @@ def run():
 
     unpack = list()
 
+    is_first = True
     for entry in job.configuration["unpack"]:
         source = os.path.abspath(entry["source"])
         sourcefs = entry["sourcefs"]
@@ -385,10 +386,14 @@ def run():
 
         if not os.path.isdir(destination):
             utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination))
-            return (_("Bad unsquash configuration"),
-                    _("The destination \"{}\" in the target system is not a directory").format(destination))
+            if is_first:
+                return (_("Bad unsquash configuration"),
+                        _("The destination \"{}\" in the target system is not a directory").format(destination))
+            else:
+                utils.debug(".. assuming that the previous targets will create that directory.")
 
         unpack.append(UnpackEntry(source, sourcefs, destination))
+        is_first = False
 
     unpackop = UnpackOperation(unpack)