24 lines
524 B
Python
Executable File
24 lines
524 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Copy files from source to target in the chroot"""
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
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)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|