OC-PsychOS/modules/setup.lua

32 lines
812 B
Lua

_G.DEFAC = 1
do
if component.list("gpu")() and component.list("screen")() and component.list("keyboard")() and tty and kbd then
local ts = {}
if fs.exists("/boot/sys/session.dat") then
local f = io.open("/boot/sys/session.dat","rb")
if f then
S = f:read("*a")
f:close()
log(S)
for line in S:gmatch("[^\n]+") do
log(line)
local ga, sa, ka = line:match("(.+)\t(.+)\t(.+)")
ts[#ts+1] = {os.gensalt(16),ga,sa,ka}
log()
end
end
else
ts[1] = {os.gensalt(16),component.list("gpu")(),component.list("screen")(),component.list("keyboard")()} -- session name, GPU address, screen address, keyboard address
end
for k,v in ipairs(ts) do
log(v[1],v[2],v[3],v[4])
tty(v[2],v[3],v[1])
kbd(v[4],v[1])
loginmanager(v[1])
end
elseif nshd then
nshd(23)
end
end
computer.beep()