Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/About/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NAME: B-Kernel 2.100.0
BUILD: 2.100.0
DATE: Feb 5 2022
CHANGES: Added changelog.txt
25 changes: 12 additions & 13 deletions linux.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Imported Variables
import os
import shutil
import subprocess
Expand All @@ -10,8 +11,7 @@
cmancode = subprocess.Popen(["python", str(locationdir) + "/bin/functions/registry/r~1.py"])
subprogram = False
booted = False

# Colors | For more help; see https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal
# Colors
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
Expand All @@ -22,17 +22,15 @@ class bcolors:
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

# The error codes are in this dictionary for easy re-use; add new ones whenever you wish :)
# Error Codes
error_codes = {
"0x001": "The 'bootloader' instance is already running.",
"0x002": "The item you were searching for was not found.",
"0x003": "The file cannot be executed.",
"0x004": "The directory is not accessible.",
"0x005": "That command doesn't exist. Type 'help' for a list of available commands."
}

# Print error function for easy re-use; make sure to use the correct error code
# Declaring Functions
def print_error(error_code, print_error=True):
try:
error_message = f"{bcolors.FAIL}Error code {error_code}: {error_codes[error_code]}{bcolors.ENDC}"
Expand All @@ -44,10 +42,8 @@ def print_error(error_code, print_error=True):
return None
else:
return error_message

def clear_screen():
os.system("clear")

def help_command(command=None):
if (command == None or command == ""):
clear_screen()
Expand Down Expand Up @@ -97,17 +93,15 @@ def Bootloader():
if booted == False:
print("B-Kernel")
print("(c) B-Kernel, 2023")
print("Version 1.130.0")
print("Version 2.0.0")
time.sleep(random.randint(2, 5))
clear_screen()
print(f"{bcolors.WARNING}Welcome to {bcolors.BOLD}B Kernel{bcolors.ENDC}")
return True
else:
print_error("0x001")

#Post-Determined Variables
#Calling Bootloader
booted = Bootloader()
#Default Directory: /workspaces/bkernel
while booted == True:
command = str(input(os.getcwd() + " "))
locationdir = os.getcwd()
Expand Down Expand Up @@ -147,6 +141,11 @@ def Bootloader():
cman = open(echo,"r")
print(cman.read())
cman.close
elif command == "history":
placement = 0
for i in history:
placement += 1
print(str(placement) + ". " + i)
elif command =="rc":
comlistdir = ""
echo = input("Insert Path: ")
Expand Down Expand Up @@ -315,4 +314,4 @@ def rem(val1,val2):
time.sleep(random.randint(0, 5))
booted = False
else:
print_error("0x005")
print_error("0x005")
29 changes: 14 additions & 15 deletions windows.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#Imported Variables
import os
import shutil
import subprocess
from sys import version_info

os.system('color')

# Pre-determined variables
location = 0
locationdir = os.getcwd()
Expand All @@ -13,8 +12,8 @@
cmancode = subprocess.Popen(["python", str(locationdir) + "/bin/functions/registry/r~1.py"])
subprogram = False
booted = False

# Colors | For more help; see https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal
history = []
# Colors
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
Expand All @@ -25,17 +24,15 @@ class bcolors:
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

# The error codes are in this dictionary for easy re-use; add new ones whenever you wish :)
# Error Codes
error_codes = {
"0x001": "The 'bootloader' instance is already running.",
"0x002": "The item you were searching for was not found.",
"0x003": "The file cannot be executed.",
"0x004": "The directory is not accessible.",
"0x005": "That command doesn't exist. Type 'help' for a list of available commands."
}

# Print error function for easy re-use; make sure to use the correct error code
# Declaring Functions
def print_error(error_code, print_error=True):
try:
error_message = f"{bcolors.FAIL}Error code {error_code}: {error_codes[error_code]}{bcolors.ENDC}"
Expand All @@ -47,10 +44,8 @@ def print_error(error_code, print_error=True):
return None
else:
return error_message

def clear_screen():
os.system("cls")

def help_command(command=None):
if (command == None or command == ""):
clear_screen()
Expand Down Expand Up @@ -101,23 +96,22 @@ def Bootloader():
os.system('color e0')
print("B-Kernel")
print("(c) B-Kernel, 2023")
print("Version 1.130.0")
print("Version 2.0.0")
time.sleep(random.randint(2, 5))
clear_screen()
os.system('color 0f')
print(f"{bcolors.WARNING}Welcome to {bcolors.BOLD}B Kernel{bcolors.ENDC}")
return True
else:
print_error("0x001")

#Post-Determined Variables
#Calling Bootloader
booted = Bootloader()
#Default Directory: /workspaces/bkernel
while booted == True:
command = str(input(os.getcwd() + " "))
locationdir = os.getcwd()
comlistdir = locationdir + " "
locationstr = os.listdir(os.path.dirname(os.path.realpath(__file__)))
history.append("\"" + command + "\"")
if command == "registry":
#Registry
subprocess.Popen(["python", str(locationdir) + "/bin/functions/registry/r~2.py"])
Expand Down Expand Up @@ -152,6 +146,11 @@ def Bootloader():
cman = open(echo,"r")
print(cman.read())
cman.close
elif command == "history":
placement = 0
for i in history:
placement += 1
print(str(placement) + ". " + i)
elif command =="rc":
comlistdir = ""
echo = input("Insert Path: ")
Expand Down Expand Up @@ -320,4 +319,4 @@ def rem(val1,val2):
time.sleep(random.randint(0, 5))
booted = False
else:
print_error("0x005")
print_error("0x005")