Advertisement
KAYOver

bios.cps

May 23rd, 2015
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.85 KB | None | 0 0
  1. inputTable = {
  2. [ ".Elico" ] = {
  3. initrd = "CraftOS;shell\
  4. WinCC 7;bootmgr",
  5. [ "Splash.logo" ] = " \
  6. \
  7. 99555dd\
  8. 999444dbb\
  9. 5944411bb\
  10. 55449bbbb\
  11. 599444ddd\
  12. 99995dd\
  13. \
  14. 999999bbb\
  15. 99999bb\
  16. 99999bb\
  17. 99999bb\
  18. 99999bb\
  19. 99999bb\
  20. 99999bb\
  21. 999999bbb",
  22. [ "Bios.logo" ] = " 444444\
  23. 44 4 4 44\
  24. 4 4444 4\
  25. 4 4 4\
  26. 4 4444444",
  27. [ "Splash2.logo" ] = "\
  28. \
  29. \
  30. \
  31. \
  32. dd 88888 8 8 88888\
  33. d d 8 8 8 8\
  34. \
  35. d d 8 8 8 8\
  36. d d 8 8 8 8\
  37. d d 8 8 8 8\
  38. d d 88888 88888 88888",
  39. [ "Splash1.logo" ] = "\
  40. \
  41. \
  42. \
  43. \
  44. 77 77777 7 7 77777\
  45. 7 7 7 7 7 7\
  46. \
  47. 7 7 7 7 7 7\
  48. 7 7 7 7 7 7\
  49. 7 7 7 7 7 7\
  50. 7 7 77777 77777 77777",
  51. [ "Splash3.logo" ] = "\
  52. \
  53. \
  54. \
  55. \
  56. 55 00000 0 0 00000\
  57. 5 5 0 0 0 0\
  58. \
  59. 5 5 0 0 0 0\
  60. 5 5 0 0 0 0\
  61. 5 5 0 0 0 0\
  62. 5 5 00000 00000 00000",
  63. },
  64. startup = "-- Local Variables --\
  65. local x,y = term.getSize()\
  66. local bootOpt = { }\
  67. local sides = { \"left\", \"right\", \"top\", \"bottom\", \"front\", \"back\"}\
  68. local sidesList = { \"left\", \"right\", \"top\", \"bottom\", \"front\", \"back\"}\
  69. local driveCount = 1\
  70. local driveCount0 = 1\
  71. local monitorCount = 1\
  72. local modemCount = 1\
  73. local printerCount = 1\
  74. local modemExists = false\
  75. local modemSide = \"right\"\
  76. local bootDriveExists = false\
  77. local bootDrive = \"right\"\
  78. local bootableDisk = false\
  79. local mountName = \"disk\"\
  80. local labLen = 13\
  81. local slc = 1\
  82. local bytesFree = fs.getFreeSpace(\"/\")\
  83. local clientId = os.computerID()\
  84. \
  85. -- Local Functions --\
  86. \
  87. -- Disable \"Terminate\" function --\
  88. function os.pullEvent()\
  89. local event, p1, p2, p3, p4, p5 = os.pullEventRaw()\
  90. if event == \"terminate\" then\
  91. \
  92. end\
  93. return event, p1, p2, p3, p4, p5\
  94. end\
  95. \
  96. \
  97. -- Print Centred Text Function --\
  98. function centerText(text, line)\
  99. x,y = term.getSize()\
  100. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), line)\
  101. term.write(text)\
  102. end\
  103. \
  104. \
  105. -- Split String Function --\
  106. function split(str, pattern)\
  107. local t = { }\
  108. local fpat = \"(.-)\" .. pattern\
  109. local last_end = 1\
  110. local s, e, cap = str:find(fpat, 1)\
  111. while s do\
  112. if s ~= 1 or cap ~= \"\" then\
  113. table.insert(t,cap)\
  114. end\
  115. last_end = e+1\
  116. s, e, cap = str:find(fpat, last_end)\
  117. end\
  118. if last_end <= #str then\
  119. cap = str:sub(last_end)\
  120. table.insert(t, cap)\
  121. end\
  122. return t\
  123. end\
  124. \
  125. \
  126. -- Get list of Boot Options Function --\
  127. local function readBootOptions()\
  128. if not fs.exists(\".Elico/initrd\") then return end\
  129. local file = io.open(\".Elico/initrd\", \"r\")\
  130. c = 0\
  131. for line in file:lines()do\
  132. c = c + 1\
  133. local t = split(line, \";\")\
  134. table.insert(bootOpt, { \
  135. name = t[1],\
  136. dir = t[2],\
  137. args = t[3] })\
  138. if c == 7 then break end \
  139. end\
  140. if bootableDisk then\
  141. table.insert(bootOpt, { \
  142. name = \"Disk\",\
  143. dir = mountName,\
  144. args = \"\"})\
  145. end\
  146. file:close()\
  147. end\
  148. \
  149. \
  150. -- Draw Logo --\
  151. term.clear()\
  152. sleep(1.0)\
  153. if term.isColor() then\
  154. term.setTextColor(colors.lightGray)\
  155. end\
  156. term.setCursorPos(1,1)\
  157. term.setCursorBlink(true)\
  158. sleep(1.5)\
  159. term.setCursorBlink(false)\
  160. term.clear()\
  161. sleep(1.0)\
  162. local animateSplash = 0\
  163. if term.isColor() then\
  164. if animateSplash == 1 then\
  165. if not fs.exists (\".Elico/Splash1.logo\") then\
  166. term.setCursorPos(1,1)\
  167. term.write (\"SPLASH FILES NOT FOUND, STARTING WITHOUT IT!\")\
  168. sleep(1.5)\
  169. term.setBackgroundColor(colors.black)\
  170. term.clear()\
  171. sleep(0.1)\
  172. elseif not fs.exists (\".Elico/Splash2.logo\") then\
  173. term.setCursorPos(1,1)\
  174. term.write (\"SPLASH FILES NOT FOUND, STARTING WITHOUT IT!\")\
  175. sleep(1.5)\
  176. term.setBackgroundColor(colors.black)\
  177. term.clear()\
  178. sleep(0.1)\
  179. elseif not fs.exists (\".Elico/Splash3.logo\") then\
  180. term.setCursorPos(1,1)\
  181. term.write (\"SPLASH FILES NOT FOUND, STARTING WITHOUT IT!\")\
  182. sleep(1.5)\
  183. term.setBackgroundColor(colors.black)\
  184. term.clear()\
  185. sleep(0.1)\
  186. else\
  187. local image = paintutils.loadImage(\".Elico/Splash1.logo\")\
  188. paintutils.drawImage(image, 1, 1) \
  189. term.setCursorPos(16,14)\
  190. term.setBackgroundColor(colors.black)\
  191. term.setTextColor(colors.gray)\
  192. term.write(\"Inspiring \") \
  193. term.setTextColor(colors.gray)\
  194. term.write(\"Innovation\")\
  195. sleep(0.05) \
  196. local image = paintutils.loadImage(\".Elico/Splash2.logo\")\
  197. paintutils.drawImage(image, 1, 1) \
  198. term.setCursorPos(16,14)\
  199. term.setBackgroundColor(colors.black)\
  200. term.setTextColor(colors.green)\
  201. term.write(\"Inspiring \") \
  202. term.setTextColor(colors.lightGray)\
  203. term.write(\"Innovation\")\
  204. sleep(0.05) \
  205. local image = paintutils.loadImage(\".Elico/Splash3.logo\")\
  206. paintutils.drawImage(image, 1, 1) \
  207. term.setCursorPos(16,14)\
  208. term.setBackgroundColor(colors.black)\
  209. term.setTextColor(colors.lime)\
  210. term.write(\"Inspiring \") \
  211. term.setTextColor(colors.white)\
  212. term.write(\"Innovation\")\
  213. sleep(2.0) \
  214. term.setBackgroundColor(colors.black)\
  215. term.clear()\
  216. sleep(0.1)\
  217. end \
  218. else\
  219. if not fs.exists (\".Elico/Splash.logo\") then\
  220. term.setCursorPos(1,1)\
  221. term.write (\"SPLASH FILE NOT FOUND, STARTING WITHOUT IT!\")\
  222. sleep(1.5)\
  223. term.setBackgroundColor(colors.black)\
  224. term.clear()\
  225. sleep(0.1)\
  226. else\
  227. local image = paintutils.loadImage(\".Elico/Splash.logo\")\
  228. paintutils.drawImage(image, 1, 1) \
  229. sleep(2.0) \
  230. term.setBackgroundColor(colors.black)\
  231. term.clear()\
  232. sleep(0.1)\
  233. end \
  234. end\
  235. end\
  236. ---------------------------------------------------------------\
  237. \
  238. term.clear()\
  239. if term.isColor() then\
  240. if fs.exists(\".Elico/Bios.logo\") then\
  241. local image = paintutils.loadImage(\".Elico/Bios.logo\")\
  242. paintutils.drawImage(image, 39, 2)\
  243. term.setBackgroundColor(colors.black)\
  244. term.setTextColor(colors.lime)\
  245. term.setCursorPos(39,7)\
  246. term.write(\"------------\")\
  247. term.setCursorPos(39,8)\
  248. term.write(\"SoftWareKing\")\
  249. end\
  250. end\
  251. \
  252. term.setBackgroundColor(colors.black) \
  253. if term.isColor() then\
  254. term.setTextColor(colors.blue)\
  255. else\
  256. term.setTextColor(colors.white)\
  257. end\
  258. term.setCursorPos(1,1)\
  259. term.write(\"()\")\
  260. term.setCursorPos(1,2)\
  261. term.write(\"][\")\
  262. \
  263. if term.isColor() then\
  264. term.setCursorPos(3,1)\
  265. term.setBackgroundColor(colors.black) \
  266. term.setTextColor(colors.lightGray)\
  267. else\
  268. term.setCursorPos(3,1)\
  269. term.setBackgroundColor(colors.black) \
  270. term.setTextColor(colors.white)\
  271. end\
  272. term.write(\"Elico BIOS v5.83\")\
  273. term.setCursorPos(3,2)\
  274. term.write(\"Copyright (C) Elico Software\")\
  275. term.setCursorPos(1,19)\
  276. term.write(\"16/05/2015-Elico-BIOS/Version-5-83/AZUZ-PC\")\
  277. \
  278. sleep(1.0)\
  279. term.setCursorPos(1,4)\
  280. term.write(\"Main Processor : \")\
  281. term.setCursorBlink(true)\
  282. sleep(0.8)\
  283. term.write(\"UltraCore 3.4GHz\")\
  284. term.setCursorPos(1,5)\
  285. term.write(\"Memory Testing : \")\
  286. sleep(0.8)\
  287. term.write(\"\"..bytesFree..\"K FREE\")\
  288. term.setCursorBlink(false)\
  289. sleep(1.0)\
  290. term.setTextColor(colors.white)\
  291. term.setCursorPos(1,7)\
  292. term.write(\"Trend ChipAwayBlock (R) On Guard\")\
  293. if term.isColor() then\
  294. term.setTextColor(colors.lightGray)\
  295. end\
  296. sleep(1.0)\
  297. term.setCursorPos(1,9)\
  298. term.write(\"Detecting DISK Drives ...\")\
  299. sleep(1.4)\
  300. if driveCount > 1 then\
  301. term.setCursorPos(1,9)\
  302. term.write(\" \")\
  303. else \
  304. term.setCursorPos(1,9)\
  305. term.write(\"No DISK Drives Connected \")\
  306. end\
  307. \
  308. for i = 1,6 do\
  309. \
  310. if peripheral.isPresent(sidesList[i]) then\
  311. if peripheral.getType(sidesList[i]) == \"modem\" then\
  312. modemExists = true\
  313. modemSide = sidesList[i]\
  314. elseif peripheral.getType(sidesList[i]) == \"drive\" then\
  315. mountName = \"None\"\
  316. if disk.isPresent(sidesList[i]) then\
  317. mountName = disk.getMountPath(sidesList[i])\
  318. end\
  319. if driveCount > 1 then\
  320. term.setCursorPos(1,(8+driveCount))\
  321. term.write(\"Disk Drive Slave : \"..mountName..\" [\"..sidesList[i]..\"]\")\
  322. sleep(0.05)\
  323. else\
  324. term.setCursorPos(1,(8+driveCount))\
  325. term.write(\"Disk Drive Master : \"..mountName..\" [\"..sidesList[i]..\"]\")\
  326. sleep(0.05)\
  327. bootDrive = sidesList[i]\
  328. bootDriveExists = true\
  329. end\
  330. driveCount = driveCount + 1\
  331. end\
  332. end\
  333. end\
  334. sleep(0.7)\
  335. if term.isColor() then\
  336. if modemExists then\
  337. term.setCursorPos(1,18)\
  338. term.write(\"Modem <\")\
  339. term.setTextColor(colors.white)\
  340. term.write(\"CONNECTED\")\
  341. term.setTextColor(colors.lightGray)\
  342. term.write(\">: [\"..modemSide..\"] IP: \"..clientId..\"\")\
  343. else\
  344. term.setCursorPos(1,18)\
  345. term.write(\"Modem <\")\
  346. term.setTextColor(colors.white)\
  347. term.write(\"NOT CONNECTED\")\
  348. term.setTextColor(colors.lightGray)\
  349. term.write(\">\")\
  350. end\
  351. else\
  352. if modemExists then\
  353. term.setCursorPos(1,18)\
  354. term.write(\"Modem <\")\
  355. term.setTextColor(colors.white)\
  356. term.write(\"CONNECTED\")\
  357. term.write(\">: [\"..modemSide..\"] IP: \"..clientId..\"\")\
  358. else\
  359. term.setCursorPos(1,18)\
  360. term.write(\"Modem <\")\
  361. term.setTextColor(colors.white)\
  362. term.write(\"NOT CONNECTED\")\
  363. term.write(\">\")\
  364. end\
  365. end\
  366. sleep(1.8)\
  367. \
  368. term.clear()\
  369. term.setCursorPos(1,1)\
  370. term.setCursorBlink(true)\
  371. sleep(2.0)\
  372. term.setCursorBlink(false)\
  373. term.clear()\
  374. term.setCursorPos(1,1)\
  375. if term.isColor() then\
  376. term.setTextColor(colors.lightGray)\
  377. end\
  378. term.write(string.rep(\" \", x))\
  379. centerText(\"Elico Software\", 1)\
  380. term.write(string.rep(\" \", x))\
  381. centerText(\"System Configurations\", 2)\
  382. \
  383. print (\"+-------------------------------------------------+\")\
  384. print (\"|CPU Type : UltraCore | Free Memory : |\")\
  385. print (\"|CPU Clock : 3.4GHz | CPU ID : |\")\
  386. print (\"+-------------------------------------------------+\")\
  387. print (\"| | Display : |\")\
  388. print (\"| | |\")\
  389. print (\"| | |\")\
  390. print (\"| | |\")\
  391. print (\"| | |\")\
  392. print (\"+-------------------------------------------------+\")\
  393. print (\" \")\
  394. print (\"ALL device listing ..... \")\
  395. print (\"Device Class Number Side \")\
  396. print (\"---------------------------------------------------\")\
  397. \
  398. if term.isColor() then\
  399. term.setCursorPos(42,7)\
  400. term.write(\"Advanced\")\
  401. else\
  402. term.setCursorPos(42,7)\
  403. term.write(\"Typical\")\
  404. end\
  405. \
  406. if driveCount < 2 then\
  407. term.setCursorPos(2,7)\
  408. term.write(\"Disk Master : Not Connected\")\
  409. end\
  410. \
  411. if driveCount < 3 then\
  412. term.setCursorPos(2,8)\
  413. term.write(\"Disk Slave : Not Connected\")\
  414. end\
  415. \
  416. if driveCount < 4 then\
  417. term.setCursorPos(2,9)\
  418. term.write(\"Disk Slave : Not Connected\")\
  419. end\
  420. \
  421. if driveCount < 5 then\
  422. term.setCursorPos(2,10)\
  423. term.write(\"Disk Slave : Not Connected\")\
  424. end\
  425. \
  426. if driveCount < 6 then\
  427. term.setCursorPos(2,11)\
  428. term.write(\"Disk Slave : Not Connected\")\
  429. end\
  430. \
  431. local driveCount = 1\
  432. \
  433. for i = 1,6 do\
  434. \
  435. if peripheral.isPresent(sidesList[i]) then\
  436. if peripheral.getType(sidesList[i]) == \"modem\" then\
  437. modemExists = true\
  438. modemSide = sidesList[i]\
  439. elseif peripheral.getType(sidesList[i]) == \"drive\" then\
  440. mountName = \"None\"\
  441. if disk.isPresent(sidesList[i]) then\
  442. mountName = disk.getMountPath(sidesList[i])\
  443. end\
  444. if driveCount > 1 then\
  445. term.setCursorPos(2,(6+driveCount))\
  446. term.write(\"Disk Slave : \"..mountName..\" [\"..sidesList[i]..\"]\")\
  447. else\
  448. term.setCursorPos(2,(6+driveCount))\
  449. term.write(\"Disk Master : \"..mountName..\" [\"..sidesList[i]..\"]\")\
  450. bootDrive = sidesList[i]\
  451. bootDriveExists = true\
  452. end\
  453. driveCount = driveCount + 1\
  454. end\
  455. end\
  456. end\
  457. \
  458. term.setCursorPos(40,4)\
  459. print(\"\"..bytesFree..\"K\")\
  460. term.setCursorPos(35,5)\
  461. print(\"\"..clientId..\"\")\
  462. \
  463. term.setCursorPos(1,17)\
  464. \
  465. for i = 1, #sides do\
  466. if peripheral.isPresent(sides[i]) then\
  467. if peripheral.getType(sides[i]) == \"modem\" then\
  468. modemSide = sidesList[i]\
  469. print(\"Modem \"..modemCount..\" \"..modemSide..\" \")\
  470. modemCount = modemCount + 1\
  471. sleep(0.3)\
  472. end\
  473. end\
  474. end\
  475. for i = 1, #sides do\
  476. if peripheral.isPresent(sides[i]) then\
  477. if peripheral.getType(sides[i]) == \"printer\" then\
  478. printerSide = sidesList[i]\
  479. print(\"Printer \"..printerCount..\" \"..printerSide..\" \")\
  480. printerCount = printerCount + 1\
  481. sleep(0.3)\
  482. end\
  483. end\
  484. end\
  485. for i = 1, #sides do\
  486. if peripheral.isPresent(sides[i]) then\
  487. if peripheral.getType(sides[i]) == \"monitor\" then\
  488. monitorSide = sidesList[i]\
  489. print(\"Monitor \"..monitorCount..\" \"..monitorSide..\" \")\
  490. monitorCount = monitorCount + 1\
  491. sleep(0.3)\
  492. end\
  493. end\
  494. end\
  495. for i = 1, #sides do\
  496. if peripheral.isPresent(sides[i]) then\
  497. if peripheral.getType(sides[i]) == \"drive\" then\
  498. driveSide = sidesList[i]\
  499. print(\"Disk Drive \"..driveCount0..\" \"..driveSide..\" \")\
  500. driveCount0 = driveCount0 + 1\
  501. sleep(0.3)\
  502. end\
  503. end\
  504. end\
  505. \
  506. print(\"\")\
  507. sleep(0.3)\
  508. print(\"\") \
  509. sleep (0.6)\
  510. local sides = { \"left\", \"right\", \"top\", \"bottom\", \"front\", \"back\"}\
  511. for i = 1, #sides do\
  512. if peripheral.isPresent(sides[i]) then\
  513. if peripheral.getType(sides[i]) == \"drive\" then\
  514. term.setCursorPos(1,19)\
  515. print (\"Verifying DISK Drives Data \")\
  516. sleep (0.05)\
  517. term.setCursorPos(1,18)\
  518. print (\"Verifying DISK Drives Data .\")\
  519. sleep (0.05)\
  520. term.setCursorPos(1,18)\
  521. print (\"Verifying DISK Drives Data ..\")\
  522. sleep (0.05)\
  523. term.setCursorPos(1,18)\
  524. print (\"Verifying DISK Drives Data ...\")\
  525. sleep (0.05)\
  526. term.setCursorPos(1,18)\
  527. print (\"Verifying DISK Drives Data ....\")\
  528. sleep (0.05)\
  529. term.setCursorPos(1,18)\
  530. print (\"Verifying DISK Drives Data .....\")\
  531. sleep (0.05) \
  532. term.setCursorPos(1,18)\
  533. print (\"Verifying DISK Drives Data ......\")\
  534. sleep (0.05)\
  535. term.setCursorPos(1,18)\
  536. print (\"Verifying DISK Drives Data .......\")\
  537. sleep (0.05)\
  538. term.setCursorPos(1,18)\
  539. print (\"Verifying DISK Drives Data ........\")\
  540. sleep (0.05) \
  541. term.setCursorPos(1,18)\
  542. print (\"Verifying DISK Drives Data .........\")\
  543. sleep (0.05)\
  544. term.setCursorPos(1,18)\
  545. print (\"Verifying DISK Drives Data ..........\")\
  546. sleep (0.05)\
  547. term.setCursorPos(1,18)\
  548. print (\"Verifying DISK Drives Data .......... Success\")\
  549. sleep (0.7)\
  550. break\
  551. end\
  552. end\
  553. end\
  554. \
  555. if fs.exists(\".Elico/initrd\") then\
  556. term.setCursorPos(1,19)\
  557. print (\"Starting ElicoBoot ...\")\
  558. term.setCursorPos(1,18)\
  559. sleep (1.2)\
  560. term.clear()\
  561. term.setTextColor(colors.white)\
  562. \
  563. if bootDriveExists and disk.isPresent(bootDrive) then\
  564. mountName = disk.getMountPath(bootDrive)..\"/autoexec\"\
  565. if fs.exists(mountName) then\
  566. bootableDisk = true\
  567. end\
  568. end\
  569. \
  570. -- Launch Boot Manager --\
  571. readBootOptions()\
  572. \
  573. -- Draw Boot Manager GUI Interface --\
  574. local bootOptLen = table.getn(bootOpt)\
  575. while true do\
  576. if term.isColor() then\
  577. term.setBackgroundColor(colors.lightGray)\
  578. else\
  579. term.setBackgroundColor(colors.white)\
  580. end\
  581. term.clear()\
  582. term.setCursorPos(1,1)\
  583. if term.isColor() then\
  584. term.setBackgroundColor(colors.lightGray)\
  585. term.setTextColor(colors.lime)\
  586. else\
  587. term.setBackgroundColor(colors.white)\
  588. term.setTextColor(colors.black)\
  589. end\
  590. term.write(string.rep(\" \", x))\
  591. centerText(\"<> ElicoBoot\", 5)\
  592. \
  593. for i=1,bootOptLen do\
  594. local str = \"Option\"\
  595. local nameLen = string.len(bootOpt[i].name)\
  596. local addspaces = labLen - tonumber(nameLen)\
  597. if addspaces >= 0 then\
  598. str = i..\" \"..bootOpt[i].name\
  599. str = str..string.rep(\" \", addspaces)\
  600. else\
  601. str = string.sub(bootOpt[i].name, 1, labLen)\
  602. end\
  603. if i == slc then\
  604. if term.isColor() then\
  605. term.setBackgroundColor(colors.gray)\
  606. term.setTextColor(colors.lightGray)\
  607. else\
  608. term.setBackgroundColor(colors.black)\
  609. term.setTextColor(colors.white)\
  610. end\
  611. term.setCursorPos(19,(i+6))\
  612. write(str)\
  613. term.setCursorPos(18,(i+6))\
  614. write(\"->\")\
  615. \
  616. \
  617. else \
  618. if term.isColor() then\
  619. term.setBackgroundColor(colors.lightGray)\
  620. term.setTextColor(colors.gray)\
  621. else\
  622. term.setBackgroundColor(colors.white)\
  623. term.setTextColor(colors.black)\
  624. end\
  625. term.setCursorPos(19,(i+6))\
  626. write(str)\
  627. term.setCursorPos(18,(i+6))\
  628. write(\" \")\
  629. end\
  630. end\
  631. if term.isColor() then\
  632. term.setBackgroundColor(colors.lightGray)\
  633. term.setTextColor(colors.gray) \
  634. else\
  635. term.setBackgroundColor(colors.white)\
  636. term.setTextColor(colors.black) \
  637. end\
  638. term.setCursorPos(4, (y-1))\
  639. write(\"Press F5 to restart or F6 to shutdown system.\")\
  640. term.setTextColor(colors.white)\
  641. term.setCursorPos(1,1)\
  642. local event, p1, p2 = os.pullEvent()\
  643. if event == \"key\" then \
  644. if p1 == keys.up and slc > 1 then slc=slc-1\
  645. elseif p1 == keys.down and slc < bootOptLen then slc=slc+1\
  646. elseif p1 == keys.enter then\
  647. local args = { }\
  648. bootOptcmd = bootOpt[slc].dir\
  649. if bootOpt[slc].args ~= null then\
  650. args = split(bootOpt[slc].args, \",\")\
  651. for a=1,table.getn(args) do\
  652. bootOptcmd = bootOptcmd..\" \"..args[a]\
  653. \
  654. end\
  655. end \
  656. term.setBackgroundColor(colors.black)\
  657. term.clear()\
  658. shell.run(bootOptcmd)\
  659. sleep(1)\
  660. elseif p1 == keys.f5 then\
  661. os.reboot()\
  662. elseif p1 == keys.f6 then\
  663. os.shutdown()\
  664. end\
  665. end\
  666. end\
  667. function restoreEvent()\
  668. function os.pullEvent( _sFilter )\
  669. local event, p1, p2, p3, p4, p5 = os.pullEventRaw( _sFilter )\
  670. if event == \"terminate\" then\
  671. print( \"Terminated\" )\
  672. error()\
  673. end\
  674. return event, p1, p2, p3, p4, p5\
  675. end\
  676. end\
  677. \
  678. else \
  679. term.setCursorPos(1,19)\
  680. print (\"BOOT FAILURE, CREATE BOOTLIST FILE AND REBOOT\")\
  681. end",
  682. }
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691. local function writeFile(path,content)
  692. local file = fs.open(path,"w")
  693. file.write(content)
  694. file.close()
  695. end
  696. function writeDown(input,dir)
  697. for i,v in pairs(input) do
  698. if type(v) == "table" then
  699. writeDown(v,dir.."/"..i)
  700. elseif type(v) == "string" then
  701. writeFile(dir.."/"..i,v)
  702. end
  703. end
  704. end
  705.  
  706. args = {...}
  707. if #args == 0 then
  708. print("Please input a destination folder.")
  709. else
  710. writeDown(inputTable,args[1])
  711. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement