scripts/COPY: create parent directories if they don't exist
This commit is contained in:
parent
e9fcd8939f
commit
37bbba582e
|
@ -9,6 +9,11 @@ def main():
|
||||||
chroot = os.environ["CHROOT"]
|
chroot = os.environ["CHROOT"]
|
||||||
target = sys.argv[-1]
|
target = sys.argv[-1]
|
||||||
chroot_target = os.path.join(chroot, target.lstrip("/"))
|
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]
|
command = ["cp"] + sys.argv[1:-1] + [chroot_target]
|
||||||
|
|
||||||
subprocess.check_call(command)
|
subprocess.check_call(command)
|
||||||
|
|
Loading…
Reference in New Issue