remove old rc.load implementation

This commit is contained in:
Izaya 2023-08-04 20:29:09 +10:00
parent e9e824b42d
commit 2e021ff6d5

View File

@ -5,7 +5,7 @@ rc.paths = "/boot/service\n/pkg/service"
rc.pids = {} rc.pids = {}
local service = {} local service = {}
local cfg = {} local cfg = {}
cfg.enabled = {"getty","minitel"} cfg.enabled = {"getty","minitel","fsmanager"}
local function loadConfig() local function loadConfig()
local f = io.open("/boot/cfg/rc.cfg","rb") 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 return false, "unable to load service "..name
end 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. 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 not service[name] then return false, "service not found" end
if service[name].stop then if service[name].stop then