Corbinhol

ClientInstaller

Feb 26th, 2022 (edited)
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. ---
  2. --- Generated by EmmyLua(https://github.com/EmmyLua)
  3. --- Created by holco.
  4. --- DateTime: 2/26/2022 7:06 PM
  5. ---
  6. local filesystem = require("filesystem");
  7. local component = require("component");
  8. local computer = require("computer");
  9.  
  10. function tablelength(T)
  11. local count = 0
  12. for _ in pairs(T) do count = count + 1 end
  13. return count
  14. end
  15.  
  16. print("Server Client Installer by Yaggy Corp");
  17. print("Are you sure you would like to install the CLIENT on this device?");
  18. local input = io.read();
  19. if input == "y" then
  20. local ifRun = true;
  21. print("Beginning Installation...")
  22. print("Verifying Computer...Please Make Sure ALL components are successfully installed");
  23. local redstoneComponents = tablelength(component.list("redstone"));
  24. local hv_capacitors = tablelength(component.list("ie_hv_capacitor"));
  25. local tanks = tablelength(component.list("ie_tank"));
  26. local currentTransformers = tablelength(component.list("ie_current_transformer"));
  27. if redstoneComponents > 7 then
  28. print("Too Many Redstone I/Os Attached To System")
  29. ifRun = false;
  30. elseif redstoneComponents < 7 then
  31. print("Not Enough Redstone I/Os Attached To System")
  32. ifRun = false;
  33. end
  34.  
  35. if hv_capacitors > 24 then
  36. print("Too Many HV Capacitors found on system")
  37. print(hv_capacitors);
  38. ifRun = false;
  39. elseif hv_capacitors < 24 then
  40. print("Not Enough HV Capacitors found on system")
  41. ifRun = false;
  42. end
  43.  
  44. if tanks > 2 then
  45. print("Too Many Tanks Attached To System")
  46. ifRun = false;
  47. elseif tanks < 2 then
  48. print("Not Enough Tanks Attached To System")
  49. print(tanks);
  50. ifRun = false;
  51. end
  52.  
  53. if currentTransformers > 2 then
  54. print("Too Many Current Transformers Attached To System")
  55. ifRun = false;
  56. elseif currentTransformers < 2 then
  57. print("Not Enough Transformers Attached To System")
  58. ifRun = false;
  59. end
  60.  
  61. if component.isAvailable == false then print("Wireless Network Card Not Found On System..."); ifRun = false; end
  62.  
  63. if ifRun then
  64. print("Downloading Client Files...");
  65. if filesystem.exists("/home/Client.lua") then print("Client.lua already exists on device...deleting"); filesystem.remove("/home/Client.lua"); end
  66. os.execute("pastebin get EeijtFNZ /home/Client.lua");
  67. local file = io.open("/autorun.lua", "w");
  68. file:write("os.execute(\"/home/Client.lua\")");
  69. file:close()
  70. print("Client Software Successfully Installed");
  71. print("Would you like to reboot?");
  72. local input = io.read();
  73. if input == "y" then computer.shutdown(true); end
  74. else
  75. print("Error(s) have been found...Aborting.");
  76. end
  77. else
  78. print("Aborting...")
  79. end
Add Comment
Please, Sign In to add comment