Compare commits
No commits in common. "67de47ebd437d3b31cd7d2e66b90776aa918b678" and "928a1db13c8662b8ea366301ea13cc1629ba9c52" have entirely different histories.
67de47ebd4
...
928a1db13c
@ -1,7 +1,6 @@
|
||||
local computer = require "computer"
|
||||
local minitel = require "minitel"
|
||||
local event = require "event"
|
||||
local ufs = require "unionfs"
|
||||
local rpc = require "rpc"
|
||||
local netutil = {}
|
||||
|
||||
@ -10,7 +9,6 @@ function netutil.importfs(host,rpath,lpath) -- import filesystem *rpath* from *h
|
||||
function px.getLabel()
|
||||
return host..":"..rpath
|
||||
end
|
||||
px.address = host..":"..rpath
|
||||
return fs.mount(lpath,px)
|
||||
end
|
||||
|
||||
@ -18,7 +16,7 @@ function netutil.exportfs(path) -- export the directory *path* over RPC
|
||||
local path = "/"..table.concat(fs.segments(path),"/")
|
||||
local px = ufs.create(path)
|
||||
for k,v in pairs(px) do
|
||||
rpc.register(path.."_"..k,v)
|
||||
rpcs.register(path.."_"..k,v)
|
||||
print(path.."_"..k)
|
||||
end
|
||||
return true
|
||||
|
@ -4,7 +4,7 @@ local rc = {}
|
||||
rc.pids = {}
|
||||
local service = {}
|
||||
local cfg = {}
|
||||
cfg.enabled = {"getty","minitel"}
|
||||
cfg.enabled = {}
|
||||
|
||||
local function loadConfig()
|
||||
local f = io.open("/boot/cfg/rc.cfg","rb")
|
||||
@ -37,10 +37,8 @@ end
|
||||
|
||||
function rc.stop(name,...)
|
||||
if not service[name] then return false, "service not found" end
|
||||
if service[name].stop then
|
||||
service[name].stop(...)
|
||||
coroutine.yield()
|
||||
end
|
||||
if rc.pids[name] then
|
||||
os.kill(rc.pids[name])
|
||||
end
|
||||
@ -65,7 +63,6 @@ function rc.enable(name)
|
||||
for k,v in pairs(cfg.enabled) do
|
||||
if v == name then return false end
|
||||
end
|
||||
cfg.enabled[#cfg.enabled+1] = name
|
||||
saveConfig()
|
||||
end
|
||||
function rc.disable(name)
|
||||
|
@ -37,8 +37,8 @@ function rpc.call(hostname,fn,...)
|
||||
local rt = {}
|
||||
repeat
|
||||
local _, from, port, data = event.pull(30, "net_msg", hostname, rpc.port)
|
||||
rt = serial.unserialize(tostring(data)) or {}
|
||||
until (type(rt) == "table" and rt[1] == rv) or computer.uptime() > st + 30
|
||||
rt = serial.unserialize(data) or {}
|
||||
until rt[1] == rv or computer.uptime() > st + 30
|
||||
if table.remove(rt,1) == rv then
|
||||
return table.unpack(rt)
|
||||
end
|
||||
|
@ -87,7 +87,6 @@ function shutil.mount(addr,path)
|
||||
if not addr then
|
||||
local mt = fs.mounts()
|
||||
for k,v in pairs(mt) do
|
||||
v = "/"..table.concat(fs.segments(v),"/")
|
||||
print(tostring(fs.address(v)).." on "..tostring(v).." type "..fs.type(v))
|
||||
end
|
||||
else
|
||||
|
@ -61,8 +61,6 @@ function devfs.component.seek(fd,...)
|
||||
end
|
||||
function devfs.component.remove(fname)
|
||||
end
|
||||
devfs.component.address = "devfs"
|
||||
devfs.component.type = "devfs"
|
||||
|
||||
function devfs.register(fname,fopen) -- Register a new devfs node with the name *fname* that will run the function *fopen* when opened. This function should return a function for read, a function for write, function for close, and optionally, a function for seek, in that order.
|
||||
devfs.files[fname] = fopen
|
||||
|
@ -111,7 +111,7 @@ function fs.address(path) -- returns the address of the filesystem at a given pa
|
||||
end
|
||||
function fs.type(path) -- returns the component type of the filesystem at a given path, if applicable
|
||||
local fsi,_ = fs.resolve(path)
|
||||
return fsmounts[fsi].type or "filesystem"
|
||||
return fsmounts[fsi].type
|
||||
end
|
||||
|
||||
fsmounts["/"] = component.proxy(computer.tmpAddress())
|
||||
|
@ -11,9 +11,6 @@ end
|
||||
for addr, _ in component.list("filesystem") do
|
||||
mount(addr)
|
||||
end
|
||||
|
||||
function start()
|
||||
return os.spawn(function()
|
||||
while true do
|
||||
local tE = {coroutine.yield()}
|
||||
if tE[1] == "component_added" and tE[3] == "filesystem" then
|
||||
@ -22,5 +19,3 @@ function start()
|
||||
fs.umount("/mnt/"..tE[2]:sub(1,3))
|
||||
end
|
||||
end
|
||||
end,"fsmanager")
|
||||
end
|
||||
|
@ -1,8 +1,6 @@
|
||||
local lastkey = computer.uptime()
|
||||
local state = true
|
||||
local delay = 60
|
||||
function start()
|
||||
return os.spawn(function()
|
||||
while true do
|
||||
tEv = {coroutine.yield()}
|
||||
if tEv[1] == "key_down" then
|
||||
@ -21,5 +19,3 @@ function start()
|
||||
state = false
|
||||
end
|
||||
end
|
||||
end,"screenblank")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user