mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-22 12:04:20 -05:00
updated fsmanager and included it in the default init
This commit is contained in:
parent
a219b5603e
commit
256e05233a
@ -1 +1,2 @@
|
|||||||
getty.lua
|
getty.lua
|
||||||
|
fsmanager.lua
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
|
local function mount(addr)
|
||||||
|
dest = component.invoke(addr,"getLabel") or "mnt/"..addr:sub(1,3)
|
||||||
|
dest = "/"..dest
|
||||||
|
syslog("Mounting "..addr.." to "..dest)
|
||||||
|
fs.makeDirectory(dest)
|
||||||
|
local w,r = fs.mount(dest,component.proxy(addr))
|
||||||
|
if not w then
|
||||||
|
syslog("Failed to mount: "..r)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for addr, _ in component.list("filesystem") do
|
||||||
|
mount(addr)
|
||||||
|
end
|
||||||
while true do
|
while true do
|
||||||
local tE = {coroutine.yield()}
|
local tE = {coroutine.yield()}
|
||||||
if tE[1] == "component_added" and tE[3] == "filesystem" then
|
if tE[1] == "component_added" and tE[3] == "filesystem" then
|
||||||
local w, doesExist = pcall(fs.exists,"/"..tE[2]:sub(1,3))
|
mount(tE[2])
|
||||||
if not w or not doesExist then
|
|
||||||
fs.mounts[tE[2]:sub(1,3)] = component.proxy(tE[2])
|
|
||||||
end
|
|
||||||
elseif tE[1] == "component_removed" and tE[3] == "filesystem" then
|
elseif tE[1] == "component_removed" and tE[3] == "filesystem" then
|
||||||
fs.mounts[tE[2]:sub(1,3)] = nil
|
fs.umount("/mnt/"..tE[2]:sub(1,3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user