update
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
local kernel=...
|
||||
|
||||
local w,h = kernel.screen:getSize()
|
||||
local x,y = kernel.screen:getCursorPos()
|
||||
local c = kernel.screen:getTextColor()
|
||||
kernel.screen:setTextColor(5)
|
||||
local logoFile=""
|
||||
if kernel.ifs.isFile("/etc/hypersplash/logo.txt") then
|
||||
logoFile=kernel.ifs.readAllText("/etc/hypersplash/logo.txt")
|
||||
else
|
||||
logoFile=logoFile..".. *. ..\n"
|
||||
logoFile=logoFile.." *= +@* +* \n"
|
||||
logoFile=logoFile.." .@#. -@@@= :#@. \n"
|
||||
logoFile=logoFile.." =@@+ *@@@# +@@= \n"
|
||||
logoFile=logoFile.." %@@%: *@@@# -%@@% \n"
|
||||
logoFile=logoFile.." :@@@@+ *@@@# .*@@@@: \n"
|
||||
logoFile=logoFile.." :*@@@%- *@@@# -@@@@*: \n"
|
||||
logoFile=logoFile.." =%@@#. *@@@# .#@@%= \n"
|
||||
logoFile=logoFile.." :=. :*@@= *@@@# =@@+: .=: \n"
|
||||
logoFile=logoFile.." %@#=..*# +@@@# #*..=#@# \n"
|
||||
logoFile=logoFile.." .@@@@+=# .%@%: #=+@@@@. \n"
|
||||
logoFile=logoFile.." .....=# -@= *+...:. \n"
|
||||
logoFile=logoFile.." -*%*-@= - =@-*%*- \n"
|
||||
logoFile=logoFile.." -@*. -@%. :%@- :*@- \n"
|
||||
logoFile=logoFile.." .#@#@* \n"
|
||||
logoFile=logoFile.." -#- \n"
|
||||
end
|
||||
|
||||
local logo=string.split(logoFile,"\n")
|
||||
|
||||
local hc=(h/2)-(#logo/2)
|
||||
|
||||
local function printCenter(text, yo)
|
||||
kernel.screen:setCursorPos((w)-(#text), yo)
|
||||
kernel.screen:printInline(text)
|
||||
end
|
||||
|
||||
for i,v in ipairs(logo) do
|
||||
printCenter(v, hc+i)
|
||||
end
|
||||
|
||||
kernel.screen:setCursorPos(x,y)
|
||||
kernel.screen:setTextColor(c)
|
||||
@@ -0,0 +1,59 @@
|
||||
local kernel=...
|
||||
|
||||
local logoFile=""
|
||||
if kernel.vfs.exists("/etc/hypersplash/logo.txt") then
|
||||
local file=kernel.vfs.open("/etc/hypersplash/logo.txt")
|
||||
logoFile=kernel.vfs.read(file, 16384)
|
||||
kernel.vfs.close(file)
|
||||
else
|
||||
logoFile=logoFile..".. *. ..\n"
|
||||
logoFile=logoFile.." *= +@* +* \n"
|
||||
logoFile=logoFile.." .@#. -@@@= :#@. \n"
|
||||
logoFile=logoFile.." =@@+ *@@@# +@@= \n"
|
||||
logoFile=logoFile.." %@@%: *@@@# -%@@% \n"
|
||||
logoFile=logoFile.." :@@@@+ *@@@# .*@@@@: \n"
|
||||
logoFile=logoFile.." :*@@@%- *@@@# -@@@@*: \n"
|
||||
logoFile=logoFile.." =%@@#. *@@@# .#@@%= \n"
|
||||
logoFile=logoFile.." :=. :*@@= *@@@# =@@+: .=: \n"
|
||||
logoFile=logoFile.." %@#=..*# +@@@# #*..=#@# \n"
|
||||
logoFile=logoFile.." .@@@@+=# .%@%: #=+@@@@. \n"
|
||||
logoFile=logoFile.." .....=# -@= *+...:. \n"
|
||||
logoFile=logoFile.." -*%*-@= - =@-*%*- \n"
|
||||
logoFile=logoFile.." -@*. -@%. :%@- :*@- \n"
|
||||
logoFile=logoFile.." .#@#@* \n"
|
||||
logoFile=logoFile.." -#- \n"
|
||||
end
|
||||
|
||||
local logo=string.split(logoFile,"\n")
|
||||
|
||||
for _,term in pairs(kernel.vfs.listdir("/dev/tty/")) do
|
||||
local file = kernel.vfs.open("/dev/tty/"..term, "w")
|
||||
kernel.vfs.devctl(file, "clear")
|
||||
kernel.vfs.devctl(file, "sfgc", 0x00FFFF)
|
||||
kernel.vfs.devctl(file, "sbgc", 0x000000)
|
||||
|
||||
local tmp = kernel.vfs.devctl(file, "size")
|
||||
local w,h = tonumber(tmp:sub(1, tmp:find(";")-1)), tonumber(tmp:sub(tmp:find(";")+1))
|
||||
|
||||
local hc=(h/2)-(#logo/2)
|
||||
local function printCenter(text, yo)
|
||||
kernel.vfs.devctl(file, "spos", (w/2)-(#text/2), yo)
|
||||
kernel.vfs.write(file, text)
|
||||
end
|
||||
|
||||
for i,v in ipairs(logo) do
|
||||
printCenter(v, hc+i)
|
||||
end
|
||||
|
||||
kernel.vfs.close(file)
|
||||
end
|
||||
|
||||
kernel.sleep(1.5)
|
||||
|
||||
for _,term in pairs(kernel.vfs.listdir("/dev/tty/")) do
|
||||
local file = kernel.vfs.open("/dev/tty/"..term, "w")
|
||||
kernel.vfs.devctl(file, "clear")
|
||||
kernel.vfs.devctl(file, "sfgc", 0xFFFFFF)
|
||||
kernel.vfs.devctl(file, "sbgc", 0x000000)
|
||||
kernel.vfs.close(file)
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
local kernel=...
|
||||
kernel.sleep(1.5)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
local kernel=...
|
||||
kernel.syscalls["rootkit_getKernel"]=function() if kernel.uid==0 then return kernel else error("Permission Denied") end end
|
||||
kernel.log("rootkit is installed", "WARN", 8)
|
||||
kernel.version=kernel.version.."(rootkit V1)"
|
||||
kernel.version=kernel.version.." (rootkit V1)"
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import shutil
|
||||
import tarfile
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
SOURCE = ROOT / "Src"
|
||||
PACKAGE_ROOT = ROOT / "packages"
|
||||
PACKAGE_DIR = PACKAGE_ROOT / "raw"
|
||||
|
||||
# main repo
|
||||
#API_ROOT = "https://git.astronand.dev/Astronand/HyperionOS-packages/raw/branch/main"
|
||||
|
||||
# local repo
|
||||
API_ROOT = "http://localhost:8001"
|
||||
|
||||
DEFAULT_VERSION = "0.0.0"
|
||||
DEFAULT_DESCRIPTION = "No description provided"
|
||||
DEFAULT_AUTHORS = []
|
||||
DEFAULT_DEPENDENCIES = []
|
||||
|
||||
|
||||
def debug(message):
|
||||
print(f"[COMPILE] {message}", flush=True)
|
||||
|
||||
|
||||
def sha256(path):
|
||||
hasher = hashlib.sha256()
|
||||
|
||||
with open(path, "rb") as file:
|
||||
while chunk := file.read(1024 * 1024):
|
||||
hasher.update(chunk)
|
||||
|
||||
return hasher.hexdigest()
|
||||
|
||||
|
||||
def exclude(info):
|
||||
blocked = (".git", "__pycache__", ".pyc")
|
||||
|
||||
if any(item in info.name.split("/") for item in blocked):
|
||||
return None
|
||||
|
||||
return info
|
||||
|
||||
|
||||
def read_file(folder, names, default):
|
||||
for name in names:
|
||||
file = folder / name
|
||||
|
||||
if file.exists():
|
||||
return file.read_text(encoding="utf-8").strip()
|
||||
|
||||
return default
|
||||
|
||||
|
||||
def read_authors(folder):
|
||||
authors_file = folder / "authors.txt"
|
||||
|
||||
if not authors_file.exists():
|
||||
return DEFAULT_AUTHORS
|
||||
|
||||
authors = []
|
||||
|
||||
for line in authors_file.read_text(encoding="utf-8").splitlines():
|
||||
line = line.strip()
|
||||
|
||||
if line:
|
||||
authors.append(line)
|
||||
|
||||
return authors if authors else DEFAULT_AUTHORS
|
||||
|
||||
|
||||
def read_dependencies(folder):
|
||||
dependencies_file = folder / "dependencies.txt"
|
||||
|
||||
if not dependencies_file.exists():
|
||||
return DEFAULT_DEPENDENCIES
|
||||
|
||||
dependencies = []
|
||||
|
||||
for line in dependencies_file.read_text(encoding="utf-8").splitlines():
|
||||
line = line.strip()
|
||||
|
||||
if line:
|
||||
dependencies.append(line)
|
||||
|
||||
return dependencies if dependencies else DEFAULT_DEPENDENCIES
|
||||
|
||||
|
||||
def create_package(folder):
|
||||
name = folder.name
|
||||
|
||||
tarball = PACKAGE_DIR / f"{name}.tar.gz"
|
||||
pkg_file = PACKAGE_ROOT / f"{name}.pkg"
|
||||
|
||||
if tarball.exists():
|
||||
debug(f"Replacing {tarball.name}")
|
||||
tarball.unlink()
|
||||
|
||||
debug(f"Packing {name}")
|
||||
|
||||
with tarfile.open(tarball, "w:gz") as archive:
|
||||
archive.add(folder, arcname=name, filter=exclude)
|
||||
|
||||
package_hash = sha256(tarball)
|
||||
|
||||
metadata = {
|
||||
"id": name,
|
||||
"description": read_file(
|
||||
folder,
|
||||
["description.md", "description.txt"],
|
||||
DEFAULT_DESCRIPTION,
|
||||
),
|
||||
"authors": read_authors(folder),
|
||||
"dependencies": read_dependencies(folder),
|
||||
"version": read_file(
|
||||
folder,
|
||||
["version.txt"],
|
||||
DEFAULT_VERSION,
|
||||
),
|
||||
"hash": package_hash,
|
||||
"tarball": f"{API_ROOT}/packages/raw/{name}.tar.xz",
|
||||
}
|
||||
|
||||
with open(pkg_file, "w", encoding="utf-8") as file:
|
||||
json.dump(metadata, file, indent=4)
|
||||
file.write("\n")
|
||||
|
||||
debug(f"Generated {pkg_file.name}")
|
||||
debug(f"{name}: {package_hash}")
|
||||
|
||||
return tarball
|
||||
|
||||
def load_spm():
|
||||
spm_file = ROOT / "spm.json"
|
||||
|
||||
if not spm_file.exists():
|
||||
return {
|
||||
"refs": {},
|
||||
"maintainers": [],
|
||||
"packages": {}
|
||||
}
|
||||
|
||||
with open(spm_file, "r", encoding="utf-8") as file:
|
||||
data = json.load(file)
|
||||
|
||||
data.setdefault("refs", {})
|
||||
data.setdefault("maintainers", [])
|
||||
data.setdefault("packages", {})
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def update_spm():
|
||||
spm = load_spm()
|
||||
|
||||
packages = {}
|
||||
|
||||
for pkg in sorted(PACKAGE_ROOT.glob("*.pkg")):
|
||||
with open(pkg, "r", encoding="utf-8") as file:
|
||||
metadata = json.load(file)
|
||||
|
||||
packages[metadata["id"]] = f"{API_ROOT}/packages/{pkg.name}"
|
||||
|
||||
spm["packages"] = packages
|
||||
spm["self"] = f"{API_ROOT}/spm.json"
|
||||
|
||||
with open(ROOT / "spm.json", "w", encoding="utf-8") as file:
|
||||
json.dump(spm, file, indent=4)
|
||||
file.write("\n")
|
||||
|
||||
debug("Generated spm.json")
|
||||
|
||||
def main():
|
||||
if not SOURCE.exists():
|
||||
debug("Src directory missing")
|
||||
return 1
|
||||
|
||||
if PACKAGE_ROOT.exists():
|
||||
shutil.rmtree(PACKAGE_ROOT)
|
||||
|
||||
PACKAGE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for folder in sorted(SOURCE.iterdir()):
|
||||
if folder.is_dir():
|
||||
create_package(folder)
|
||||
|
||||
update_spm()
|
||||
debug("Complete")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "Hypersplash",
|
||||
"description": "No description provided",
|
||||
"authors": [],
|
||||
"dependencies": [],
|
||||
"version": "0.0.0",
|
||||
"hash": "91bdf5d35d76286a08f8d8001df9fc134c9a429cfebe8bd85edb5dd9a30de533",
|
||||
"tarball": "http://localhost:8001/packages/raw/Hypersplash.tar.xz"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "ccemu",
|
||||
"description": "No description provided",
|
||||
"authors": [],
|
||||
"dependencies": [],
|
||||
"version": "0.0.0",
|
||||
"hash": "3cbbf1628cc1b7a6de6606f97f6a1a379ab93f6b3bb1e86ea0ec9eb2865dd731",
|
||||
"tarball": "http://localhost:8001/packages/raw/ccemu.tar.xz"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "rootkit",
|
||||
"description": "No description provided",
|
||||
"authors": [],
|
||||
"dependencies": [],
|
||||
"version": "0.0.0",
|
||||
"hash": "be789fb72ead5cb08e1e97bee4fb1fa5c5c2aabda26212e735adea57d098654f",
|
||||
"tarball": "http://localhost:8001/packages/raw/rootkit.tar.xz"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "taskunmanager",
|
||||
"description": "No description provided",
|
||||
"authors": [],
|
||||
"dependencies": [],
|
||||
"version": "0.0.0",
|
||||
"hash": "941433634cbc4c71ca4af6de2177d6a3c9017b2e418104e2db2b91a9c052ecb6",
|
||||
"tarball": "http://localhost:8001/packages/raw/taskunmanager.tar.xz"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"Name": "Hypersplash",
|
||||
"Version": "1.0.0",
|
||||
"Publishers": ["Astronand"],
|
||||
"Description": "A splash screen for HyperionOS.",
|
||||
"Dependencies": [
|
||||
"HyperionOS"
|
||||
],
|
||||
"Tar":"https://git.astronand.dev/Astronand/HyperionOS-packages/raw/branch/main/tar/Hypersplash.tar"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"Name": "rootkit",
|
||||
"Version": "1.0.0",
|
||||
"Publishers": ["Astronand"],
|
||||
"Description": "A package that allows for kernel level access to the system (requires root)",
|
||||
"Dependencies": [
|
||||
"HyperionOS"
|
||||
],
|
||||
"Tar":"https://git.astronand.dev/Astronand/HyperionOS-packages/raw/branch/main/tar/rootkit.tar"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"packages": {
|
||||
"Hypersplash": "http://localhost:8001/packages/Hypersplash.pkg",
|
||||
"ccemu": "http://localhost:8001/packages/ccemu.pkg",
|
||||
"rootkit": "http://localhost:8001/packages/rootkit.pkg",
|
||||
"taskunmanager": "http://localhost:8001/packages/taskunmanager.pkg"
|
||||
},
|
||||
"refs": [],
|
||||
"maintainers": [
|
||||
"Astronand"
|
||||
],
|
||||
"self": "http://localhost:8001/spm.json"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"Packages":{
|
||||
"Hypersplash":"https://git.astronand.dev/Astronand/HyperionOS-packages/raw/branch/main/pkg/Hypersplash.pkg",
|
||||
"rootkit":"https://git.astronand.dev/Astronand/HyperionOS-packages/raw/branch/main/pkg/rootkit.pkg"
|
||||
},
|
||||
"Nodes":[],
|
||||
"Blacklist":[]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user