From b1f64f97a13b2185f1498ff6f9cf12b41f4a6878 Mon Sep 17 00:00:00 2001 From: i develop things <50844998+Ocawesome101@users.noreply.github.com> Date: Fri, 3 Sep 2021 16:22:40 -0400 Subject: [PATCH 1/4] add ULOS loader --- mods/loader_ulos.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 mods/loader_ulos.lua diff --git a/mods/loader_ulos.lua b/mods/loader_ulos.lua new file mode 100644 index 0000000..92164d6 --- /dev/null +++ b/mods/loader_ulos.lua @@ -0,0 +1,35 @@ +-- ULOS 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 ulos_count = 0 +return function(addr) + local fs = component.proxy(addr) + thd.add("ulos$"..ulos_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("ulos_dead") + end) + while true do + if computer.pullSignal() == "ulos_dead" then + utils.debug_log("Got signal.") + break + end + end +end From 001234bcd5725b8d3935d27355ca899eba788dab Mon Sep 17 00:00:00 2001 From: i develop things <50844998+Ocawesome101@users.noreply.github.com> Date: Fri, 3 Sep 2021 16:25:11 -0400 Subject: [PATCH 2/4] add cynosure detection --- util/OpenOS/config.d/06_cynosure.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 util/OpenOS/config.d/06_cynosure.lua diff --git a/util/OpenOS/config.d/06_cynosure.lua b/util/OpenOS/config.d/06_cynosure.lua new file mode 100644 index 0000000..92f8a3a --- /dev/null +++ b/util/OpenOS/config.d/06_cynosure.lua @@ -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 From d96ffb10da778caa72c296af0a91ed1e8457a48c Mon Sep 17 00:00:00 2001 From: i develop things <50844998+Ocawesome101@users.noreply.github.com> Date: Fri, 3 Sep 2021 16:25:41 -0400 Subject: [PATCH 3/4] remove loader_ulos.lua --- mods/loader_ulos.lua | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 mods/loader_ulos.lua diff --git a/mods/loader_ulos.lua b/mods/loader_ulos.lua deleted file mode 100644 index 92164d6..0000000 --- a/mods/loader_ulos.lua +++ /dev/null @@ -1,35 +0,0 @@ --- ULOS 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 ulos_count = 0 -return function(addr) - local fs = component.proxy(addr) - thd.add("ulos$"..ulos_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("ulos_dead") - end) - while true do - if computer.pullSignal() == "ulos_dead" then - utils.debug_log("Got signal.") - break - end - end -end From 52c9da6fe3542128c44fdf22d32fbab4112bdc92 Mon Sep 17 00:00:00 2001 From: i develop things <50844998+Ocawesome101@users.noreply.github.com> Date: Fri, 3 Sep 2021 16:27:00 -0400 Subject: [PATCH 4/4] add cynosure loader --- mods/loader_cynosure/init.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 mods/loader_cynosure/init.lua diff --git a/mods/loader_cynosure/init.lua b/mods/loader_cynosure/init.lua new file mode 100644 index 0000000..95d580d --- /dev/null +++ b/mods/loader_cynosure/init.lua @@ -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