mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-22 03:54:20 -05:00
Compare commits
5 Commits
82decfabf9
...
026f2524e6
Author | SHA1 | Date | |
---|---|---|---|
|
026f2524e6 | ||
|
e20123b527 | ||
|
efdb01328f | ||
|
a05e19b545 | ||
|
00d4472f91 |
@ -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 package.loaded[name] or force then
|
if not service[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")
|
||||||
|
@ -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(tostring(v).."\t")
|
io.write((k>1 and "\t" or "")..tostring(v))
|
||||||
end
|
end
|
||||||
io.write("\n")
|
io.write("\n")
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
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)
|
||||||
@ -17,12 +18,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
|
||||||
mount(addr)
|
fsmanager.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
|
||||||
mount(tE[2])
|
fsmanager.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]])
|
||||||
|
Loading…
Reference in New Issue
Block a user