Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function download(file, url)
- if file then print("get:"..file) else print("get:"..url) end
- local res = http.get(url)
- if res then
- if file ~= nil then
- fs.delete(file)
- fs.makeDir(file)
- fs.delete(file)
- local fhnd = fs.open(file, "w");
- if fhnd then
- fhnd.write(res.readAll())
- fhnd.close()
- downloaded = downloaded + 1
- rState()
- return res.readAll()
- else
- res.close()
- error("Could not open "..file.." for writing")
- end
- else
- rState()
- downloaded = downloaded + 1
- return res.readAll()
- end
- res.close()
- else
- local rr = 7
- if r then if rr == 1 then return nil end rr = r end
- print("WARNING:Download failed, Retry in 5sec")
- print("\n",url)
- os.sleep(5)
- return download(file,url,rr-1)
- end
- end
- download("/feh1caShaezuZ4AP.temp", "http://cc.nativehttp.org/ppa/file/mpt/mpt-install/install-cc")
- shell.run("feh1caShaezuZ4AP.temp")
- shell.run("rm feh1caShaezuZ4AP.temp")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement