1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-15 17:18:08 -05:00
OC-PsychOS2/module/init.lua

35 lines
723 B
Lua
Raw Normal View History

2020-06-02 22:38:04 -04:00
_OSVERSION=_OSVERSION or "PsychOS 2"
2020-03-17 10:31:44 -04:00
os.spawn(function()
os.setenv("PWD","/boot")
io.input("/dev/null")
io.output("/dev/syslog")
local f = io.open("/boot/cfg/hostname","rb")
local hostname = computer.address():sub(1,8)
if f then
hostname = f:read("*l")
f:close()
end
os.setenv("HOSTNAME",hostname)
syslog(string.format("Hostname set to %s",hostname))
if fs.exists("/boot/pkg") then
pcall(require,"pkgfs")
end
2020-03-17 10:31:44 -04:00
local pids = {}
local rc = require "rc"
for k,v in pairs(rc.cfg.enabled) do
pids[v] = -1
2020-03-17 10:31:44 -04:00
end
while true do
for k,v in pairs(pids) do
if not os.taskInfo(v) then
syslog("Starting service "..k)
pids[k] = rc.start(k)
2020-03-17 10:31:44 -04:00
end
end
coroutine.yield()
end
end, "init")
2019-10-27 08:34:02 -04:00
os.sched()