From 37bbba582e28359bc998a64f0b8d7eab7210ccc9 Mon Sep 17 00:00:00 2001 From: Albert Hopkins Date: Sat, 1 Dec 2018 16:00:33 -0800 Subject: [PATCH] scripts/COPY: create parent directories if they don't exist --- scripts/COPY | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/COPY b/scripts/COPY index d1536f0..a5cd2c9 100755 --- a/scripts/COPY +++ b/scripts/COPY @@ -9,6 +9,11 @@ def main(): chroot = os.environ["CHROOT"] target = sys.argv[-1] chroot_target = os.path.join(chroot, target.lstrip("/")) + chroot_target_dir = os.path.dirname(chroot_target) + + if not os.path.exists(chroot_target_dir): + os.makedirs(chroot_target_dir) + command = ["cp"] + sys.argv[1:-1] + [chroot_target] subprocess.check_call(command)