From 6f3bdc8008d9ba4640deb50b992d211c06cc4957 Mon Sep 17 00:00:00 2001 From: maride Date: Fri, 2 Feb 2018 16:30:09 +0100 Subject: [PATCH] Also execute steps and not only checks and flavours --- run.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/run.py b/run.py index aa2fe0c..bb559dc 100755 --- a/run.py +++ b/run.py @@ -70,6 +70,34 @@ def checks(termsize, settings): print("Uh. Found this non-check script in the 'checks' folder: '%s' (Not executing)" % (check)) +def steps(termsize, settings): + for step in os.listdir("steps/"): + if step[-5:] == ".step": + # Run loop + run = True + while run: + _separator(termsize) + print("Running '%s'" % (step)) + with subprocess.Popen(["steps/%s" % step], env=settings) as process: + # Wait for process termination + process.wait() + if process.returncode > 0: + # Woops, step failed somehow + print("step %s returned non-null error code %i." % (step, process.returncode)) + answer = _ask("Do you want to re-run the step, skip the step or abort the installation?", [ "run", "skip", "abort"]) + if answer == "run": + # doesn't matter, run is already 'True' + continue + elif answer == "skip": + run = False + elif answer == "abort": + quit() + else: + run = False + else: + print("Uh. Found this non-step script in the 'steps' folder: '%s' (Not executing)" % (step)) + + def flavours(termsize, settings): for flavour in os.listdir("flavours/"): if flavour[-8:] == ".flavour": @@ -130,6 +158,7 @@ def main(): efibios(termsize, settings) blockdevice(termsize, settings) checks(termsize, settings) + steps(termsize, settings) flavours(termsize, settings) finish(termsize, settings)