made sysinit in /usr/lib/sysinit and sped up micro added kernel.firstBoot in kernel table

This commit is contained in:
2026-03-05 09:53:30 -05:00
parent 6fefa2d9ff
commit 62e032e4c5
8 changed files with 41 additions and 40 deletions

View File

@@ -413,8 +413,6 @@ while running do
redraw() redraw()
dirty = false dirty = false
end end
sleep(0.05)
end end
tclear(); tfg(1); tbg(16); tpos(1,1) tclear(); tfg(1); tbg(16); tpos(1,1)

View File

@@ -0,0 +1,4 @@
local args={...}
syscall.remove("/sbin/init")
syscall.symlink("/usr/lib/sysinit/sysinit", "/sbin/init")
syscall.exec("/sbin/init", args)

View File

@@ -113,13 +113,14 @@ local split = function(str, delim, maxResultCountOrNil)
end end
if not ifs.isFile("/boot/boot.cfg") then if not ifs.isFile("/boot/boot.cfg") then
kernel.log("boot.cfg missing or corrupted!, Attempting to write recovery boot.cfg", "ERROR", 2) kernel.log("First boot detected writing boot.cfg", "INFO", 3)
ifs.writeAllText("/boot/boot.cfg",ifs.readAllText("/boot/safeboot.cfg")) ifs.writeAllText("/boot/boot.cfg",ifs.readAllText("/boot/safeboot.cfg"))
kernel.firstBoot=true
end end
local initCfgFunc, err = load(ifs.readAllText("/boot/boot.cfg"), "@boot.cfg") local initCfgFunc, err = load(ifs.readAllText("/boot/boot.cfg"), "@boot.cfg")
if not initCfgFunc then if not initCfgFunc then
kernel.PANIC("Failed to load /boot/boot.cfg: "..tostring(err)) kernel.LOG_Text("Failed to load /boot/boot.cfg: "..tostring(err))
end end
---@diagnostic disable-next-line: param-type-mismatch ---@diagnostic disable-next-line: param-type-mismatch
@@ -149,10 +150,6 @@ function kernel.saveLog()
ifs.writeAllText("/var/log/syslog.log", kernel.LOG_Text) ifs.writeAllText("/var/log/syslog.log", kernel.LOG_Text)
end end
function loadcstr(string)
end
function kernel.newFifo() function kernel.newFifo()
local fifo = {} local fifo = {}
fifo.push=function(data) fifo.push=function(data)

View File

@@ -4,7 +4,7 @@
-- This file is auto-generated during the build process. -- This file is auto-generated during the build process.
-- DEFAULT BOOT CONFIGURATION FILE -- DEFAULT BOOT CONFIGURATION FILE
return { return {
initPath = "/sbin/init.lua", initPath = "/sbin/init",
maxOpenFiles = 128, maxOpenFiles = 128,
maxFilesPerTask = 16, maxFilesPerTask = 16,
preempt=true preempt=true

View File

@@ -82,36 +82,38 @@ local function mergeMeta(dir, entries)
end end
end end
kernel.log("Seeding filesystem permissions...", "INFO") if kernel.firstBoot then
kernel.log("Seeding filesystem permissions...")
mergeMeta("/", { mergeMeta("/", {
{"bin", REG, 0, 0, RWX_RX_RX}, {"bin", REG, 0, 0, RWX_RX_RX},
{"boot", REG, 0, 0, RWX_RX_RX}, {"boot", REG, 0, 0, RWX_RX_RX},
{"dev", REG, 0, 0, RWXRWXRWX}, {"dev", REG, 0, 0, RWXRWXRWX},
{"etc", REG, 0, 0, RWX_RX_RX}, {"etc", REG, 0, 0, RWX_RX_RX},
{"home", REG, 0, 0, RWX_RX_RX}, {"home", REG, 0, 0, RWX_RX_RX},
{"lib", REG, 0, 0, RWX_RX_RX}, {"lib", REG, 0, 0, RWX_RX_RX},
{"root", REG, 0, 0, RW____ }, {"root", REG, 0, 0, RW____ },
{"sbin", REG, 0, 0, RWX_RX_RX}, {"sbin", REG, 0, 0, RWX_RX_RX},
{"tmp", REG, 0, 0, RWXRWXRWX}, {"tmp", REG, 0, 0, RWXRWXRWX},
{"usr", REG, 0, 0, RWX_RX_RX}, {"usr", REG, 0, 0, RWX_RX_RX},
{"var", REG, 0, 0, RWX_RX_RX}, {"var", REG, 0, 0, RWX_RX_RX},
}) })
mergeMeta("/bin", { mergeMeta("/bin", {
{"login", REG, 0, 0, SUID_755 }, {"login", REG, 0, 0, SUID_755 },
{"su", REG, 0, 0, SUID_755 }, {"su", REG, 0, 0, SUID_755 },
{"sudo", REG, 0, 0, SUID_755 }, {"sudo", REG, 0, 0, SUID_755 },
}) })
mergeMeta("/etc", { mergeMeta("/etc", {
{"passwd", REG, 0, 0, RW_R_R }, {"passwd", REG, 0, 0, RW_R_R },
{"shadow", REG, 0, 0, RW____ }, {"shadow", REG, 0, 0, RW____ },
{"pam.d", REG, 0, 0, RWX_RX_RX}, {"pam.d", REG, 0, 0, RW____ },
}) })
mergeMeta("/etc/pam.d", { mergeMeta("/etc/pam.d", {
{"secret", REG, 0, 0, RW____}, {"secret", REG, 0, 0, RW____},
}) })
kernel.log("Filesystem permissions seeded.", "INFO") kernel.log("Filesystem permissions seeded.")
end

View File

@@ -1,7 +1,7 @@
syscall={} syscall={}
--- Sets home directory of User with corosponding uid to homedir --- Sets home directory of User with corosponding uid to homedir
--- @param uid number --- @param uid integer
--- @param homedir string --- @param homedir string
--- @return true|nil, nil|string --- @return true|nil, nil|string
syscall.sethomedir=function(uid, homedir) end syscall.sethomedir=function(uid, homedir) end
@@ -87,7 +87,7 @@ syscall.newuser=function(username, password, gid, homedir, shell) end
syscall.spawn=function(func, name, envars, args, tgid) end syscall.spawn=function(func, name, envars, args, tgid) end
syscall.collect=function(pid) end syscall.collect=function(pid) end
syscall.setshell=function(uid, shell) end syscall.setshell=function(uid, shell) end
syscall.devctl=function(fd, funcname) end syscall.devctl=function(fd, funcname, ...) end
syscall.listusers=function() end syscall.listusers=function() end
syscall.unlockuser=function(uid) end syscall.unlockuser=function(uid) end
syscall.mount=function(target, diskOrId) end syscall.mount=function(target, diskOrId) end