37 lines
957 B
Python
Executable file
37 lines
957 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
RESET = "\033[0m"
|
|
BOLD = "\033[1m"
|
|
RED = "\033[31m"
|
|
|
|
|
|
def main(stage, sit):
|
|
subprocess.run(["ldconfig"], check=True)
|
|
subprocess.run(["systemd-sysusers"], check=True)
|
|
|
|
# Allow systemd-tmpfiles to return non-0. Some packages want to create
|
|
# directories owned by users that are not set up with systemd-sysusers.
|
|
subprocess.run(["systemd-tmpfiles", "--create"])
|
|
|
|
r = subprocess.run([stage])
|
|
if sit and r.returncode != 0:
|
|
import signal
|
|
print()
|
|
print(f"{RESET}{BOLD}{RED}Stage failed with code {r.returncode}{RESET}")
|
|
print("Keeping the build environment running...")
|
|
signal.pause()
|
|
|
|
return r.returncode
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("stage")
|
|
parser.add_argument("--sit", action="store_true")
|
|
args = parser.parse_args()
|
|
sys.exit(main(**vars(args)))
|