local args = {...} local thread = require("thread") local ipc = require("ipc") local fs = require("filesystem") if not args[1] then local svcs = {} for f in fs.list("/etc/ksysinit/services") do svcs[#svcs+1] = f end print(table.concat(svcs, ", ")) return 0 elseif args[1] and not args[2] then local svcs = {} for f in fs.list("/etc/ksysinit/services/"..args[1]) do svcs[#svcs+1] = f end print(table.concat(svcs, ", ")) return 0 elseif not fs.exists("/etc/ksysinit/services/"..args[1].."/"..args[2]) then io.stderr:write("hook `"..args[2].."' not found for `"..args[1].."'\n") return 1 else local proc = thread.get("/sbin/init") ipc.send(proc, "svcrun", args[1], args[2]) end