Advertisement
magik6000

MPT 1.2 installer

Jun 5th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. local function download(file, url)
  2. if file then print("get:"..file) else print("get:"..url) end
  3. local res = http.get(url)
  4. if res then
  5. if file ~= nil then
  6. fs.delete(file)
  7. fs.makeDir(file)
  8. fs.delete(file)
  9. local fhnd = fs.open(file, "w");
  10. if fhnd then
  11. fhnd.write(res.readAll())
  12. fhnd.close()
  13. downloaded = downloaded + 1
  14. rState()
  15. return res.readAll()
  16. else
  17. res.close()
  18. error("Could not open "..file.." for writing")
  19. end
  20. else
  21. rState()
  22. downloaded = downloaded + 1
  23. return res.readAll()
  24. end
  25. res.close()
  26. else
  27. local rr = 7
  28. if r then if rr == 1 then return nil end rr = r end
  29. print("WARNING:Download failed, Retry in 5sec")
  30. print("\n",url)
  31. os.sleep(5)
  32.  
  33. return download(file,url,rr-1)
  34. end
  35. end
  36.  
  37. download("/feh1caShaezuZ4AP.temp", "http://cc.nativehttp.org/ppa/file/mpt/mpt-install/install-cc")
  38. shell.run("feh1caShaezuZ4AP.temp")
  39. shell.run("rm feh1caShaezuZ4AP.temp")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement