Merge pull request #15 from makermelissa/main
Update with buster and allow arguments for prompt_reboot
This commit is contained in:
commit
c6581122fa
1 changed files with 5 additions and 5 deletions
|
|
@ -145,13 +145,13 @@ class Shell:
|
|||
colorize = getattr(colored, color)
|
||||
print(colorize(message))
|
||||
|
||||
def prompt(self, message, *, default=None, force_arg=None):
|
||||
def prompt(self, message, *, default=None, force_arg=None, force_arg_value=True):
|
||||
"""
|
||||
A Yes/No prompt that accepts optional defaults
|
||||
Returns True for Yes and False for No
|
||||
"""
|
||||
if force_arg is not None and self.argument_exists(force_arg):
|
||||
return True
|
||||
return force_arg_value
|
||||
if default is None:
|
||||
choicebox = "[y/n]"
|
||||
else:
|
||||
|
|
@ -491,7 +491,7 @@ class Shell:
|
|||
"""Return a string containing the raspbian version"""
|
||||
if self.get_os() != "Raspbian":
|
||||
return None
|
||||
raspbian_releases = ("buster", "stretch", "jessie", "wheezy")
|
||||
raspbian_releases = ("bullseye", "buster", "stretch", "jessie", "wheezy")
|
||||
if os.path.exists("/etc/os-release"):
|
||||
with open("/etc/os-release", encoding="utf-8") as f:
|
||||
release_file = f.read()
|
||||
|
|
@ -502,9 +502,9 @@ class Shell:
|
|||
return raspbian
|
||||
return None
|
||||
|
||||
def prompt_reboot(self):
|
||||
def prompt_reboot(self, default="y", **kwargs):
|
||||
"""Prompt the user for a reboot"""
|
||||
if not self.prompt("REBOOT NOW?", default="y"):
|
||||
if not self.prompt("REBOOT NOW?", default=default, **kwargs):
|
||||
print("Exiting without reboot.")
|
||||
else:
|
||||
print("Reboot started...")
|
||||
|
|
|
|||
Loading…
Reference in a new issue