|
|
@@ -5,7 +5,7 @@ rc.paths = "/boot/service\n/pkg/service" |
|
|
|
rc.pids = {} |
|
|
|
local service = {} |
|
|
|
local cfg = {} |
|
|
|
cfg.enabled = {"getty","minitel"} |
|
|
|
cfg.enabled = {"getty","minitel","fsmanager"} |
|
|
|
|
|
|
|
local function loadConfig() |
|
|
|
local f = io.open("/boot/cfg/rc.cfg","rb") |
|
|
@@ -37,26 +37,6 @@ function rc.load(name,force) -- string boolean -- table -- Attempts to load serv |
|
|
|
return false, "unable to load service "..name |
|
|
|
end |
|
|
|
|
|
|
|
--[[ |
|
|
|
function rc.load(name,force) -- string boolean -- table -- Attempts to load service *name*, and if *force* is true, replaces the current instance. |
|
|
|
if force then |
|
|
|
rc.stop(name) |
|
|
|
service[name] = nil |
|
|
|
end |
|
|
|
if service[name] then return true end |
|
|
|
service[name] = setmetatable({},{__index=_G}) |
|
|
|
local f |
|
|
|
f = io.open("/boot/service/"..name..".lua","rb") |
|
|
|
if not f then |
|
|
|
pcall(require,"pkgfs") |
|
|
|
f = io.open("/pkg/service/"..name..".lua","rb") |
|
|
|
end |
|
|
|
local res = load(f:read("*a"),name,"t",service[name])() |
|
|
|
f:close() |
|
|
|
return res |
|
|
|
end |
|
|
|
]] |
|
|
|
|
|
|
|
function rc.stop(name,...) -- string -- boolean string -- Stops service *name*, supplying *...* to the stop function. Returns false and a reason if this fails. |
|
|
|
if not service[name] then return false, "service not found" end |
|
|
|
if service[name].stop then |
|
|
|