@@ -12,10 +12,8 @@ def panic(errorCode):
1212# Define the path to the setup.py script in the setup directory
1313setup_script_path = os .path .join (os .getcwd (), 'setup' , 'setup.py' )
1414
15- # Check if the required files exist
16- if not os .path .isfile ("username.txt" ) or not os .path .isfile ("password.txt" ):
17- print ("Username or password file is missing. Running setup..." )
18-
15+ # Function to run the setup script
16+ def run_setup ():
1917 if os .path .isfile (setup_script_path ):
2018 try :
2119 subprocess .run ([sys .executable , setup_script_path ], check = True )
@@ -29,6 +27,11 @@ def panic(errorCode):
2927 print ("Setup script not found. Please ensure 'setup.py' is in the 'setup' directory." )
3028 sys .exit ()
3129
30+ # Check if the required files exist
31+ if not os .path .isfile ("username.txt" ) or not os .path .isfile ("password.txt" ):
32+ print ("Username or password file is missing. Running setup..." )
33+ run_setup ()
34+
3235# After setup, check again for username and password
3336with open ("username.txt" , "r" ) as user_file :
3437 stored_username = user_file .read ().strip ()
@@ -49,10 +52,10 @@ def panic(errorCode):
4952 else :
5053 retry = input ("Incorrect password. Would you like to try again? (yes/no): " ).strip ().lower ()
5154 if retry != "yes" :
52- print ("Exiting. Please run the setup if you need to reset your password." )
53- sys . exit ()
55+ print ("You can run the setup command to reset your username and password." )
56+ break
5457else :
55- print ("Please run the setup to create a username and password." )
58+ print ("Please run the setup command to create a username and password." )
5659 sys .exit ()
5760
5861# Continue with the SkyOS boot process
@@ -83,6 +86,7 @@ def panic(errorCode):
8386 print ("shell - run a shell command" )
8487 print ("applescript - Run AppleScript code (needs a Mac)" )
8588 print ("bios - run the bios" )
89+ print ("setup - run the setup script to reset your username and password" )
8690
8791 elif command == "info" :
8892 print ("Developed by the SCA. All rights reserved." )
@@ -163,6 +167,9 @@ def panic(errorCode):
163167 panicErrorCode = "MISSING_BIOS"
164168 break
165169
170+ elif command == "setup" :
171+ run_setup ()
172+
166173 else :
167174 print (command + " is not a valid command. Type 'help' for a list of commands." )
168175
0 commit comments