Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- PotatOS Tau has recently switched from a table format for disk signatures to a shiny, new hexadecimal one.
- Existing disks can be upgraded with this utility.
- ]]
- local function hexize(sig)
- local out = ""
- for _, v in pairs(sig) do
- out = out .. string.format("%.2x", v)
- end
- return out
- end
- local function fwrite(n, c)
- local f = fs.open(n, "w")
- f.write(c)
- f.close()
- end
- local function fread(n)
- local f = fs.open(n, "r")
- local out = f.readAll()
- f.close()
- return out
- end
- print "Place the disk to be upgraded in a connected disk drive."
- local _, side = os.pullEvent "disk"
- local path = fs.combine(disk.getMountPath(side), "signature")
- if not fs.exists(path) then error "Inserted disk does not contain a signature!" end
- fwrite(path, hexize(textutils.unserialize(fread(path))))
- print "Done!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement