Advertisement
Alakazard12

temp

Apr 28th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3. textutils.slowPrint("Checking if HTTP is enabled...")
  4. if http then
  5. print("HTTP is enabled!")
  6. else
  7. textutils.slowPrint("HTTP is not enabled.")
  8. textutils.slowPrint("Please enable it.")
  9. return exit
  10. end
  11. sleep(0.5)
  12. programs = {}
  13.  
  14. term.clear()
  15. term.setCursorPos(1,1)
  16. textutils.slowPrint("Please choose a program type.")
  17. repeat
  18. print("")
  19. write("Server/Client: ")
  20. installAnswer = read()
  21. until ((installAnswer == "Server") or (installAnswer == "Client") or (installAnswer == "server") or (installAnswer == "client"))
  22.  
  23. if installAnswer == "Server" then
  24. table.insert(programs, "server")
  25. elseif installAnswer == "Client" then
  26. table.insert(programs, "client")
  27. elseif installAnswer == "server" then
  28. table.insert(programs, "server")
  29. elseif installAnswer == "client" then
  30. table.insert(programs, "client")
  31. end
  32.  
  33. print("Where would you like to download them to?")
  34. print("Default is /")
  35. print("(Press Enter to Skip)")
  36. write("Path: ")
  37. pathAnswer = read()
  38.  
  39. if pathAnswer == "" then
  40. pathAnswer = "/"
  41. end
  42.  
  43. print("Downloading requested programs...")
  44. local getGit = http.get("https://github.com/darkrising/darkprograms/raw/darkprograms/darksecurity/programVersions")
  45. local getGit = getGit.readAll()
  46. NVersion = textutils.unserialize(getGit)
  47.  
  48. for i = 1, #programs do
  49. print("")
  50. write("Downloading: "..programs[i])
  51. getGit = http.get(NVersion[programs[i]].GitURL)
  52. getGit = getGit.readAll()
  53. local file = fs.open(pathAnswer..programs[i], "w")
  54. file.write(getGit)
  55. file.close()
  56. write(".. Done")
  57. sleep(1)
  58. end
  59.  
  60. print("\nPrograms are now downloaded.")
  61. print("Would you like to generate a startup file?")
  62. repeat
  63. write("Y / N: ")
  64. startupAnswer = read()
  65. until ((startupAnswer == "Y") or (startupAnswer == "N") or (startupAnswer == "y") or (startupAnswer == "n"))
  66.  
  67. if startupAnswer == "Y" then
  68. file = fs.open("startup", "w")
  69. file.write("shell.run(\"".. programs[1] .."\")")
  70. elseif startupAnswer == "y" then
  71. file = fs.open("startup", "w")
  72. file.write("shell.run(\"".. programs[1] .."\")")
  73. end
  74.  
  75. print("\nDone!")
  76. print("Thanks for choosing DarkPrograms for all your programming needs!")
  77. print("")
  78. textutils.slowPrint("Computer will now restart...")
  79. sleep(1.5)
  80. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement