-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
68 lines (68 loc) · 2.7 KB
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import termcolor as tc
import term as t
from time import sleep
import requests
import ext
import platform
os.system("clear")
#t.write("█")
sleep(2)
os.system("clear")
welcome = tc.colored("Welcome to pyOS!", "blue")
tx = "(c) 2023 AzureTecDevs"
ver = tc.colored(f"Version 1.0.0 {tx}", "dark_grey")
print(f"{welcome}\n{ver}\n\n")
while True:
i = input("$ ")
try:
if i.lower() == "python":
os.system("python3")
elif i.lower() == "help":
print("""python : Run Python apps : Open apps
exit : Exit pyOS reset : Restart current session
clear : Clear screen pkg : Install package
pkg run : Run package pkg info: Get package info""")
elif i.lower() == "reset":
os.system("clear")
os.system("python3 init.py")
elif i.lower() == "pkg ins":
z = input("Package Name: ")
p = platform.linux_distribution()
if p.lower() in ("fedora","debian"):
os.system(f"python3 pkg/{z}/install/deb.py")
else:
os.system(f"python3 pkg/{z}/install/reg.py")
elif i.lower() == "clear":
os.system("clear")
print(f"{welcome}\n{ver}\n\n")
elif i.lower() == "apps":
print(f"Apps:\nBASH")
elif i.lower() == "pkg":
z = input("Package Name: ").lower()
if not os.path.exists(f'pkg/{z}'):
os.mkdir(f'pkg/{z}')
url = f'https://raw.githubusercontent.com/AzureTecDevs/pyOS/packages/pkg/{z}/{z}.py'
r = requests.get(url, allow_redirects=True)
open(f'pkg/{z}/{z}.py', 'wb').write(r.content)
url = f'https://raw.githubusercontent.com/AzureTecDevs/pyOS/packages/pkg/{z}/about'
r = requests.get(url, allow_redirects=True)
open(f'pkg/{z}/about', 'wb').write(r.content)
f = ext.readFile(f'pkg/{z}/about')[3]
if not f == "":
t = f.split(",")
for n in t:
url = f'https://raw.githubusercontent.com/AzureTecDevs/pyOS/packages/pkg/{z}/{n}.py'
r = requests.get(url, allow_redirects=True)
open(f'pkg/{z}/{n}.py', 'wb').write(r.content)
elif i.lower() == "pkg run":
z = input("Package Name: ").lower()
os.system(f'python3 pkg/{z}/{z}.py')
elif i.lower() == "pkg info":
z = input("Package Name: ").lower()
f = ext.readFile(f'pkg/{z}/about')
print(f'Description: {f[0]}\nAuthor: {z[1]}\nVersion: {f[0]}')
elif i.lower() == "bash":
os.system('python3 pkg/bash/bash.py')
except:
print('Fatal Error')