From 1ba6cd3ade816e88039e6ba12b4e0e293b333068 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Tue, 8 Jan 2019 17:59:01 +1100 Subject: [PATCH] made init cope if there is no init.txt --- module/init.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/module/init.lua b/module/init.lua index 56ad6d1..663d900 100644 --- a/module/init.lua +++ b/module/init.lua @@ -1,15 +1,18 @@ os.spawn(function() print(pcall(function() print(_OSVERSION,tostring(math.floor(computer.totalMemory()/1024)).."K memory") +os.setenv("PWD","/boot") local f = fs.open("/boot/init.txt","rb") -local fc = f:read("*a") -f:close() -for line in fc:gmatch("[^\n]+") do - print("Starting service "..line) - spawnfile("/boot/service/"..line) +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 end for k,v in pairs(fd) do if v.t == "t" then - tTasks[cPid].t = k + os.setenv("t",k) print("Spawning a shell for terminal #"..tostring(k)) spawnfile("/boot/exec/shell.lua","shell #"..tostring(k)) end