Don't enforce choices for blockdevice question

This commit is contained in:
maride 2018-02-02 16:40:22 +01:00
parent 6f3bdc8008
commit 9cd968b4bd

6
run.py
View File

@ -39,7 +39,7 @@ def blockdevice(termsize, settings):
print("Please enter the full path to the block device the installation should take place on: (e.g. /dev/sda)") print("Please enter the full path to the block device the installation should take place on: (e.g. /dev/sda)")
print("Make sure to choose a drive, not a partition.") print("Make sure to choose a drive, not a partition.")
print("Here's a list of devices that may be the right:") print("Here's a list of devices that may be the right:")
settings["blockdevice"] = _ask("Install where?", os.listdir("/sys/block/")) settings["blockdevice"] = _ask("Install where?", os.listdir("/sys/block/"), enforce=False)
def checks(termsize, settings): def checks(termsize, settings):
@ -138,11 +138,11 @@ def _separator(termsize):
print("~" * termsize["cols"]) print("~" * termsize["cols"])
def _ask(question, choices): def _ask(question, choices, enforce=True):
while True: while True:
print("=> %s (%s) " % (question, ", ".join(choices))) print("=> %s (%s) " % (question, ", ".join(choices)))
answer = sys.stdin.readline()[:-1] answer = sys.stdin.readline()[:-1]
if answer in choices: if answer in choices or not enforce:
return answer return answer