@@ -427,6 +427,8 @@ def getInfo(self) -> str:
427427
428428
429429def main ():
430+ script_mode = os .environ .get ('SCRIPT_MODE' , '' ).lower ()
431+
430432 if CheckNetworkConnection () == False :
431433 print ("Please connect to network and re-run the script" )
432434 input ("Press enter to exit : " )
@@ -441,6 +443,59 @@ def main():
441443 device_manager = DeviceManager ()
442444 installaion_manager = InstallationManager ()
443445 print (HELP_MSG )
446+
447+
448+ if script_mode :
449+ if script_mode == 'i' :
450+ devices = device_manager .getDevices ()
451+ if len (devices ) == 0 :
452+ continue
453+ installaion_manager .selectDevice (devices = devices )
454+ if installaion_manager .selectedDevice == None :
455+ continue
456+ installaion_manager .getAccount ()
457+ installaion_manager .getPassword ()
458+ installaion_manager .selectFile ()
459+ if installaion_manager .filePath == None :
460+ continue
461+ DebugPrint (installaion_manager .getInfo ())
462+ installaion_manager .run ()
463+
464+ elif script_mode == 'w' :
465+ if NETMUXD_IS_AVAILABLE :
466+ if not Netmuxd_is_on :
467+ netmuxd .switchWiFi ()
468+ altserverdaemon .restart ()
469+ else :
470+ print (f"Netmuxd is not support arch : { ARCH } " )
471+
472+ elif script_mode == 't' :
473+ if Netmuxd_is_on :
474+ netmuxd .switchTether ()
475+ altserverdaemon .restart ()
476+
477+ elif script_mode == 'e' :
478+ altserverdaemon .kill ()
479+ anisetteserver .kill ()
480+ if Netmuxd_is_on :
481+ netmuxd .kill ()
482+ break
483+
484+ elif script_mode == 'h' :
485+ print (HELP_MSG )
486+
487+ elif script_mode == 'p' :
488+ devices = device_manager .getDevices ()
489+ for d in devices :
490+ print (f"{ d .name } , { d .UDID } " )
491+
492+ elif script_mode == 'u' :
493+ Update ()
494+
495+ else :
496+ print ("Invalid option" )
497+ return
498+
444499 while True :
445500 option = getAnswer ("Enter OPTION to continue : " ).lower ()
446501
0 commit comments