Skip to content

Commit 754a08f

Browse files
IZOS 5.1-stable
The first release of IZOS 5
1 parent 515f2cb commit 754a08f

File tree

9 files changed

+143
-2
lines changed

9 files changed

+143
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
# IZ-OS
2-
A mini OS in python
1+
# IZOS
2+
3+
Welcome to IZOS !
4+
5+
IZOS is a mini OS coded on python
6+
7+
it has many great features, like **custom modules, a __package manager__, and more..**
8+
9+
Visit **the wiki** to get started!
10+
11+
12+
---
13+
14+
Made with ❤️

kernel.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import sys
2+
import os
3+
import time
4+
sys.path.append("./usr/lib/")
5+
from base import *
6+
klog("Imported base library !")
7+
klog("Booting...")
8+
klog("[green bold]Welcome to IZOS !")
9+
time.sleep(1)
10+
directory = "/"
11+
while True:#After boot code: The "real" system
12+
if user == "root":
13+
shells = f"root@{netname} {directory} # "
14+
else:
15+
shells = f"{user}@{netname} {directory} $ "
16+
shell = Prompt.ask(shells).split(maxsplit=-1)
17+
shellnoarg = shell[0]
18+
if shellnoarg == "exit" or shellnoarg == "stop":
19+
exit()
20+
if shellnoarg == "clear" or shellnoarg == "cls":
21+
os.system('cls' if os.name=='nt' else 'clear')
22+
if shellnoarg == "help":
23+
print(commands)
24+
if shellnoarg == "ls":
25+
try:
26+
if shell[1] == "/":
27+
print(os.listdir("./"))
28+
else:
29+
print(os.listdir(shell[1]))
30+
except:
31+
if directory == "/":
32+
print(os.listdir("./"))
33+
else:
34+
print(os.listdir(directory))
35+
# if shellnoarg == "cd":
36+
# try:
37+
# if os._exists(shell[1]):
38+
# directory = shell[1]
39+
# else:
40+
# print("[red]ERROR: No such directory")
41+
# r
42+
# except Exception as e:
43+
# print("[red]ERROR: please specify directory")
44+
# print(e)
45+
if commands.__contains__(shellnoarg) == False:
46+
try:
47+
with open(f"./usr/bin/{shellnoarg}.py", "r") as bin:
48+
exec(bin.read())
49+
except:
50+
print("[red]Error: No such executable file found.")
51+

run.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
python kernel.py

run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
py ./kernel.py

usr/bin/delbin.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
sys.path.append("../lib/")
3+
import base
4+
import os
5+
try:
6+
print(f"[red bold]Deleting {shell[1]}.py...")
7+
try:
8+
os.remove(f"usr/bin/{shell[1]}.py")
9+
10+
except Exception as e:
11+
print("[red bold]No such file !")
12+
print(e)
13+
print(os.listdir())
14+
except:
15+
print("""
16+
delbin: Delete your programs in one command!
17+
usage: delbin <package name>
18+
example: delbin test
19+
[red bold]Please specify an argument !
20+
""")

usr/bin/hello.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import sys
2+
import os
3+
sys.path.append("../lib/")
4+
import base
5+
helpstr = """
6+
[blue bold underlined]HelloPy v1: An IZOS utility[/blue bold underlined]
7+
[green]Commands:[/green]
8+
-v or --version: display HelloPy version
9+
--izos-version: display IZOS version
10+
--lsbin or --list-bin:list the programs on the [bold]/usr/bin/[/bold] directory
11+
"""
12+
13+
try:
14+
arg = shell[1]
15+
if arg == "-h" or shell[1] == "--help":
16+
print(helpstr)
17+
if arg == "-v" or shell[1] == "--version":
18+
print("[blue]HellPy v1.0")
19+
if arg == "--izos-version":
20+
print(version)
21+
if arg == "--lsbin" or arg == "--list-bin":
22+
print(os.listdir("usr/bin/"))
23+
except:
24+
print(helpstr + "[red]Error: Please specify a argument !")

usr/bin/pm.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
import urllib.request
3+
sys.path.append("../lib")
4+
import base
5+
from base import print
6+
try:
7+
print(f"Saving {shell[1]}.py...")
8+
try:
9+
urllib.request.urlretrieve(f"https://raw.githubusercontent.com/FrenchPythonLover/IZOSAPPS/main/{shell[1]}.py", f"usr/bin/{shell[1]}.py")
10+
except Exception as e:
11+
print("[red bold]ERROR: No such file ! (Invalid package name)")
12+
print(e)
13+
except:
14+
print("""
15+
pm: a package manager for IZOS !
16+
usage: pm <package name>
17+
example:
18+
pm test
19+
[red bold]Please specify a package name !
20+
""")
680 Bytes
Binary file not shown.

usr/lib/base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from rich.console import Console
2+
from rich.prompt import Prompt
3+
console = Console(color_system="truecolor")
4+
from rich import print
5+
version = "IZOS VERSION 5"
6+
def klog(text):
7+
print(f"[ KERNEL ] {text}")
8+
user = "root"
9+
netname = "izos"
10+
commands = ["ls","cls","clear","help"]
11+
creds = "IZOS V5 1 by ilyes"

0 commit comments

Comments
 (0)