jamtholee

Untitled

Feb 8th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.98 KB | None | 0 0
  1. --NDF-OS Updater
  2.  
  3. if not http then
  4. error("This requires the HTTP API to be enabled, please enable it.", 2)
  5. end
  6.  
  7. if not term.isColor and not term.isColor() then
  8. if os.getVersion() == "CraftOS 1.3" then
  9. error("Sorry this OS can only run on Computers with CraftOS 1.4 and above.", 2)
  10. end
  11.  
  12. error("Sorry this OS can only run on Advanced Computers", 2)
  13. end
  14.  
  15. local function upWrite(path, text)
  16. local file = assert(io.open(path, "w"))
  17. file:write(text)
  18. file:close()
  19. end
  20.  
  21. local function prerequisits()
  22.  
  23. if fs.exists(".var/.icons/.iconcfg") then
  24. fs.copy(".var/.icons/.iconcfg", "iconcfg")
  25. end
  26.  
  27. if fs.exists(".var/settings") then
  28. fs.copy(".var/settings", "settings")
  29. end
  30.  
  31. if fs.exists(".var/.cver") then
  32. fs.delete("documents")
  33. fs.delete(".var")
  34. fs.delete("programs")
  35. fs.delete(".trash")
  36. fs.delete("startup")
  37. end
  38.  
  39. fs.makeDir("documents/")
  40. fs.makeDir("documents/pictures/")
  41. fs.makeDir("documents/projects/")
  42. fs.makeDir("documents/text/")
  43. fs.makeDir(".var/")
  44. fs.makeDir(".var/.icons")
  45. fs.makeDir("programs/")
  46. fs.makeDir("programs/.system/")
  47. fs.makeDir(".trash/")
  48. fs.makeDir(".var/.boot/")
  49. fs.makeDir(".var/.install")
  50. fs.makeDir("programs/games/")
  51. fs.makeDir("programs/games/speeder/")
  52. fs.makeDir("programs/games/speeder/sprites/")
  53. fs.makeDir("programs/games/speeder/world/")
  54.  
  55. if fs.exists("settings") then
  56. fs.copy("settings", ".var/settings")
  57. fs.delete("settings")
  58. end
  59.  
  60. if fs.exists("iconcfg") then
  61. fs.copy("iconcfg", ".var/.icons/.iconcfg")
  62. fs.delete("iconcfg")
  63. end
  64.  
  65. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/10.nfp") -- Install Progress 10
  66. upWrite(".var/.install/10.nfp", osEVer.readAll())
  67. osEVer.close()
  68.  
  69. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/20.nfp") -- Install Progress 20
  70. upWrite(".var/.install/20.nfp", osEVer.readAll())
  71. osEVer.close()
  72.  
  73. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/30.nfp") -- Install Progress 30
  74. upWrite(".var/.install/30.nfp", osEVer.readAll())
  75. osEVer.close()
  76.  
  77. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/40.nfp") -- Install Progress 40
  78. upWrite(".var/.install/40.nfp", osEVer.readAll())
  79. osEVer.close()
  80.  
  81. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/50.nfp") -- Install Progress 50
  82. upWrite(".var/.install/50.nfp", osEVer.readAll())
  83. osEVer.close()
  84.  
  85. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/60.nfp") -- Install Progress 60
  86. upWrite(".var/.install/60.nfp", osEVer.readAll())
  87. osEVer.close()
  88.  
  89. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/70.nfp") -- Install Progress 70
  90. upWrite(".var/.install/70.nfp", osEVer.readAll())
  91. osEVer.close()
  92.  
  93. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/80.nfp") -- Install Progress 80
  94. upWrite(".var/.install/80.nfp", osEVer.readAll())
  95. osEVer.close()
  96.  
  97. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/90.nfp") -- Install Progress 90
  98. upWrite(".var/.install/90.nfp", osEVer.readAll())
  99. osEVer.close()
  100.  
  101. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/100.nfp") -- Install Progress 100
  102. upWrite(".var/.install/100.nfp", osEVer.readAll())
  103. osEVer.close()
  104.  
  105. term.setBackgroundColor(1)
  106. term.clear()
  107. image = paintutils.loadImage(".var/.install/10.nfp")
  108. paintutils.drawImage(image,1 ,1)
  109. term.setCursorPos(13,18)
  110. term.setBackgroundColor(1)
  111. term.setTextColor(256)
  112. print("Downloading Prerequisits...")
  113.  
  114. end
  115.  
  116. local function Var()
  117.  
  118. term.setBackgroundColor(1)
  119. term.clear()
  120. image = paintutils.loadImage(".var/.install/20.nfp")
  121. paintutils.drawImage(image,1 ,1)
  122. term.setCursorPos(13,18)
  123. term.setBackgroundColor(1)
  124. term.setTextColor(256)
  125. print("Downloading System Files...")
  126.  
  127. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.trash/items") -- Trash
  128. upWrite(".trash/items", Ekern.readAll())
  129. Ekern.close()
  130.  
  131. local Estartup = http.get("http://cc.ndfjay.co.uk/NDFOS/startup") -- Startup
  132. upWrite("startup", Estartup.readAll())
  133. Estartup.close()
  134.  
  135. local Egui = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/gui") -- GUI
  136. upWrite(".var/gui", Egui.readAll())
  137. Egui.close()
  138.  
  139. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/kernal") -- Kernal
  140. upWrite(".var/kernal", Ekern.readAll())
  141. Ekern.close()
  142.  
  143. if not fs.exists(".var/settings") then -- Settings
  144. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/settings")
  145. upWrite(".var/settings", Ekern.readAll())
  146. Ekern.close()
  147. end
  148.  
  149. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.ss") -- Screensaver
  150. upWrite(".var/.ss", osEVer.readAll())
  151. osEVer.close()
  152.  
  153. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/uaconf") -- Local User Accounts
  154. upWrite(".var/uaconf", Ekern.readAll())
  155. Ekern.close()
  156.  
  157. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/feedback") -- Feedback Apt
  158. upWrite(".var/feedback", osEVer.readAll())
  159. osEVer.close()
  160.  
  161. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/feedback.nfp") --Feedback Style
  162. upWrite(".var/feedback.nfp", osEVer.readAll())
  163. osEVer.close()
  164.  
  165. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/about.nfp") -- About Style
  166. upWrite(".var/about.nfp", osEVer.readAll())
  167. osEVer.close()
  168.  
  169. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/filemanager") -- File Browser by BigSHinyToys
  170. upWrite(".var/filemanager", osEVer.readAll())
  171. osEVer.close()
  172.  
  173. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.adsnt.dll") -- Cloud Connection Details
  174. upWrite(".var/.adsnt.dll", osEVer.readAll())
  175. osEVer.close()
  176.  
  177. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/install") -- Installer/updater
  178. upWrite(".var/install", osEVer.readAll())
  179. osEVer.close()
  180.  
  181. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/ver") -- Current Version
  182. upWrite(".var/ver", osEVer.readAll())
  183. osEVer.close()
  184. fs.copy(".var/ver", ".var/.cver")
  185.  
  186. if not fs.exists(".var/.icons/.iconcfg") then -- Icon Config
  187. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/.iconcfg")
  188. upWrite(".var/.icons/.iconcfg", osEVer.readAll())
  189. osEVer.close()
  190. end
  191.  
  192. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot1.nfp") -- Boot Animation frame 1
  193. upWrite(".var/.boot/Boot1.nfp", osEVer.readAll())
  194. osEVer.close()
  195.  
  196. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot2.nfp") -- Boot Animation frame 2
  197. upWrite(".var/.boot/Boot2.nfp", osEVer.readAll())
  198. osEVer.close()
  199.  
  200. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot3.nfp") -- Boot Animation frame 3
  201. upWrite(".var/.boot/Boot3.nfp", osEVer.readAll())
  202. osEVer.close()
  203.  
  204. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot4.nfp") -- Boot Animation frame 4
  205. upWrite(".var/.boot/Boot4.nfp", osEVer.readAll())
  206. osEVer.close()
  207.  
  208. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot5.nfp") -- Boot Animation frame 5
  209. upWrite(".var/.boot/Boot5.nfp", osEVer.readAll())
  210. osEVer.close()
  211.  
  212.  
  213. end
  214.  
  215. local function Icons()
  216.  
  217. term.setBackgroundColor(1)
  218. term.clear()
  219. image = paintutils.loadImage(".var/.install/30.nfp")
  220. paintutils.drawImage(image,1 ,1)
  221. term.setCursorPos(13,18)
  222. term.setBackgroundColor(1)
  223. term.setTextColor(256)
  224. print("Setting up Run-Time Environment...")
  225.  
  226. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/FireWolf.nfp") -- FireWolf
  227. upWrite(".var/.icons/FireWolf.nfp", osEVer.readAll())
  228. osEVer.close()
  229.  
  230. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/Speeder.nfp") -- Speeder
  231. upWrite(".var/.icons/Speeder.nfp", osEVer.readAll())
  232. osEVer.close()
  233.  
  234. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/nPaintPro.nfp") -- nPaintPro
  235. upWrite(".var/.icons/nPaintPro.nfp", osEVer.readAll())
  236. osEVer.close()
  237.  
  238. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/icon.nfp") -- Generic Icon
  239. upWrite(".var/.icons/icon.nfp", osEVer.readAll())
  240. osEVer.close()
  241.  
  242. sleep(3)
  243. end
  244.  
  245. local function Documents()
  246.  
  247. term.setBackgroundColor(1)
  248. term.clear()
  249. image = paintutils.loadImage(".var/.install/40.nfp")
  250. paintutils.drawImage(image,1 ,1)
  251. term.setCursorPos(13,18)
  252. term.setBackgroundColor(1)
  253. term.setTextColor(256)
  254. print("Configuring Local storage and Cloud...")
  255.  
  256. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/documents/pictures/.background") -- NDF-OS Background
  257. upWrite("documents/pictures/.background", osEVer.readAll())
  258. osEVer.close()
  259.  
  260. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/documents/pictures/.backgroundCC") -- ComputerCraft Background
  261. upWrite("documents/pictures/.backgroundCC", osEVer.readAll())
  262. osEVer.close()
  263.  
  264. end
  265.  
  266. local function Programs()
  267.  
  268. term.setBackgroundColor(1)
  269. term.clear()
  270. image = paintutils.loadImage(".var/.install/70.nfp")
  271. paintutils.drawImage(image,1 ,1)
  272. term.setCursorPos(13,18)
  273. term.setBackgroundColor(1)
  274. term.setTextColor(256)
  275. print("Setting up System Programs...")
  276.  
  277. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/control.nse") -- Control Panel
  278. upWrite("programs/.system/control.nse", Ekern.readAll())
  279. Ekern.close()
  280.  
  281. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/firewolf.nse") -- FireWolf
  282. upWrite("programs/.system/firewolf.nse", Ekern.readAll())
  283. Ekern.close()
  284.  
  285. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/npaintpro.nse") -- nPaintPro
  286. upWrite("programs/.system/npaintpro.nse", Ekern.readAll())
  287. Ekern.close()
  288.  
  289. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/paintsplash.spl") -- nPaintPro Menu
  290. upWrite("programs/.system/paintsplash.spl", Ekern.readAll())
  291. Ekern.close()
  292.  
  293. local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/word.nse") -- NotePad (Note-Taker)
  294. upWrite("programs/.system/word.nse", Ekern.readAll())
  295. Ekern.close()
  296.  
  297. end
  298.  
  299. local function Games()
  300.  
  301. term.setBackgroundColor(1)
  302. term.clear()
  303. image = paintutils.loadImage(".var/.install/90.nfp")
  304. paintutils.drawImage(image,1 ,1)
  305. term.setCursorPos(13,18)
  306. term.setBackgroundColor(1)
  307. term.setTextColor(256)
  308. print("Installing Games...")
  309.  
  310. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/speeder") -- Game Speeder
  311. upWrite("programs/games/speeder/speeder", osEVer.readAll())
  312. osEVer.close()
  313.  
  314. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/world/road.nfp") -- Game Speeder Road
  315. upWrite("programs/games/speeder/world/road.nfp", osEVer.readAll())
  316. osEVer.close()
  317.  
  318. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/1.nfp") -- Game Speader Car 1
  319. upWrite("programs/games/speeder/sprites/1.nfp", osEVer.readAll())
  320. osEVer.close()
  321.  
  322. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/2.nfp") -- Game Speader Car 2
  323. upWrite("programs/games/speeder/sprites/2.nfp", osEVer.readAll())
  324. osEVer.close()
  325.  
  326. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/3.nfp") -- Game Speader Car 3
  327. upWrite("programs/games/speeder/sprites/3.nfp", osEVer.readAll())
  328. osEVer.close()
  329.  
  330. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/4.nfp") -- Game Speader Car 4
  331. upWrite("programs/games/speeder/sprites/4.nfp", osEVer.readAll())
  332. osEVer.close()
  333.  
  334. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/5.nfp") -- Game Speader Car 5
  335. upWrite("programs/games/speeder/sprites/5.nfp", osEVer.readAll())
  336. osEVer.close()
  337.  
  338. local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/player.nfp") -- Game Speeder Player
  339. upWrite("programs/games/speeder/sprites/player.nfp", osEVer.readAll())
  340. osEVer.close()
  341.  
  342. end
  343.  
  344. term.setBackgroundColor(colors.white)
  345. term.clear()
  346. term.setCursorPos(10, 8)
  347. term.setTextColor(256)
  348. print("Gathering required Files, Please wait...")
  349. sleep(.5)
  350. prerequisits()
  351. Var()
  352. Icons()
  353. Documents()
  354. Programs()
  355. Games()
  356.  
  357. term.setBackgroundColor(1)
  358. term.clear()
  359. image = paintutils.loadImage(".var/.install/100.nfp")
  360. paintutils.drawImage(image,1 ,1)
  361. term.setCursorPos(13,18)
  362. term.setBackgroundColor(1)
  363. term.setTextColor(256)
  364. print("Preparing System for Boot...")
  365.  
  366. sleep(.8)
  367. if fs.exists(".var/.boot/Boot1.nfp") then
  368. os.reboot()
  369. else
  370. shell.run(".var/install")
  371. end
Advertisement
Add Comment
Please, Sign In to add comment