debian-forge/stages/io.weldr.script
Lars Karlitski 01aa00837f osbuild: drop state
Stages should be as stateless as possible. Don't provide an easy way out
of that.

Only the dnf stage used stage to save the dnf cache. That's only useful
during development and can be solved by pointing to a local repo mirror.
2019-06-12 15:23:45 +02:00

24 lines
468 B
Python
Executable file

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