finished http implementation working on spm and liveboot env

This commit is contained in:
2026-07-23 14:33:16 -04:00
parent f7b64c11b7
commit 49c9e5e37c
130 changed files with 1128 additions and 635 deletions
+25 -22
View File
@@ -1,8 +1,9 @@
--:Minify:--
local kernel=...
local fs=require("fs")
kernel.log("Sysinit started...")
kernel.saveLog()
local fs=require("fs")
kernel.log("Loaded fs")
for i,v in pairs(kernel.processes) do
kernel.log("Spawning kernel task "..i)
@@ -16,30 +17,32 @@ for i,v in pairs(kernel.processes) do
end, i)
end
if not fs.exists("/bin/startup") then
fs.mkdir("/bin/startup")
-- config file path setup
if not fs.exists("/etc/sysinit/") then
kernel.log("Creating conf path")
fs.mkdir("/etc/sysinit/")
fs.mkdir("/etc/sysinit/autorun/")
fs.mkdir("/etc/sysinit/system/")
fs.mkdir("/etc/sysinit/user/")
end
local files = fs.list("/bin/startup")
if not files then error("Failed to list /bin/startup") end
local files = fs.list("/etc/sysinit/autorun/")
if not files then error("Failed to list autorun") end
for i,v in ipairs(files) do
if v:sub(-4) == ".lua" then
local filepath = "/bin/startup/" .. v
kernel.log("Executing startup script: " .. filepath)
local startupFunc, err = load(fs.readAllText(filepath), "@" .. filepath)
if not startupFunc then
kernel.log("Error loading startup script '" .. filepath .. "': " .. err, "ERROR", 0xFF0000)
else
syscall.spawn(function()
syscall.setuid(1)
local status, err = pcall(startupFunc)
if not status then
kernel.log("Error executing startup script '" .. filepath .. "': " .. err, "ERROR", 0xFF0000)
else
kernel.log("Successfully executed startup script: " .. filepath)
end
end, "startup:" .. v)
end
local filepath = "/etc/sysinit/autorun/" .. v
kernel.log("Executing startup script: " .. filepath)
local startupFunc, err = load(fs.readAllText(filepath), "@" .. filepath)
if not startupFunc then
kernel.log("Error loading startup script '" .. filepath .. "': " .. err, "ERROR", 0xFF0000)
else
syscall.spawn(function()
local status, err = pcall(startupFunc)
if not status then
kernel.log("Error executing startup script '" .. filepath .. "': " .. err, "ERROR", 0xFF0000)
else
kernel.log("Successfully executed startup script: " .. filepath)
end
end, "startup:" .. v)
end
end
kernel.saveLog()