Compare commits
No commits in common. "d40ce731ef0187adb1be2f6098f3c651a32aba6e" and "216e0a15c67177cc8ef3232eb7160876885abce6" have entirely different histories.
d40ce731ef
...
216e0a15c6
17
lib/rc.lua
17
lib/rc.lua
@ -1,7 +1,6 @@
|
||||
local serial = require "serialization"
|
||||
|
||||
local rc = {}
|
||||
rc.paths = "/boot/service\n/pkg/service"
|
||||
rc.pids = {}
|
||||
local service = {}
|
||||
local cfg = {}
|
||||
@ -23,21 +22,6 @@ local function saveConfig()
|
||||
return true
|
||||
end
|
||||
|
||||
function rc.load(name,force) -- string boolean -- table -- Attempts to load service *name*, and if *force* is true, replaces the current instance.
|
||||
if not package.loaded[name] or force then
|
||||
for d in rc.paths:gmatch("[^\n]+") do
|
||||
if fs.exists(d.."/"..name..".lua") then
|
||||
service[name] = runfile(d.."/"..name..".lua")
|
||||
end
|
||||
end
|
||||
end
|
||||
if service[name] then
|
||||
return service[name]
|
||||
end
|
||||
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)
|
||||
@ -55,7 +39,6 @@ function rc.load(name,force) -- string boolean -- table -- Attempts to load serv
|
||||
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
|
||||
|
@ -37,7 +37,7 @@ local function spawnShell(fin,fout)
|
||||
io.input(fin)
|
||||
io.output(fout):setvbuf("no")
|
||||
print(_OSVERSION.." - "..tostring(math.floor(computer.totalMemory()/1024)).."K RAM")
|
||||
return os.spawn(function() local w,r = pcall(shell.interactive) if not w then syslog(r) end end, "shell: "..tostring(fin))
|
||||
return os.spawn(shell.interactive, "shell: "..tostring(fin))
|
||||
end
|
||||
|
||||
local function allocate()
|
||||
@ -77,4 +77,3 @@ function stop()
|
||||
os.kill(basepid)
|
||||
basepid = nil
|
||||
end
|
||||
return {start=start,stop=stop}
|
||||
|
@ -271,4 +271,3 @@ function del_route(to)
|
||||
cfg.sroutes[to] = nil
|
||||
saveconfig()
|
||||
end
|
||||
return {start=start,stop=stop,set=set,set_route=set_route,del_route=del_route}
|
||||
|
Loading…
Reference in New Issue
Block a user