1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-25 12:42:10 -05:00

Compare commits

..

No commits in common. "026f2524e681fb5035467846ef4c493f95c1f35f" and "82decfabf964c1e9637290995cd023a0f8def025" have entirely different histories.

3 changed files with 5 additions and 6 deletions

View File

@ -24,7 +24,7 @@ local function saveConfig()
end end
function rc.load(name,force) -- string boolean -- table -- Attempts to load service *name*, and if *force* is true, replaces the current instance. function rc.load(name,force) -- string boolean -- table -- Attempts to load service *name*, and if *force* is true, replaces the current instance.
if not service[name] or force then if not package.loaded[name] or force then
for d in rc.paths:gmatch("[^\n]+") do for d in rc.paths:gmatch("[^\n]+") do
if fs.exists(d.."/"..name..".lua") then if fs.exists(d.."/"..name..".lua") then
service[name] = runfile(d.."/"..name..".lua") service[name] = runfile(d.."/"..name..".lua")

View File

@ -34,7 +34,7 @@ end
function print(...) -- Writes each argument to the default output stream, separated by space. function print(...) -- Writes each argument to the default output stream, separated by space.
for k,v in ipairs({...}) do for k,v in ipairs({...}) do
io.write((k>1 and "\t" or "")..tostring(v)) io.write(tostring(v).."\t")
end end
io.write("\n") io.write("\n")
end end

View File

@ -1,8 +1,7 @@
local fsmanager = {} local fsmanager = {}
fsmanager.filesystems = {} fsmanager.filesystems = {}
local run = true local run = true
local function mount(addr)
function fsmanager.mount(addr)
dest = "/" .. (component.invoke(addr,"getLabel") or "mnt/"..addr:sub(1,3)) dest = "/" .. (component.invoke(addr,"getLabel") or "mnt/"..addr:sub(1,3))
syslog("Mounting "..addr.." to "..dest) syslog("Mounting "..addr.." to "..dest)
fs.makeDirectory(dest) fs.makeDirectory(dest)
@ -18,12 +17,12 @@ function fsmanager.start()
run = true run = true
return os.spawn(function() return os.spawn(function()
for addr, _ in component.list("filesystem") do for addr, _ in component.list("filesystem") do
fsmanager.mount(addr) mount(addr)
end end
while run do while run 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
fsmanager.mount(tE[2]) mount(tE[2])
elseif tE[1] == "component_removed" and fsmanager.filesystems[tE[2]] and tE[3] == "filesystem" then elseif tE[1] == "component_removed" and fsmanager.filesystems[tE[2]] and tE[3] == "filesystem" then
syslog("Unmounting "..tE[2].." from "..fsmanager.filesystems[tE[2]]) syslog("Unmounting "..tE[2].." from "..fsmanager.filesystems[tE[2]])
fs.umount(fsmanager.filesystems[tE[2]]) fs.umount(fsmanager.filesystems[tE[2]])