Advertisement
tima_gt

trepo

Oct 23rd, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. print("tima repository 1.0")
  2. write("Program: ")
  3. var = read()
  4. print("Connecting to repository...")
  5. d = "http://192.168.1.129:8000/repository/"
  6. e = var
  7. local a = http.get(d..e)
  8. c = a.readAll()
  9. if (c == "") or (c == " ") then
  10. error("file not found!")
  11. end
  12. a.close()
  13. if (fs.exists(var)) or (fs.exists("/timaprog/"..var)) then
  14. error("file exists")
  15. end
  16. if c == "" then
  17. error("file not found!")
  18. else
  19. b = fs.open(var, "w")
  20. b.writeLine(c)
  21. b.close()
  22. as = "timaprog/"
  23. if fs.exists(as..var) then
  24. print("program ", var, " is exists.")
  25. else
  26. print("Downloading packages...")
  27. shell.run("mkdir /timaprog")
  28. print("installing packages...")
  29. shell.run("cp "..var.." /timaprog")
  30. shell.run("rm "..var)
  31. print("Done!")
  32. end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement