1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-27 04:18:05 +11:00
OC-Minitel/MTFS/OpenOS/usr/bin/exportfs.lua

18 lines
476 B
Lua

local fsproxy = require "fsproxy"
local fs = require "filesystem"
local shell = require "shell"
local rpc = require "rpc"
local tA, tO = shell.parse(...)
if #tA < 1 then
print("Usage: exportfs <directory> [-d] [--rw] [--name=<name>]")
return
end
local px = fsproxy.new(tA[1], not tO.rw)
local name = tO.name or tA[1]
for l,m in pairs(px) do
m = not tO.d and m or nil
rpc.register("fs_"..name.."_"..l,m)
end
print(string.format("%s (%s)", name, (tO.rw and "rw") or "ro"))