made the automount feature a bit less obnoxious (fs00 -> uuid:sub(1,3)

This commit is contained in:
Izaya 2017-09-23 19:13:25 +10:00 committed by Izaya
parent 92a8066890
commit a6e6bb5f6b

View File

@ -1,5 +1,4 @@
do do
local C=0
for c in component.list("filesystem") do for c in component.list("filesystem") do
if c == computer.tmpAddress() then if c == computer.tmpAddress() then
fs.mount("tmp",component.proxy(c)) fs.mount("tmp",component.proxy(c))
@ -13,31 +12,11 @@ do
fs.mount(component.invoke(c,"getLabel"),component.proxy(c)) fs.mount(component.invoke(c,"getLabel"),component.proxy(c))
log(c:sub(1,8).." mounted as "..component.invoke(c,"getLabel")) log(c:sub(1,8).." mounted as "..component.invoke(c,"getLabel"))
end end
fs.mount("fs"..string.format("%02d",C),component.proxy(c)) fs.mount(c:sub(1,3),component.proxy(c))
log(c:sub(1,8).." mounted as fs"..string.format("%02d",C)) log(c:sub(1,8).." mounted as "..c:sub(1,3))
C=C+1
end end
if component.type(computer.getBootAddress()) ~= "filesystem" then if component.type(computer.getBootAddress()) ~= "filesystem" then
fs.mount("boot",component.proxy(computer.tmpAddress())) fs.mount("boot",component.proxy(computer.tmpAddress()))
log(computer.tmpAddress():sub(1,8).." mounted as boot") log(computer.tmpAddress():sub(1,8).." mounted as boot")
end end
if component.type(computer.getBootAddress()) == "tape_drive" then
if tape then
tape.rewind()
local pt = tape.records()
for k,v in ipairs(pt) do
if v[1] == "D" then
print(tostring(k).."\t"..v[1].."\t/boot/"..tape.rrecord(k))
fs.mkdir("/boot/"..tape.rrecord(k))
elseif v[1] == "f" then
local fn,fc = tape.parsefile(tape.rrecord(k))
print(tostring(k).."\t"..v[1].."\t/boot/"..fn)
local f=io.open("/boot/"..fn,"wb")
f:write(fc)
f:close()
end
computer.beep()
end
end
end
end end