fix: execute after-stages commands as host

This commit is contained in:
Rudra Saraswat 2026-04-02 00:58:28 +01:00
parent 8f5e52db05
commit b53795bddb

View file

@ -1,5 +1,6 @@
import json import json
import os import os
import subprocess
from classes.rootfs import RootFS from classes.rootfs import RootFS
@ -34,7 +35,12 @@ def gen_rootfs(system_config: dict, rootfs_path: str) -> RootFS:
run_script_rootfs(rootfs, modules[stage["module"]], inputs) run_script_rootfs(rootfs, modules[stage["module"]], inputs)
if isinstance(system_config["distro-config"].get("after-stages"), str): if isinstance(system_config["distro-config"].get("after-stages"), str):
run_script_rootfs(rootfs, system_config["distro-config"]["after-stages"], []) subprocess.run(
["bash", "-s"],
text=True,
input=system_config["distro-config"]["after-stages"],
cwd=str(rootfs_path),
)
with open(os.path.join(rootfs_path, "usr/system.json"), "w") as system_json_file: with open(os.path.join(rootfs_path, "usr/system.json"), "w") as system_json_file:
json.dump(system_config, system_json_file, ensure_ascii=False) json.dump(system_config, system_json_file, ensure_ascii=False)