add mode parameter to agent._restart, and call agent._restart from USR1 handler instead of pwnagotchi.restart()

This commit is contained in:
Sniffleupagus
2024-09-08 19:25:09 +01:00
parent e5812e86c1
commit 32d244ec6f
2 changed files with 3 additions and 3 deletions

View File

@ -323,7 +323,7 @@ def pwnagotchi_cli():
def usr1_handler(*unused):
logging.info('Received USR1 singal. Restart process ...')
restart("MANU" if args.do_manual else "AUTO")
agent._restart("MANU" if args.do_manual else "AUTO")
signal.signal(signal.SIGUSR1, usr1_handler)

View File

@ -269,9 +269,9 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
self._save_recovery_data()
pwnagotchi.reboot()
def _restart(self):
def _restart(self, mode='AUTO'):
self._save_recovery_data()
pwnagotchi.restart("AUTO")
pwnagotchi.restart(mode)
def _save_recovery_data(self):
logging.warning("writing recovery data to %s ...", RECOVERY_DATA_FILE)