Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- computer = require("computer")
- fs = require("filesystem")
- print("Подготовка к установке prettydisks...")
- pddata = [[event = require("event")
- fs = require("filesystem")
- computer = require("computer")
- local bootaddress = computer.getBootAddress()
- local tmpaddress = computer.tmpAddress()
- diskIndexes = "QWERTYUIOPSDFGHJKLXCVBNM"
- di = {}
- disks = {}
- for k=1,#diskIndexes do
- di[k] = string.sub(diskIndexes,k,k)..":"
- end
- table.sort(di)
- function onFilesystemAdd(_,address,type)
- if type =="filesystem" then
- for v,k in ipairs(di) do
- for k,address2 in pairs(disks) do
- if address2 == address then
- return
- end
- end
- if not disks[k] and disks[k] ~= address then
- if bootaddress ==address then k = "A:" elseif tmpaddress == address then k = "Z:" end
- fs.mount(address,k)
- disks[k] = address
- end
- end
- end
- end
- function onFilesystemRemove(_,address,type)
- if type == "filesystem" then
- for n,s in pairs(disks) do
- if s==address then
- fs.umount(n)
- disks[n] = nil
- end
- end
- end
- end
- function computer.getDL()
- return disks
- end
- event.listen("component_added",onFilesystemAdd)
- event.listen("component_removed",onFilesystemRemove)]]
- getDLdata = [[computer = require("computer")
- print("Пишутся метки и адреса дисков... Заметьте, что загрузочный диск всегда будет \"A:\", а временная всегда \"Z:\"")
- for n,s in pairs(computer.getDL()) do
- print(n,s)
- end
- print("Готово.")]]
- print("Подготовка окончена. Устанавливается...")
- do
- local file = fs.open("boot/prettydisks.lua", "w")
- file:write(pddata)
- file:close()
- end
- do
- local file = fs.open("bin/getDL.lua","w")
- file:write(getDLdata)
- file:close()
- end
- print("Установка окончена! Перезагружаем комп!")
- os.sleep(5)
- computer.shutdown(true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement