1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-12-23 09:28:07 +11:00

Merge pull request #7 from Ocawesome101/patch-2

add ULOS loader
This commit is contained in:
lunaboards-dev 2021-12-05 16:06:09 -05:00 committed by GitHub
commit bc9617228f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,35 @@
-- cynosure loader --
local zy = krequire("zorya")
local utils = krequire("utils")
local thd = krequire("thd")
local vdev = krequire("util_vcomponent")
local function proxytable(t)
return setmetatable({}, {__index=function(self, i)
if (type(t[i]) == "table") then
self[i] = proxytable(t[i])
return rawget(self, i)
else
return t[i]
end
end})
end
local monolith_count = 0
return function(addr)
local fs = component.proxy(addr)
thd.add("cynosure$"..monolith_count, function()
local env = utils.make_env()
function env.computer.getBootAddress()
return addr
end
function env.computer.setBootAddress()end
local old_dl = utils.debug_log
load(utils.readfile(fs.address, fs.open("/boot/cynosure.lua")), "=/boot/cynosure.lua", "t", env)()
computer.pushSignal("cynosure_dead")
end)
while true do
if computer.pullSignal() == "cynosure_dead" then
utils.debug_log("Got signal.")
break
end
end
end

View File

@ -0,0 +1,12 @@
local cfgadd = ...
local component = require("component")
for fs in component.list("filesystem") do
if component.invoke(fs, "exists", "/boot/cynosure.lua") then
print("Cynosure kernel discovered on " .. fs)
cfgadd(string.format([[
menu.add("Cynosure kernel on %s", function()
return loadmod("loader_cynosure")("%s")
end)
]], fs:sub(1,3), fs))
end
end