1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-23 10:38:05 +11:00
OC-Minitel/MTFS/OpenOS/usr/bin/importfs.lua
2020-10-12 18:09:06 +11:00

26 lines
505 B
Lua

local fs = require "filesystem"
local rpc = require "rpc"
local tA = {...}
local rpath, lpath = tA[1], tA[2], tA[3]
if #tA < 2 then
print("Usage: importfs <remote path> <local path>")
return
end
local function parsePath(path)
return path:match("(.+):(.+)")
end
local host, saddr = parsePath(rpath)
local px = rpc.proxy(host,"fs_"..saddr.."_")
local mc = 0
for k,v in pairs(px) do
mc = mc + 1
end
if mc < 1 then
error("no such remote filesystem: "..addr)
end
px.address = rpath
fs.mount(px, lpath)