Advertisement
CCCoder

LimeFyre BETA Installer

Jul 22nd, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.36 KB | None | 0 0
  1. --LOAD SIMPLE FUNCTIONS
  2. local function centerPrint(text,y,distance)
  3. if text == nil then text = "Hello World!" end
  4. if y == nil then y = 1 end
  5. if distance == nil then distance = 0 end
  6. local dx, dy = term.getSize()
  7. term.setCursorPos(dx/2-#text/2-distance,y)
  8. print(text)
  9. end
  10.  
  11. local function clear()
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. end
  15.  
  16. local function bg(color)
  17. term.setBackgroundColor(color)
  18. end
  19.  
  20. local function text(color)
  21. term.setTextColor(color)
  22. end
  23.  
  24. local function dl(path,dest)
  25. local resp = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode(path))
  26. if resp then
  27. f = fs.open(dest,"w")
  28. f.write(resp.readAll())
  29. f.close()
  30. return true
  31. else
  32. return false
  33. end
  34. end
  35. --DONE LOADING SIMPLE FUNCTIONS
  36.  
  37. local version = "Service Pack 7"
  38.  
  39. if term.isColor() then
  40. local isclicking = true
  41. while isclicking do
  42. bg(colors.gray)
  43. text(colors.white)
  44. clear()
  45. centerPrint("You do not have LimeFyre installed",7)
  46. text(colors.cyan)
  47. centerPrint("Would you like to install the current version?",8)
  48. term.setCursorPos(15,10)
  49. bg(colors.lime)
  50. text(colors.white)
  51. write(" Yes ")
  52. term.setCursorPos(32,10)
  53. bg(colors.red)
  54. write(" No ")
  55. bg(colors.gray)
  56. local event,button,x,y = os.pullEvent("mouse_click")
  57. if x >= 15 and x <= 20 and y == 10 then
  58. isclicking = false
  59. if fs.exists("LimeFyre/") then
  60. fs.delete("LimeFyre/")
  61. if fs.exists("startup") then
  62. local f = fs.open("startup","r")
  63. local check = f.readLine()
  64. f.close()
  65. if check == 'shell.run("LimeFyre/bios.lua")' then
  66. fs.delete("startup")
  67. end
  68. end
  69. end
  70. bg(colors.gray)
  71. text(colors.orange)
  72. clear()
  73. centerPrint("Creating directories",10)
  74. fs.makeDir("LimeFyre")
  75. fs.makeDir("LimeFyre/APIs")
  76. fs.makeDir("LimeFyre/User")
  77. fs.makeDir("LimeFyre/Assets")
  78. clear()
  79. centerPrint("Downloading APIs from Pastebin",10)
  80. dl("bJAZpzaP","LimeFyre/APIs/fdialog")
  81. dl("jZDYw5y7","LimeFyre/APIs/hashlib")
  82. sleep(0.2)
  83. print("Creating system configuration files")
  84.  
  85. local t = {}
  86. t.bgColor = colors.gray
  87. t.info = "Be careful! If you mess some of the settings up, the OS may crash or not run properly!"
  88. t.lightColor = colors.lightBlue
  89. t.darkColor = colors.blue
  90.  
  91. local f = fs.open("LimeFyre/conf.lf","w")
  92. f.write(textutils.serialize(t))
  93. f.close()
  94. clear()
  95. centerPrint("Getting system files from pastebin...",10)
  96. dl("QCdLIDRU","LimeFyre/Assets/logo")
  97. dl("cnfymbK4","LimeFyre/bios.lua")
  98. dl("HpP53PCt","LimeFyre/Assets/files")
  99. dl("vyAZc6tJ","LimeFyre/Assets/luaide")
  100. dl("pzWSRqNF","LimeFyre/Assets/npaint")
  101. dl("Fxb7C0Mk","LimeFyre/Assets/paste")
  102. local f = fs.open("LimeFyre/User/tiles","w")
  103. f.write([[{
  104. {
  105. color = 1024,
  106. page = 1,
  107. funct = "LimeFyre/Assets/paste",
  108. height = 9,
  109. text = " Paste ",
  110. y = 7,
  111. x = 2,
  112. width = 10,
  113. },
  114. {
  115. color = 2048,
  116. page = 1,
  117. funct = "LimeFyre/Assets/luaide",
  118. height = 9,
  119. text = " LuaIDE ",
  120. y = 7,
  121. x = 12,
  122. width = 21,
  123. },
  124. {
  125. color = 32,
  126. page = 1,
  127. funct = "LimeFyre/Assets/npaint",
  128. height = 9,
  129. text = " Paint ",
  130. y = 7,
  131. x = 23,
  132. width = 31,
  133. },
  134. {
  135. color = 16384,
  136. page = 1,
  137. funct = "LimeFyre/Assets/files",
  138. height = 9,
  139. text = " FileX ",
  140. y = 7,
  141. x = 33,
  142. width = 41,
  143. }
  144. }]])
  145. f.close()
  146. local f = fs.open("LimeFyre/User/config","w")
  147. f.write([[{
  148. darkColor = 8192,
  149. lightColor = 32,
  150. info = "Be careful! If you mess some of the settings up, the OS may crash or not run properly!",
  151. bgColor = 128,
  152. }]])
  153. f.close()
  154. local yn = true
  155. while yn do
  156. bg(colors.gray)
  157. text(colors.white)
  158. clear()
  159. centerPrint("Would you like to run LimeFyre on startup?",8)
  160. bg(colors.cyan)
  161. term.setCursorPos(15,10)
  162. print(" Yes ")
  163. term.setCursorPos(30,10)
  164. print(" No ")
  165. local event, button, x, y = os.pullEvent("mouse_click")
  166. if x >= 15 and x <= 20 then
  167. f = fs.open("startup","w")
  168. f.write('shell.run("LimeFyre/bios.lua")')
  169. f.close()
  170. yn = false
  171. break
  172. elseif x >= 30 and x <= 34 then
  173. yn = false
  174. break
  175. end
  176. end
  177. bg(colors.gray)
  178. clear()
  179. text(colors.cyan)
  180. centerPrint("Starting...",10)
  181. sleep(0.2)
  182. shell.run("LimeFyre/bios.lua")
  183. elseif x >= 32 and x <= 36 and y == 10 then
  184. bg(colors.gray)
  185. text(colors.orange)
  186. centerPrint("LimeFyre install cancelled.",15)
  187. centerPrint("Returning to CraftOS",16)
  188. sleep(2)
  189. bg(colors.black)
  190. text(colors.white)
  191. clear()
  192. isclicking = false
  193. break
  194. end
  195. end
  196. else
  197. print("Your computer is not advanced. This version")
  198. print("of LimeFyre requires an Advanced Computer")
  199. print("Please wait until the basic version is released")
  200. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement