Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 2003320

Browse files
authored
Update BIOS.py
1 parent 591b9c1 commit 2003320

1 file changed

Lines changed: 30 additions & 19 deletions

File tree

BIOS/BIOS.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,54 @@
11
import os
22
import subprocess
33
import sys
4-
4+
import logging
5+
import platform
6+
import shutil
7+
from datetime import datetime
8+
59
kernelState = None
610

7-
print("SkyOS v2.7 bugfix + app update")
8-
print("This device is running SkyOS")
9-
print("/bios/bios.py")
10-
print(" ^ BIOS is running here")
11+
logging.basicConfig(filename='bios_log.txt', level=logging.INFO)
12+
13+
def log_and_print(message):
14+
logging.info(message)
15+
print(message)
16+
17+
def display_system_info():
18+
log_and_print(f"System Info - Date/Time: {datetime.now()}")
19+
log_and_print(f"System Info - OS: {platform.system()} {platform.release()}")
20+
total, used, free = shutil.disk_usage("/")
21+
log_and_print(f"System Info - Disk space: {free // (2**30)} GB free")
1122

1223
def main():
24+
display_system_info()
25+
1326
while True:
1427
answer = input("exit? (yes/no): ").strip().lower()
1528
if answer == "no":
16-
print("SkyOS v2.7")
17-
print("This device is running SkyOS")
18-
print("/bios/bios.py/")
19-
print(" ^ BIOS is running here")
29+
log_and_print("SkyOS v2.7")
30+
log_and_print("This device is running SkyOS")
31+
log_and_print("/bios/bios.py/")
32+
log_and_print(" ^ BIOS is running here")
2033
elif answer == "yes":
21-
# Path to the kernel script in the KERNEL folder
2234
kernel_script = os.path.join(os.getcwd(), 'KERNEL', 'kernel.py')
2335

24-
# Check if the kernel script exists before trying to run it
2536
if os.path.isfile(kernel_script):
2637
try:
27-
# Run the kernel script as a subprocess
2838
subprocess.run([sys.executable, kernel_script], check=True)
2939
except subprocess.CalledProcessError as e:
30-
print(f"Error executing the kernel script: {e}")
40+
log_and_print(f"Error executing the kernel script: {e}")
3141
except Exception as e:
32-
print(f"An unexpected error occurred: {e}")
42+
log_and_print(f"An unexpected error occurred: {e}")
3343
else:
34-
print("sucsess!!!!!")
44+
log_and_print("Success!")
3545
kernelState = "gone"
36-
break # Exit the loop after trying to run the kernel script
46+
break
3747
else:
38-
print("Invalid input. Please type 'yes' or 'no'.")
39-
if kernelState == "gone":
40-
print("The skyOS kernel is missing. Please reinstall skyOS or, replace the kernel script.")
48+
log_and_print("Invalid input. Please type 'yes' or 'no'.")
49+
50+
if kernelState == "gone":
51+
log_and_print("The SkyOS kernel is missing. Please reinstall SkyOS or replace the kernel script.")
4152

4253
if __name__ == "__main__":
4354
main()

0 commit comments

Comments
 (0)