misc: basic refactoring of #502

This commit is contained in:
Simone Margaritelli
2019-11-04 11:13:51 +01:00
parent 59019efad0
commit ba22b7d5d7
2 changed files with 16 additions and 25 deletions

View File

@ -108,18 +108,20 @@ def shutdown():
os.system("halt")
def reboot():
logging.warning("rebooting ...")
os.system("sync")
os.system("shutdown -r now")
def reboot(mode=None):
if mode is not None:
mode = mode.upper()
logging.warning("rebooting in %s mode ..." % mode)
else:
logging.warning("rebooting ...")
def reboot_into_auto():
logging.warning("rebooting into AUTO mode ...")
if view.ROOT:
view.ROOT.on_reboot()
# give it some time to refresh the ui
time.sleep(10)
os.system("touch /root/.pwnagotchi-auto")
if mode == 'AUTO':
os.system("touch /root/.pwnagotchi-auto")
os.system("sync")
os.system("shutdown -r now")