mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-24 20:27:39 -05:00
Compare commits
5 Commits
82decfabf9
...
026f2524e6
Author | SHA1 | Date | |
---|---|---|---|
|
026f2524e6 | ||
|
e20123b527 | ||
|
efdb01328f | ||
|
a05e19b545 | ||
|
00d4472f91 |
@ -24,7 +24,7 @@ local function saveConfig()
|
||||
end
|
||||
|
||||
function rc.load(name,force) -- string boolean -- table -- Attempts to load service *name*, and if *force* is true, replaces the current instance.
|
||||
if not package.loaded[name] or force then
|
||||
if not service[name] or force then
|
||||
for d in rc.paths:gmatch("[^\n]+") do
|
||||
if fs.exists(d.."/"..name..".lua") then
|
||||
service[name] = runfile(d.."/"..name..".lua")
|
||||
|
@ -34,7 +34,7 @@ end
|
||||
|
||||
function print(...) -- Writes each argument to the default output stream, separated by space.
|
||||
for k,v in ipairs({...}) do
|
||||
io.write(tostring(v).."\t")
|
||||
io.write((k>1 and "\t" or "")..tostring(v))
|
||||
end
|
||||
io.write("\n")
|
||||
end
|
||||
|
@ -1,7 +1,8 @@
|
||||
local fsmanager = {}
|
||||
fsmanager.filesystems = {}
|
||||
local run = true
|
||||
local function mount(addr)
|
||||
|
||||
function fsmanager.mount(addr)
|
||||
dest = "/" .. (component.invoke(addr,"getLabel") or "mnt/"..addr:sub(1,3))
|
||||
syslog("Mounting "..addr.." to "..dest)
|
||||
fs.makeDirectory(dest)
|
||||
@ -17,12 +18,12 @@ function fsmanager.start()
|
||||
run = true
|
||||
return os.spawn(function()
|
||||
for addr, _ in component.list("filesystem") do
|
||||
mount(addr)
|
||||
fsmanager.mount(addr)
|
||||
end
|
||||
while run do
|
||||
local tE = {coroutine.yield()}
|
||||
if tE[1] == "component_added" and tE[3] == "filesystem" then
|
||||
mount(tE[2])
|
||||
fsmanager.mount(tE[2])
|
||||
elseif tE[1] == "component_removed" and fsmanager.filesystems[tE[2]] and tE[3] == "filesystem" then
|
||||
syslog("Unmounting "..tE[2].." from "..fsmanager.filesystems[tE[2]])
|
||||
fs.umount(fsmanager.filesystems[tE[2]])
|
||||
|
Loading…
Reference in New Issue
Block a user