All stages must be able to handle an input_dir argument, as we now either pass it to all or none for agiven run. Simply set it to 'None' if it is not provided. Signed-off-by: Tom Gundersen <teg@jklm.no>
24 lines
479 B
Python
Executable file
24 lines
479 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import atexit
|
|
import json
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main(tree, input_dir, script):
|
|
scriptfile = f"{tree}/osbuild-script"
|
|
|
|
with open(scriptfile, "w") as f:
|
|
f.write(script)
|
|
|
|
os.chmod(scriptfile, 0o550)
|
|
atexit.register(lambda: os.unlink(scriptfile))
|
|
|
|
return subprocess.run(["chroot", tree, "/osbuild-script"]).returncode
|
|
|
|
|
|
if __name__ == '__main__':
|
|
options = json.load(sys.stdin)
|
|
sys.exit(main(**options))
|