local fs=require("filesystem") if fs.exists("/bin/desktop.lua")and fs.exists("/lib/yaru/core.lua")then local auto=true local f=fs.open("/etc/yaru.cfg") if f then local parts={} repeat local d=f:read(math.huge)parts[#parts+1]=d until not d local data=table.concat(parts) f:close() local chunk=load("return "..data,"=yaru.cfg","t",{math={huge=math.huge}}) local ok,cfg=pcall(chunk or error) if ok and type(cfg)=="table"and cfg.autostart==false then auto=false end end if auto and fs.exists("/etc/yaru.crash")then fs.remove("/etc/yaru.crash") local m=io.open("/tmp/.desktop_msg","w") if m then m:write("Desktop did not start last time - text shell (safe mode). Run 'desktop' to retry.")m:close()end auto=false end if auto and require("event").pull(0.3,"key_down")then local m=io.open("/tmp/.desktop_msg","w") if m then m:write("Safe mode: text shell. Run 'desktop' to start the desktop.")m:close()end auto=false end if auto then local ok,a,b=pcall(require("shell").execute,"desktop") if not ok or a==false then io.stderr:write(tostring(ok and b or a).."\n")end end end