pmb/install: warn if the target disk is larger than expected (MR 1956)

This commit is contained in:
Martijn Braam 2020-07-07 13:16:48 +02:00 committed by Oliver Smith
parent 72e24f7f96
commit 5d540ad4fb
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 32 additions and 4 deletions

View file

@ -86,13 +86,15 @@ def ask(args, question="Continue?", choices=["y", "n"], default="n",
validation_regex + "). Please try again.")
def confirm(args, question="Continue?", default=False):
def confirm(args, question="Continue?", default=False, no_assumptions=False):
"""
Convenience wrapper around ask for simple yes-no questions with validation.
:param no_assumptions: ask for confirmation, even if "pmbootstrap -y' is set
:returns: True for "y", False for "n"
"""
default_str = "y" if default else "n"
if (args.assume_yes):
if args.assume_yes and not no_assumptions:
logging.info(question + " (y/n) [" + default_str + "]: y")
return True
answer = ask(args, question, ["y", "n"], default_str, True, "(y|n)")