Also execute steps and not only checks and flavours

This commit is contained in:
maride 2018-02-02 16:30:09 +01:00
parent b0f3d0de65
commit 6f3bdc8008

29
run.py
View File

@ -70,6 +70,34 @@ def checks(termsize, settings):
print("Uh. Found this non-check script in the 'checks' folder: '%s' (Not executing)" % (check)) 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): def flavours(termsize, settings):
for flavour in os.listdir("flavours/"): for flavour in os.listdir("flavours/"):
if flavour[-8:] == ".flavour": if flavour[-8:] == ".flavour":
@ -130,6 +158,7 @@ def main():
efibios(termsize, settings) efibios(termsize, settings)
blockdevice(termsize, settings) blockdevice(termsize, settings)
checks(termsize, settings) checks(termsize, settings)
steps(termsize, settings)
flavours(termsize, settings) flavours(termsize, settings)
finish(termsize, settings) finish(termsize, settings)