44 lines
1.4 KiB
Lua
44 lines
1.4 KiB
Lua
do
|
|
local C=0
|
|
for c in component.list("filesystem") do
|
|
if c == computer.tmpAddress() then
|
|
fs.mount("tmp",component.proxy(c))
|
|
log(c:sub(1,8).." mounted as tmp")
|
|
end
|
|
if c == computer.getBootAddress() then
|
|
fs.mount("boot",component.proxy(c))
|
|
log(c:sub(1,8).." mounted as boot")
|
|
end
|
|
if component.invoke(c,"getLabel") ~= "" and component.invoke(c,"getLabel") ~= nil then
|
|
fs.mount(component.invoke(c,"getLabel"),component.proxy(c))
|
|
log(c:sub(1,8).." mounted as "..component.invoke(c,"getLabel"))
|
|
end
|
|
fs.mount("fs"..string.format("%02d",C),component.proxy(c))
|
|
log(c:sub(1,8).." mounted as fs"..string.format("%02d",C))
|
|
C=C+1
|
|
end
|
|
if component.type(computer.getBootAddress()) ~= "filesystem" then
|
|
fs.mount("boot",component.proxy(computer.tmpAddress()))
|
|
log(computer.tmpAddress():sub(1,8).." mounted as boot")
|
|
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
|