Advertisement
ndfjay

NDF-UI Installer

Apr 19th, 2013
2,250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.50 KB | None | 0 0
  1. local w,h = term.getSize()
  2.  
  3. local fwrite = function(path, text)
  4.     local file = assert(io.open(path, "w"))
  5.     file:write(text)
  6.     file:close()
  7. end
  8.  
  9. local folders = {
  10. ".boot";
  11. ".ccYouTube";
  12. ".numinesData";
  13. "Documents";
  14. "NDF-UI";
  15. ".boot/.err";
  16. ".ccYouTube/apis";
  17. ".ccYouTube/downloads";
  18. ".ccYouTube/logos";
  19. ".ccYouTube/recycleBin";
  20. "Documents/Other";
  21. "Documents/Pictures";
  22. "Documents/Pictures/Wallpapers";
  23. "Documents/Projects";
  24. "Documents/Text-Files";
  25. "Documents/Videos";
  26. "NDF-UI/.apps";
  27. "NDF-UI/.apps/games";
  28. "NDF-UI/.apps/home";
  29. "NDF-UI/.apps/programs";
  30. "NDF-UI/.apps/system";
  31. "NDF-UI/.apps/games/numines";
  32. "NDF-UI/.apps/games/speeder";
  33. "NDF-UI/.apps/games/speeder/sprites";
  34. "NDF-UI/.apps/games/speeder/world";
  35. "NDF-UI/.var";
  36. "NDF-UI/.var/.boot";
  37. "NDF-UI/.var/.err";
  38. "NDF-UI/.var/.img";
  39. "NDF-UI/.var/.install";
  40. "NDF-UI/.var/.sys";
  41. "NDF-UI/.var/.boot/login";
  42. "NDF-UI/.var/.img/.DS_data";
  43. "NDF-UI/.var/.img/.icons";
  44. "NDF-UI/.var/.sys/.DS_data";
  45. "NDF-UI/.var/.sys/.keys"
  46. }
  47.  
  48. local files = {
  49. "startup";
  50. ".boot/.bios";
  51. ".boot/.conf";
  52. ".boot/boot";
  53. ".boot/CCatch";
  54. ".boot/leftos.ico";
  55. ".boot/ndfui.ico";
  56. ".boot/none.ico";
  57. ".boot/rightos.ico";
  58. ".boot/.err/.errImg";
  59. ".ccYouTube/apis/box";
  60. ".ccYouTube/apis/extStrLib";
  61. ".ccYouTube/apis/loadingScreen";
  62. ".ccYouTube/logos/ccytLogo";
  63. ".ccYouTube/logos/home";
  64. ".numinesData/bg1.nfa";
  65. ".numinesData/bg2.nfa";
  66. ".numinesData/gameutils";
  67. "Documents/Pictures/Wallpapers/ComputerCraft.bg";
  68. "Documents/Pictures/Wallpapers/GrassBlock.bg";
  69. "Documents/Pictures/Wallpapers/NDFJay.bg";
  70. "Documents/Pictures/Wallpapers/NDF-UI.bg";
  71. "NDF-UI/.DS_draw";
  72. "NDF-UI/.apps/games/numines/bg1.nfa";
  73. "NDF-UI/.apps/games/numines/gameutils";
  74. "NDF-UI/.apps/games/numines/numines";
  75. "NDF-UI/.apps/games/speeder/sprites/1.nfp";
  76. "NDF-UI/.apps/games/speeder/sprites/2.nfp";
  77. "NDF-UI/.apps/games/speeder/sprites/3.nfp";
  78. "NDF-UI/.apps/games/speeder/sprites/4.nfp";
  79. "NDF-UI/.apps/games/speeder/sprites/5.nfp";
  80. "NDF-UI/.apps/games/speeder/sprites/player.nfp";
  81. "NDF-UI/.apps/games/speeder/world/road.nfp";
  82. "NDF-UI/.apps/games/speeder/speeder";
  83. "NDF-UI/.apps/games/speeder/Speeder.ico";
  84. "NDF-UI/.apps/programs/ccYouTube";
  85. "NDF-UI/.apps/programs/firewolf";
  86. "NDF-UI/.apps/programs/lightshot";
  87. "NDF-UI/.apps/programs/npaintpro.nse";
  88. "NDF-UI/.apps/programs/overlay.nfp";
  89. "NDF-UI/.apps/programs/word.nse";
  90. "NDF-UI/.apps/system/explorer";
  91. "NDF-UI/.apps/system/mouse.cfg";
  92. "NDF-UI/.var/.boot/login/login.nfp";
  93. "NDF-UI/.var/.boot/login/logo.nfp";
  94. "NDF-UI/.var/.boot/login/overlay.nfp";
  95. "NDF-UI/.var/.boot/login/userPic.nfp";
  96. "NDF-UI/.var/.err/.errImg";
  97. "NDF-UI/.var/.img/.DS_data/.DS_Backgrounds";
  98. "NDF-UI/.var/.img/.icons/.iconlink";
  99. "NDF-UI/.var/.img/.icons/.iconloc";
  100. "NDF-UI/.var/.img/.icons/.iconname";
  101. "NDF-UI/.var/.img/.icons/.iconrun";
  102. "NDF-UI/.var/.img/.icons/icon.nfp";
  103. "NDF-UI/.var/.install/install";
  104. "NDF-UI/.var/.sys/kernal";
  105. "NDF-UI/.var/.sys/.DS_data/.config";
  106. "NDF-UI/.var/.sys/.DS_data/.DS_login";
  107. "NDF-UI/.var/.sys/.keys/.passwords";
  108. "NDF-UI/.var/.sys/.keys/.usernames"
  109. }
  110. local httpUrl = {
  111. "http://downloads.ndfjay.co.uk/ndfui/startup";
  112. "http://downloads.ndfjay.co.uk/ndfui/.boot/.bios";
  113. "http://downloads.ndfjay.co.uk/ndfui/.boot/.conf";
  114. "http://downloads.ndfjay.co.uk/ndfui/.boot/boot";
  115. "http://downloads.ndfjay.co.uk/ndfui/.boot/CCatch";
  116. "http://downloads.ndfjay.co.uk/ndfui/.boot/leftos.ico";
  117. "http://downloads.ndfjay.co.uk/ndfui/.boot/ndfui.ico";
  118. "http://downloads.ndfjay.co.uk/ndfui/.boot/none.ico";
  119. "http://downloads.ndfjay.co.uk/ndfui/.boot/rightos.ico";
  120. "http://downloads.ndfjay.co.uk/ndfui/.boot/.err/.errImg";
  121. "http://downloads.ndfjay.co.uk/ndfui/.ccYouTube/apis/box";
  122. "http://downloads.ndfjay.co.uk/ndfui/.ccYouTube/apis/extStrLib";
  123. "http://downloads.ndfjay.co.uk/ndfui/.ccYouTube/apis/loadingScreen";
  124. "http://downloads.ndfjay.co.uk/ndfui/.ccYouTube/logos/ccytLogo";
  125. "http://downloads.ndfjay.co.uk/ndfui/.ccYouTube/logos/home";
  126. "http://downloads.ndfjay.co.uk/ndfui/.numinesData/bg1.nfa";
  127. "http://downloads.ndfjay.co.uk/ndfui/.numinesData/bg2.nfa";
  128. "http://downloads.ndfjay.co.uk/ndfui/.numinesData/gameutils";
  129. "http://downloads.ndfjay.co.uk/ndfui/Documents/Pictures/Wallpapers/ComputerCraft.bg";
  130. "http://downloads.ndfjay.co.uk/ndfui/Documents/Pictures/Wallpapers/GrassBlock.bg";
  131. "http://downloads.ndfjay.co.uk/ndfui/Documents/Pictures/Wallpapers/NDFJay.bg";
  132. "http://downloads.ndfjay.co.uk/ndfui/Documents/Pictures/Wallpapers/NDF-UI.bg";
  133. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.DS_draw";
  134. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/numines/bg1.nfp";
  135. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/numines/gameutils";
  136. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/numines/numines";
  137. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/sprites/1.nfp";
  138. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/sprites/2.nfp";
  139. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/sprites/3.nfp";
  140. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/sprites/4.nfp";
  141. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/sprites/5.nfp";
  142. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/sprites/player.nfp";
  143. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/world/road.nfp";
  144. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/speeder";
  145. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/games/speeder/Speeder.ico";
  146. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/programs/ccYouTube";
  147. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/programs/firewolf";
  148. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/programs/lightshot";
  149. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/programs/npaintpro.nse";
  150. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/programs/overlay.nfp";
  151. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/programs/word.nse";
  152. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/system/explorer";
  153. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.apps/system/mouse.cfg";
  154. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.boot/login/login.nfp";
  155. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.boot/login/logo.nfp";
  156. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.boot/login/overlay.nfp";
  157. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.boot/login/userPic.nfp";
  158. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.err/.errImg";
  159. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.img/.DS_data/.DS_Backgrounds";
  160. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.img/.icons/.iconlink";
  161. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.img/.icons/.iconloc";
  162. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.img/.icons/.iconname";
  163. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.img/.icons/.iconrun";
  164. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.img/.icons/icon.nfp";
  165. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.install/install";
  166. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.sys/kernal";
  167. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.sys/.DS_data/.config";
  168. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.sys/.DS_data/.DS_login";
  169. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.sys/.keys/.passwords";
  170. "http://downloads.ndfjay.co.uk/ndfui/NDF-UI/.var/.sys/.keys/.usernames"
  171. }
  172. local draw = function()
  173. term.setBackgroundColour(1)
  174. term.clear()
  175. term.setTextColour(8)
  176. term.setCursorPos(math.floor(w-#"Installing NDF-UI")/2,math.floor(h)/2-2)
  177. write("Installing NDF-UI")
  178. term.setCursorPos(math.floor(w-#"Please wait...")/2,math.floor(h)/2)
  179. write("Please wait...")
  180. end
  181.  
  182. draw()
  183.  
  184. if fs.exists("startup") then
  185. term.setBackgroundColour(1)
  186. term.setTextColour(8)
  187. term.setCursorPos(math.floor(w-#"A Startup file has been found")/2,math.floor(h)/2+2)
  188. write("A Startup file has been found")
  189. sleep(2)
  190. term.setCursorPos(math.floor(w-#"Renamed to   startup.old")/2,math.floor(h)/2+3)
  191. write('Renamed to "startup.old"')
  192. fs.copy("startup","startup.old")
  193. fs.delete("startup")
  194. sleep(2)
  195. draw()
  196. end
  197.  
  198. for i,v in pairs(folders) do
  199. if fs.exists(v) then
  200. fs.delete(v)
  201. end
  202. end
  203.  
  204. for i,v in pairs(folders) do
  205. if not fs.exists(v) then
  206.     fs.makeDir(v)
  207. end
  208. end
  209.  
  210. for i,v in pairs(files) do
  211. download = http.get(httpUrl[i])
  212. fwrite(v, download.readAll())
  213. end
  214.  
  215. term.setBackgroundColour(1)
  216. term.clear()
  217. term.setTextColour(8)
  218. term.setCursorPos(math.floor(w-#"Installation complete")/2,math.floor(h)/2-2)
  219. write("Installation complete")
  220. term.setCursorPos(math.floor(w-#"Press any key to reboot...")/2,math.floor(h)/2)
  221. write("Press any key to reboot...")
  222. while true do
  223. e = {os.pullEventRaw()}
  224. if e[1] == "key" then
  225.     fs.delete("install")
  226.     os.reboot()
  227. end
  228. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement