Advertisement
ComputerMan123

[Lua] CarbonOS Installer (Beta)

Sep 22nd, 2016
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local files = {
  2. [1] = {
  3. "/System/Images/boot",
  4. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/Images/boot"
  5. },
  6. [2] = {
  7. "startup",
  8. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/startup"
  9. },
  10. [3] = {
  11. "/Programs/LuaIDE/program",
  12. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Programs/LuaIDE/program"
  13. },
  14. [4] = {
  15. "/Programs/Sketch/program",
  16. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Programs/Sketch/program"
  17. },
  18. [5] = {
  19. "/Desktop/LuaIDE",
  20. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Desktop/LuaIDE"
  21. },
  22. [6] = {
  23. "/Desktop/Sketch",
  24. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/Desktop/Sketch"
  25. },
  26. [7] = {
  27. "/System/Images/desktop",
  28. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/Images/desktop"
  29. },
  30. [8] = {
  31. "/System/settings",
  32. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/settings"
  33. },
  34. [9] = {
  35. "/System/autoupdater",
  36. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/autoupdater"
  37. },
  38. [10] = {
  39. "/System/.version",
  40. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/.version"
  41. },
  42. [11] = {
  43. "/os",
  44. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/os"
  45. },
  46. [12] = {
  47. "/System/APIs/crasher",
  48. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/APIs/crasher"
  49. },
  50. [13] = {
  51. "/System/APIs/sha256",
  52. "https://raw.githubusercontent.com/Carbon-OS/CarbonOS/beta/System/APIs/sha256"
  53. }
  54. }
  55. if term.isColor() == false then
  56. print("Sorry, But you need an Advanced PC to run this OS!")
  57. else
  58. term.setBackgroundColor(colors.gray)
  59. term.clear()
  60. term.setCursorPos(16,8)
  61. print("Welcome to Carbon!")
  62. term.setCursorPos(11,10)
  63. print("A Fast, Simple, and Secure OS")
  64. term.setCursorPos(21,16)
  65. term.setBackgroundColor(colors.lightGray)
  66. print("Install")
  67. while true do
  68. local event, side, x, y = os.pullEvent("mouse_click")
  69. if x >= 21 and x < 28 and y == 16 then
  70. term.clear()
  71. shell.run("mkdir", "System")
  72. term.setCursorPos(1,1)
  73. textutils.slowPrint("Installing Carbon...")
  74. local req
  75. local code
  76. local file
  77. for k,v in pairs(files) do
  78. print("Downloading ", v[2], "...")
  79. req = http.get(v[2])
  80. if req ~= nil then
  81. code = req.readAll()
  82. req.close()
  83. else
  84. print("Failed!")
  85. end
  86.  
  87. file = fs.open(v[1], "w")
  88. file.write(code)
  89. file.close()
  90. end
  91. file = fs.open("/System/.firstuse", "w")
  92. file.write("true")
  93. file.close()
  94. print("Done!")
  95. print("Rebooting...")
  96. os.sleep(1)
  97. os.reboot()
  98.  
  99. end
  100. end
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement