|
| 1 | +import os |
| 2 | +import subprocess |
| 3 | +import sys |
| 4 | + |
1 | 5 | # Path to the kernel script in the KERNEL folder |
2 | 6 | kernel_script = os.path.join(os.getcwd(), 'KERNEL', 'kernel.py') |
3 | 7 |
|
4 | | -# setup.py |
| 8 | +# File paths for storing username and password |
| 9 | +username_file = "username.txt" |
| 10 | +password_file = "password.txt" |
| 11 | + |
| 12 | +# If files exist, delete them to allow setting up a new username and password |
| 13 | +if os.path.isfile(username_file): |
| 14 | + os.remove(username_file) |
| 15 | + print(f"{username_file} has been deleted.") |
| 16 | + |
| 17 | +if os.path.isfile(password_file): |
| 18 | + os.remove(password_file) |
| 19 | + print(f"{password_file} has been deleted.") |
5 | 20 |
|
6 | 21 | # Prompt the user for their username |
7 | 22 | username = input("Enter your username: ") |
|
10 | 25 | password = input("Enter your password: ") |
11 | 26 |
|
12 | 27 | # Create a file named 'username.txt' and write the username in it |
13 | | -with open("username.txt", "w") as user_file: |
| 28 | +with open(username_file, "w") as user_file: |
14 | 29 | user_file.write(username) |
15 | 30 |
|
16 | 31 | # Create a file named 'password.txt' and write the password in it |
17 | | -with open("password.txt", "w") as password_file: |
| 32 | +with open(password_file, "w") as password_file: |
18 | 33 | password_file.write(password) |
19 | 34 |
|
20 | | -print("setup finished! thank you for using SkyOS!") |
21 | | -print("going to the kernel file...") |
22 | | - |
| 35 | +print("Setup finished! Thank you for using SkyOS!") |
| 36 | +print("Going to the kernel file...") |
| 37 | + |
23 | 38 | # Check if the kernel script exists before trying to run it |
24 | 39 | if os.path.isfile(kernel_script): |
25 | 40 | try: |
26 | 41 | # Run the kernel script as a subprocess |
27 | | - subprocess.run([sys.executable, kernel_script], check=True) |
28 | | - except subprocess.CalledProcessError as e: |
29 | | - print(f"Error executing the kernel script: {e}") |
30 | | - except Exception as e: |
| 42 | + subprocess.run([sys.executable, kernel_script], check=True) |
| 43 | + except subprocess.CalledProcessError as e: |
| 44 | + print(f"Error executing the kernel script: {e}") |
| 45 | + except Exception as e: |
31 | 46 | print(f"An unexpected error occurred: {e}") |
32 | 47 | else: |
33 | | - print("yay! sucsess!") |
| 48 | + print("Kernel script not found. Please ensure it is located in the 'KERNEL' directory.") |
0 commit comments