Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _tarurl = "https://f.cloudninja.pw/vorbani/tar.lua"
- local function urequire(url)
- local req, err, fail = http.get(url)
- if not req then
- error(err.." "..(fail or ""))
- end
- local contents = req.readAll()
- local tbl = load(contents,"tar.lua","t")()
- return tbl
- end
- local _tar = urequire(_tarurl)
- req,err,fail = http.get("https://mathis.pw/download")
- if not req then
- error(err.." "..(fail or ""))
- end
- local tarFile = req.readAll()
- local tbl = _tar.list(tarFile)
- term.clear()
- term.setCursorPos(1,1)
- local topWin = window.create(term.native(),1,1,51,2)
- local botWin = window.create(term.native(),1,5,51,15)
- print("Vorbani will now be installed")
- print("The computer will reboot when done ")
- term.redirect(botWin)
- local TIME = os.time(os.date("*t"))
- for k,v in pairs(tbl) do
- botWin.clear()
- botWin.setCursorPos(1,1)
- local percent = math.floor(k/#tbl*100)
- print(tostring(percent).."% Completed")
- if v:sub(#v) ~= "/" and not v:find("/") then
- print("Creating file")
- print(v)
- local _file = _tar.open(tarFile,v)
- local data = _tar.read(_file)
- local file = fs.open("/"..v,"wb")
- file.write(data)
- file.close()
- elseif v:sub(#v) == "/" then
- print("Creating directory")
- print(v)
- fs.makeDir("/"..v)
- else
- local x,y = v:find("/[^/]*$")
- local fName = v:sub(x+1)
- local path = v:sub(1,x)
- print("Creating file")
- print(path..fName)
- local _file = _tar.open(tarFile,v)
- local data = _tar.read(_file)
- local file = fs.open("/"..path..fName,"wb")
- file.write(data)
- file.close()
- end
- if k%5 == 0 then
- sleep(0)
- end
- end
- botWin.clear()
- botWin.setCursorPos(1,1)
- print("Install completed in "..(os.time(os.date("*t")))-TIME.." seconds")
- sleep(2)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement