immibis

update

Aug 23rd, 2013
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. if not fs.exists("/upd_url") then
  2.   print("Enter filename:")
  3.   local url = "http://immibis.com/ccfiles/" .. read()
  4.   local c = http.get(url)
  5.   if not c then error("failed to download "..url, 0) end
  6.   c.close()
  7.   local f = fs.open("/upd_url","w")
  8.   f.write(url)
  9.   f.close()
  10. end
  11.  
  12. local f = fs.open("/upd_url", "r")
  13. local url = f.readAll()
  14. f.close()
  15.  
  16. local c = http.get(url)
  17. if c then
  18.  local d = c.readAll()
  19.  c.close()
  20.  local f = fs.open("/upd_code", "w")
  21.  f.write(d)
  22.  f.close()
  23. else
  24.  print("Download failed from "..url)
  25. end
  26.  
  27. shell.run("/upd_code")
Advertisement
Add Comment
Please, Sign In to add comment