OC-PsychOS2/module/init.lua

25 lines
693 B
Lua
Raw Normal View History

2019-10-27 02:40:25 +11:00
--#include "module/sched.lua"
--#include "module/buffer.lua"
--#include "module/fs.lua"
--#include "module/loadfile.lua"
2018-11-03 03:05:41 +11:00
os.spawn(function() print(pcall(function()
print(_OSVERSION,tostring(math.floor(computer.totalMemory()/1024)).."K memory")
2019-01-08 17:59:01 +11:00
os.setenv("PWD","/boot")
2018-11-03 03:05:41 +11:00
local f = fs.open("/boot/init.txt","rb")
2019-01-08 17:59:01 +11:00
if f then
local fc = f:read("*a")
f:close()
for line in fc:gmatch("[^\n]+") do
print("Starting service "..line)
spawnfile("/boot/service/"..line,line)
end
2018-11-03 03:05:41 +11:00
end
for k,v in pairs(fd) do
if v.t == "t" then
2019-01-08 17:59:01 +11:00
os.setenv("t",k)
2018-11-03 03:05:41 +11:00
print("Spawning a shell for terminal #"..tostring(k))
2019-07-14 20:52:56 +10:00
spawnfile("/boot/exec/shell.lua","shell [local:"..tostring(k).."]")
2018-11-03 03:05:41 +11:00
end
end
end)) end,"init")