Compare commits

...

5 Commits

Author SHA1 Message Date
lunaboards-dev bc9617228f
Merge pull request #7 from Ocawesome101/patch-2
add ULOS loader
2021-12-05 16:06:09 -05:00
i develop things 52c9da6fe3
add cynosure loader 2021-09-03 16:27:00 -04:00
i develop things d96ffb10da
remove loader_ulos.lua 2021-09-03 16:25:41 -04:00
i develop things 001234bcd5
add cynosure detection 2021-09-03 16:25:11 -04:00
i develop things b1f64f97a1
add ULOS loader 2021-09-03 16:22:40 -04:00
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