2018-10-27 20:04:00 +02:00
|
|
|
#!/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]
|
2018-10-27 20:15:59 +02:00
|
|
|
chroot_target = os.path.join(chroot, target.lstrip("/"))
|
2018-12-02 01:00:33 +01:00
|
|
|
chroot_target_dir = os.path.dirname(chroot_target)
|
|
|
|
|
|
|
|
if not os.path.exists(chroot_target_dir):
|
|
|
|
os.makedirs(chroot_target_dir)
|
|
|
|
|
2018-10-27 20:04:00 +02:00
|
|
|
command = ["cp"] + sys.argv[1:-1] + [chroot_target]
|
|
|
|
|
2018-12-02 20:53:35 +01:00
|
|
|
sys.exit(subprocess.call(command))
|
2018-10-27 20:04:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|