-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
591b9c1
commit 2003320
Showing
1 changed file
with
30 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,54 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
import logging | ||
import platform | ||
import shutil | ||
from datetime import datetime | ||
|
||
kernelState = None | ||
|
||
print("SkyOS v2.7 bugfix + app update") | ||
print("This device is running SkyOS") | ||
print("/bios/bios.py") | ||
print(" ^ BIOS is running here") | ||
logging.basicConfig(filename='bios_log.txt', level=logging.INFO) | ||
|
||
def log_and_print(message): | ||
logging.info(message) | ||
print(message) | ||
|
||
def display_system_info(): | ||
log_and_print(f"System Info - Date/Time: {datetime.now()}") | ||
log_and_print(f"System Info - OS: {platform.system()} {platform.release()}") | ||
total, used, free = shutil.disk_usage("/") | ||
log_and_print(f"System Info - Disk space: {free // (2**30)} GB free") | ||
|
||
def main(): | ||
display_system_info() | ||
|
||
while True: | ||
answer = input("exit? (yes/no): ").strip().lower() | ||
if answer == "no": | ||
print("SkyOS v2.7") | ||
print("This device is running SkyOS") | ||
print("/bios/bios.py/") | ||
print(" ^ BIOS is running here") | ||
log_and_print("SkyOS v2.7") | ||
log_and_print("This device is running SkyOS") | ||
log_and_print("/bios/bios.py/") | ||
log_and_print(" ^ BIOS is running here") | ||
elif answer == "yes": | ||
# Path to the kernel script in the KERNEL folder | ||
kernel_script = os.path.join(os.getcwd(), 'KERNEL', 'kernel.py') | ||
|
||
# Check if the kernel script exists before trying to run it | ||
if os.path.isfile(kernel_script): | ||
try: | ||
# Run the kernel script as a subprocess | ||
subprocess.run([sys.executable, kernel_script], check=True) | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error executing the kernel script: {e}") | ||
log_and_print(f"Error executing the kernel script: {e}") | ||
except Exception as e: | ||
print(f"An unexpected error occurred: {e}") | ||
log_and_print(f"An unexpected error occurred: {e}") | ||
else: | ||
print("sucsess!!!!!") | ||
log_and_print("Success!") | ||
kernelState = "gone" | ||
break # Exit the loop after trying to run the kernel script | ||
break | ||
else: | ||
print("Invalid input. Please type 'yes' or 'no'.") | ||
if kernelState == "gone": | ||
print("The skyOS kernel is missing. Please reinstall skyOS or, replace the kernel script.") | ||
log_and_print("Invalid input. Please type 'yes' or 'no'.") | ||
|
||
if kernelState == "gone": | ||
log_and_print("The SkyOS kernel is missing. Please reinstall SkyOS or replace the kernel script.") | ||
|
||
if __name__ == "__main__": | ||
main() |