We want to copy the contents of a directory to another, the correct syntax for that is `cp -a src/. dst`. I was not aware of this beauty, so the previous patch simulated the functionality in python code. Signed-off-by: Tom Gundersen <teg@jklm.no>
16 lines
376 B
Python
Executable file
16 lines
376 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
def main(tree, input_dir, options):
|
|
input_tree = os.path.join(input_dir, options["tree"])
|
|
|
|
subprocess.run(["cp", "-a", f"{input_tree}/.", tree], check=True)
|
|
|
|
if __name__ == '__main__':
|
|
args = json.load(sys.stdin)
|
|
r = main(args["tree"], args["input_dir"], args["options"])
|
|
sys.exit(r)
|