refactoring of halyde/kernel/boot.lua boot process
This commit is contained in:
+1
-11
@@ -14,12 +14,8 @@ local log = assert(loadfile("/lib/log.lua")(loadfile))
|
|||||||
|
|
||||||
log.kernel.info("Bound GPU to screen " .. tostring(screenAddress))
|
log.kernel.info("Bound GPU to screen " .. tostring(screenAddress))
|
||||||
|
|
||||||
log.kernel.info("Loaded OS logo")
|
|
||||||
|
|
||||||
_G.package = { ["preloaded"] = {} }
|
_G.package = { ["preloaded"] = {} }
|
||||||
|
|
||||||
loadfile("/halyde/kernel/modules/datatools.lua")()
|
|
||||||
|
|
||||||
function _G.reqgen(load)
|
function _G.reqgen(load)
|
||||||
return function(module, ...)
|
return function(module, ...)
|
||||||
local args = table.pack(...)
|
local args = table.pack(...)
|
||||||
@@ -64,23 +60,17 @@ function _G.package.preload(module)
|
|||||||
handle:close()
|
handle:close()
|
||||||
package.preloaded[module] = assert(load(data, "=" .. module))()
|
package.preloaded[module] = assert(load(data, "=" .. module))()
|
||||||
_G[module] = nil
|
_G[module] = nil
|
||||||
|
log.kernel.info(string.format("Pre-loaded /lib/%s.lua", module))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Datatools is imported twice??
|
|
||||||
require("/halyde/kernel/datatools.lua") -- If this is not imported BEFORE modload gets run, modload requires filesystem which requires computer which requires datatools. TODO: When VFS is implemented, make the pre-VFS loading of filesystem load a more basic version. And remove this.
|
require("/halyde/kernel/datatools.lua") -- If this is not imported BEFORE modload gets run, modload requires filesystem which requires computer which requires datatools. TODO: When VFS is implemented, make the pre-VFS loading of filesystem load a more basic version. And remove this.
|
||||||
log.kernel.info("Loading modules")
|
log.kernel.info("Loading modules")
|
||||||
require("/halyde/kernel/modload.lua")
|
require("/halyde/kernel/modload.lua")
|
||||||
|
|
||||||
package.preload("component")
|
package.preload("component")
|
||||||
log.kernel.info("Pre-loaded /lib/component.lua")
|
|
||||||
package.preload("computer")
|
package.preload("computer")
|
||||||
log.kernel.info("Pre-loaded /lib/computer.lua")
|
|
||||||
package.preload("log")
|
package.preload("log")
|
||||||
log.kernel.info("Pre-loaded /lib/log.lua")
|
|
||||||
|
|
||||||
if not filesystem.exists("/halyde/config/shell.json") then -- Auto-generate configs
|
|
||||||
filesystem.copy("/halyde/config/generate/shell.json", "/halyde/config/shell.json")
|
|
||||||
end
|
|
||||||
if not filesystem.exists("/halyde/config/startupapps.json") then
|
if not filesystem.exists("/halyde/config/startupapps.json") then
|
||||||
filesystem.copy("/halyde/config/generate/startupapps.json", "/halyde/config/startupapps.json")
|
filesystem.copy("/halyde/config/generate/startupapps.json", "/halyde/config/startupapps.json")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
local fs = require("filesystem")
|
local fs = require("filesystem")
|
||||||
local json = require("json")
|
local json = require("json")
|
||||||
|
if not fs.exists("/halyde/config/shell.json") then -- Auto-generate configs
|
||||||
|
fs.copy("/halyde/config/generate/shell.json", "/halyde/config/shell.json")
|
||||||
|
end
|
||||||
local handle, data, tmpdata = fs.open("/halyde/config/shell.json", "r"), "", nil
|
local handle, data, tmpdata = fs.open("/halyde/config/shell.json", "r"), "", nil
|
||||||
repeat
|
repeat
|
||||||
tmpdata = handle:read(math.huge)
|
tmpdata = handle:read(math.huge)
|
||||||
|
|||||||
Reference in New Issue
Block a user