Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local drive = peripheral.find("drive")
- if drive then drive.ejectDisk() end
- local t,c,b,a = "///nekOS///", "77800000877", "f", colors.black
- if term.isColor() then c,b,a = "edb00000bde", "7", colors.gray end
- local w,h = term.getSize()
- local function get(code, path)
- path = path or code
- local res = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode(code))
- if not res then return false, "Failed to get paste." end
- local data = res.readAll()
- res.close()
- fs.delete(path)
- local file = fs.open(path, "w")
- file.write(data)
- file.close()
- return true
- end
- local function load(path)
- if not fs.exists(path) then return {} end
- local f = fs.open(path, "r")
- local t = textutils.unserialize(f.readAll())
- f.close()
- return t
- end
- local current,total = 0,0
- local function progress(message)
- local perc = current / total
- local ii = math.floor(perc * w)
- term.setCursorPos(1,h-1)
- term.clearLine()
- term.write(message)
- local perstr = ""..(math.floor(perc * 1000) / 10).."%"
- term.setCursorPos(w-string.len(perstr)+1,h-1)
- term.write(perstr)
- term.setCursorPos(1,h)
- term.clearLine()
- for i=1,ii,1 do term.blit("#","8",b) end
- end
- term.setTextColor(colors.white)
- term.setBackgroundColor(term.isColor() and colors.gray or colors.black)
- term.clear()
- term.setCursorPos(1,1)
- term.setCursorPos(math.floor((w - string.len(t)) / 2), math.floor(h / 2))
- for i=1,#t,1 do
- term.blit(string.sub(t,i,i),string.sub(c,i,i),b)
- sleep(1/5)
- end
- get("ki96M55P", ".manifest")
- local manifest = load(".manifest")
- for k,v in pairs(manifest.Files) do total = total + 1 end
- local x,y = term.getCursorPos()
- for k,v in pairs(manifest.Files) do
- progress("Downloading "..k.."...")
- get(v.Code, k)
- current = current + 1
- sleep(1/total)
- end
- os.reboot()
Add Comment
Please, Sign In to add comment