debian-forge/stages/io.weldr.script
Tom Gundersen cdcfa1277e osbuild: make state handling generic
Rather than treating the dnf-cache specially, give each stage its
own state directory that they can reuse. This should obviously be
used with care by the stages in order to make the builds
reproducible.
2019-06-06 19:37:49 +02:00

24 lines
475 B
Python
Executable file

#!/usr/bin/python3
import atexit
import json
import os
import subprocess
import sys
def main(tree, state, 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))