Advertisement
dannysmc95

OL OS (Created By bigapple542)

Jan 29th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.65 KB | None | 0 0
  1. inputTable = {
  2.   SOtop = "if rs.getOutput(\"top\") then\
  3. \
  4. rs.setOutput( \"top\", false )\
  5. \
  6. else\
  7. \
  8. rs.setOutput( \"top\", true )\
  9. \
  10. end",
  11.   onSetting = "os.pullEvent = os.pullEventRaw\
  12. \
  13. term.setTextColor( colours.red )\
  14. print(\"Lights On!\")\
  15. \
  16. if fs.exists(\"/.onA1\") then\
  17. \
  18. shell.run(\"SOtop\")\
  19. \
  20. end\
  21. \
  22. if fs.exists(\"/.onA2\") then\
  23. \
  24. shell.run(\"SOright\")\
  25. \
  26. end\
  27. \
  28. if fs.exists(\"/.onA3\") then\
  29. \
  30. shell.run(\"SObottom\")\
  31. \
  32. end\
  33. \
  34. if fs.exists(\"/.onA4\") then\
  35. \
  36. shell.run(\"SOleft\")\
  37. \
  38. end\
  39. \
  40. if fs.exists(\"/.onA5\") then\
  41. \
  42. shell.run(\"SOback\")\
  43. \
  44. end\
  45. \
  46. shell.run(\"afterPass\")\
  47. term.setCursorPos( 5, 15 )\
  48. shell.run(\"OSterm\")",
  49.   startScreen = "os.pullEvent = os.pullEventRaw\
  50. \
  51. function SS()\
  52. \
  53. term.setCursorPos( 1, 1 )\
  54. term.setBackgroundColor( colours.blue )\
  55. term.setTextColor( colours.lime )\
  56. term.clear()\
  57. \
  58. shell.run(\"OSsig\")\
  59. print()\
  60. \
  61. term.setTextColor( colours.black )\
  62. print(\"Welcome to Kersey operating system!\")\
  63. print(\"accessing files, please wait...\")\
  64. print()\
  65. \
  66. end\
  67. \
  68. function perc()\
  69. \
  70. SS()\
  71. term.setTextColor( colours.white )\
  72. \
  73. end\
  74. \
  75. sleep(1)\
  76. perc()\
  77. print(\"  2 %\")\
  78. print(\"--------------------\")\
  79. sleep(1)\
  80. SS()\
  81. perc()\
  82. print(\"  5 %\")\
  83. print(\"+-------------------\")\
  84. sleep(1)\
  85. SS()\
  86. perc()\
  87. print(\" 12 %\")\
  88. print(\"++------------------\")\
  89. sleep(1)\
  90. SS()\
  91. perc()\
  92. print(\" 19 %\")\
  93. print(\"+++-----------------\")\
  94. sleep(1)\
  95. SS()\
  96. perc()\
  97. print(\" 31 %\")\
  98. print(\"++++++--------------\")\
  99. sleep(1)\
  100. SS()\
  101. perc()\
  102. print(\" 46 %\")\
  103. print(\"+++++++++-----------\")\
  104. sleep(1)\
  105. SS()\
  106. perc()\
  107. print(\" 58 %\")\
  108. print(\"+++++++++++---------\")\
  109. sleep(1)\
  110. SS()\
  111. perc()\
  112. print(\" 70 %\")\
  113. print(\"++++++++++++++------\")\
  114. sleep(1)\
  115. SS()\
  116. perc()\
  117. print(\" 83 %\")\
  118. print(\"++++++++++++++++----\")\
  119. sleep(1)\
  120. SS()\
  121. perc()\
  122. print(\" 95 %\")\
  123. print(\"+++++++++++++++++++-\")\
  124. sleep(1)\
  125. SS()\
  126. perc()\
  127. print(\"100 %\")\
  128. print(\"====================\")\
  129. sleep(1)\
  130. print()\
  131. \
  132. term.setTextColor( colours.black )\
  133. print(\"Files found, applying.\")\
  134. sleep(2)\
  135. shell.run(\"beforePass\")",
  136.   onSetup = "os.pullEvent = os.pullEventRaw\
  137. \
  138. if fs.exists(\"/.yes2\") then\
  139.  \
  140.  shell.run(\"pass4\")\
  141.  \
  142. elseif fs.exists(\"/.no2\") then\
  143. \
  144.  term.setTextColor( colours.red )\
  145.  print(\"Door Open!\")\
  146.  shell.run(\"RSmenu1\")\
  147.  \
  148. else\
  149. \
  150.  term.clear()\
  151.  shell.run(\"afterPass\")\
  152.  term.setCursorPos( 5, 15 )\
  153.  term.setTextColor( colours.lime )\
  154. \
  155.  print(\"Would you like to\")\
  156.  print(\"    password this file?\")\
  157.  print()\
  158.    \
  159.  yes = \"yes\"\
  160.  no = \"no\"\
  161.  \
  162.  term.setTextColor( colours.blue )\
  163.  write(\"yes/no: \")\
  164. \
  165.  term.setTextColor( colours.lime )\
  166.  input = read()\
  167.  \
  168.   if input == yes then\
  169.   \
  170.    file = fs.open( \"/.yes2\", \"w\" )\
  171.    file.write(input)\
  172.    file.close()\
  173.    \
  174.    shell.run(\"pass4\")\
  175.    \
  176.   elseif input == no then\
  177.   \
  178.    file = fs.open( \"/.no2\", \"w\" )\
  179.    file.write(input)\
  180.    file.close()\
  181.    \
  182.    shell.run(\"RSmenu1\")\
  183.    \
  184.   else\
  185.   \
  186.    term.setTextColor( colours.red )\
  187.    print(\"That is not an option!\")\
  188.    sleep(2)\
  189.    \
  190.    shell.run(\"onSetup\")\
  191.    \
  192.   end\
  193.  end",
  194.   openSetting = "os.pullEvent = os.pullEventRaw\
  195. \
  196. term.setTextColor( colours.red )\
  197. print(\"Door Open!\")\
  198. \
  199. if fs.exists(\"/.openA1\") then\
  200. \
  201. shell.run(\"outputTop\")\
  202. \
  203. end\
  204. \
  205. if fs.exists(\"/.openA2\") then\
  206. \
  207. shell.run(\"outputRight\")\
  208. \
  209. end\
  210. \
  211. if fs.exists(\"/.openA3\") then\
  212. \
  213. shell.run(\"outputBottom\")\
  214. \
  215. end\
  216. \
  217. if fs.exists(\"/.openA4\") then\
  218. \
  219. shell.run(\"outputLeft\")\
  220. \
  221. end\
  222. \
  223. if fs.exists(\"/.openA5\") then\
  224. \
  225. shell.run(\"outputBack\")\
  226. \
  227. end\
  228. \
  229. shell.run(\"afterPass\")\
  230. term.setCursorPos( 5, 15 )\
  231. shell.run(\"OSterm\")",
  232.   outputBottom = "rs.setOutput(\"bottom\", true )\
  233. sleep(3)\
  234. rs.setOutput(\"bottom\", false )",
  235.   afterPass = "term.setBackgroundColor( colours.black )\
  236. term.setCursorPos( 1, 1 )\
  237. term.clear()\
  238. \
  239. shell.run(\"OSsig\")\
  240. print()\
  241. \
  242. term.setTextColor( colours.blue )\
  243. \
  244. -- 32 spaces --\
  245. \
  246. print(\" +----------------------------------+\")\
  247. print(\" |                                  |\")\
  248. print(\" |                                  |\")\
  249. print(\" |                                  |\")\
  250. print(\" |                                  |\")\
  251. print(\" |                                  |\")\
  252. print(\" |                                  |\")\
  253. print(\" |                                  |\")\
  254. print(\" |                                  |\")\
  255. print(\" |                                  |\")\
  256. print(\" +----------------------------------+\")\
  257. print()\
  258. \
  259. term.setTextColor( colours.red )\
  260. \
  261. term.setCursorPos( 4, 5 )\
  262. print(\"Open Door ................. open\")\
  263. print()\
  264. \
  265. term.setCursorPos( 4, 7 )\
  266. print(\"Lights On/Off ........... lights\")\
  267. print()\
  268. \
  269. term.setCursorPos( 4, 9 )\
  270. print(\"Change User Setting ..... change\")\
  271. print()\
  272. \
  273. term.setCursorPos( 4, 11 )\
  274. print(\"Uninstall ............ uninstall\")\
  275. term.setCursorPos( 5, 15 )",
  276.   acc2 = "--------[ ACCOUNT 1 SETUP ]--------\
  277. \
  278. term.setBackgroundColor( colours.white )\
  279. term.setTextColor( colours.lime )\
  280. term.setCursorPos( 1, 1 )\
  281. term.clear()\
  282. shell.run(\"OSsig\")\
  283. \
  284. function acc2()\
  285. \
  286. if fs.exists(\"/.account2\") then\
  287. \
  288.  term.setTextColor( colours.blue )\
  289.  \
  290.  print()\
  291.  write(\"Username: \")\
  292.  file = fs.open(\"/.account2\",\"r\")\
  293.  acc1 = file.readAll()\
  294.  file.close()\
  295. \
  296.  term.setTextColor( colours.black )\
  297.  \
  298.  acc1A = read()\
  299. \
  300.   if acc1A == acc1 then\
  301.  \
  302.    shell.run(\"pass2\")\
  303.   \
  304.   else\
  305.  \
  306.    term.setTextColor( colours.red )\
  307.    print(\"Account does not exist!\")\
  308.    sleep(2)\
  309.    shell.run(\"acc2\")\
  310. \
  311.   end\
  312.  \
  313.  elseif not fs.exists(\"/.account2\") then\
  314.    \
  315.   term.setTextColor( colours.blue )\
  316.   \
  317.   print()\
  318.   write(\"New Username: \")\
  319.   \
  320.   term.setTextColor( colours.black )\
  321.   \
  322.   newUser1 = read()\
  323.   file = fs.open(\"/.account2\",\"w\")\
  324.   file.write(newUser1)\
  325.   file.close()\
  326.   \
  327.    if not fs.exists(\"/.iopen\") then\
  328.     \
  329.     file = fs.open(\"/.iopen\", \"w\")\
  330.     file.write(input)\
  331.     file.close()\
  332.     \
  333.    end\
  334.    \
  335.    if not fs.exists(\"/.ion\") then\
  336.    \
  337.     file = fs.open(\"/.ion\", \"w\")\
  338.     file.write(input)\
  339.     file.close()\
  340.     \
  341.    end\
  342.   \
  343.   term.setTextColor( colours.red )\
  344.   \
  345.   print(\"New Username is set.\")\
  346.   sleep(2)\
  347.   acc2()\
  348. \
  349. end\
  350. end\
  351. \
  352. acc2()",
  353.   outputLeft = "rs.setOutput(\"left\", true )\
  354. sleep(3)\
  355. rs.setOutput(\"left\", false )",
  356.   RSmenu1 = "term.setBackgroundColor( colours.black )\
  357. term.setCursorPos( 1, 1 )\
  358. term.clear()\
  359. \
  360. shell.run(\"OSsig\")\
  361. print()\
  362. \
  363. term.setTextColor( colours.blue )\
  364. \
  365. -- 32 spaces --\
  366. \
  367. print(\" +----------------------------------+\")\
  368. print(\" |                                  |\")\
  369. print(\" |                                  |\")\
  370. print(\" |                                  |\")\
  371. print(\" |                                  |\")\
  372. print(\" |                                  |\")\
  373. print(\" |                                  |\")\
  374. print(\" |                                  |\")\
  375. print(\" |                                  |\")\
  376. print(\" |                                  |\")\
  377. print(\" |                                  |\")\
  378. print(\" |                                  |\")\
  379. print(\" +----------------------------------+\")\
  380. print()\
  381. \
  382. term.setTextColor( colours.red )\
  383. \
  384. term.setCursorPos( 4, 5 )\
  385. print(\"Output top ................. top\")\
  386. print()\
  387. \
  388. term.setCursorPos( 4, 7 )\
  389. print(\"Output Right ............. right\")\
  390. print()\
  391. \
  392. term.setCursorPos( 4, 9 )\
  393. print(\"Output Bottom ........... bottom\")\
  394. print()\
  395. \
  396. term.setCursorPos( 4, 11 )\
  397. print(\"Output Left ............... left\")\
  398. print()\
  399. \
  400. term.setCursorPos( 4, 13 )\
  401. print(\"Output Back ............... back\")\
  402. term.setCursorPos( 5, 17 )\
  403. shell.run(\"OOselect\")",
  404.   pass3 = "--------[ ACCOUNT 1 SETUP ]--------\
  405. \
  406. function pass3()\
  407. \
  408. if fs.exists(\"/.password3\") then\
  409. \
  410.  term.setTextColor( colours.blue )\
  411.  \
  412.  write(\"Password: \")\
  413.  term.setTextColor( colours.lime )\
  414.  acc1A = read(\"*\")\
  415.  \
  416.  file = fs.open(\"/.password3\",\"r\")\
  417.  acc1 = file.readAll()\
  418.  file.close()\
  419. \
  420.   if acc1A == acc1 then\
  421.   \
  422.   else\
  423.  \
  424.    term.setTextColor( colours.red )\
  425.    print(\"Access Denied!\")\
  426.    sleep(2)\
  427.    shell.run(\"pass3\")\
  428. \
  429.   end\
  430.  \
  431.  elseif not fs.exists(\"/.password3\") then\
  432.    \
  433.   term.setTextColor( colours.blue )\
  434.   \
  435.   write(\"New Password: \")\
  436.   term.setTextColor( colours.black )\
  437.   newUser1 = read(\"*\")\
  438.   \
  439.   file = fs.open(\"/.password3\",\"w\")\
  440.   file.write(newUser1)\
  441.   file.close()\
  442.   \
  443.   term.setTextColor( colours.red )\
  444.   print(\"New Password is set.\")\
  445.   sleep(2)\
  446.   \
  447.   pass3()\
  448. \
  449. end\
  450. end\
  451. \
  452. pass3()\
  453. \
  454. if not fs.exists(\"/.iopen\") then\
  455. \
  456.  shell.run(\"openSetting\")\
  457.  \
  458. end\
  459. \
  460. if fs.exists(\"/.iopen\") then\
  461. \
  462.  shell.run(\"RSmenu\")\
  463.  \
  464. end",
  465.   outputBack = "rs.setOutput(\"back\", true )\
  466. sleep(3)\
  467. rs.setOutput(\"back\", false )",
  468.   pass5 = "--------[ ACCOUNT 1 SETUP ]--------\
  469. \
  470. function pass5()\
  471. \
  472. if fs.exists(\"/.password5\") then\
  473. \
  474.  term.setTextColor( colours.blue )\
  475.  \
  476.  write(\"Password: \")\
  477.  term.setTextColor( colours.lime )\
  478.  acc1A = read(\"*\")\
  479.  \
  480.  file = fs.open(\"/.password5\",\"r\")\
  481.  acc1 = file.readAll()\
  482.  file.close()\
  483. \
  484.   if acc1A == acc1 then\
  485.  \
  486.    term.setTextColor( colours.red )\
  487.    print(\"Ready to change!\")\
  488.    sleep(2)\
  489.    \
  490.   else\
  491.  \
  492.    term.setTextColor( colours.red )\
  493.    print(\"Access Denied!\")\
  494.    sleep(2)\
  495.    shell.run(\"pass5\")\
  496. \
  497.   end\
  498.  \
  499.  elseif not fs.exists(\"/.password5\") then\
  500.    \
  501.   term.setTextColor( colours.blue )\
  502.   \
  503.   write(\"New Password: \")\
  504.   term.setTextColor( colours.black )\
  505.   newUser1 = read(\"*\")\
  506.   \
  507.   file = fs.open(\"/.password5\",\"w\")\
  508.   file.write(newUser1)\
  509.   file.close()\
  510.   \
  511.   term.setTextColor( colours.red )\
  512.   print(\"New Password is set.\")\
  513.   sleep(2)\
  514.   \
  515.   pass5()\
  516. \
  517. end\
  518. end\
  519. \
  520. pass5()\
  521. shell.run(\"change\")",
  522.   beforePass = "os.pullEvent = os.pullEventRaw\
  523. \
  524. in1 = \"1\"\
  525. in2 = \"2\"\
  526. \
  527. term.setTextColor( colours.red )\
  528. print()\
  529. \
  530. write(\"Select Account ( 1/2 ): \")\
  531. input = read()\
  532. \
  533. if input == in1 then\
  534. \
  535.  shell.run(\"acc1\")\
  536.  \
  537. elseif input == in2 then\
  538. \
  539.  shell.run(\"acc2\")\
  540.  \
  541. else\
  542. \
  543.  print(\"Account does not exist!\")\
  544.  sleep(2)\
  545.  shell.run(\"beforePass\")\
  546.  \
  547. end",
  548.   outputTop = "rs.setOutput(\"top\", true )\
  549. sleep(3)\
  550. rs.setOutput(\"top\", false )",
  551.   pass4 = "--------[ ACCOUNT 1 SETUP ]--------\
  552. \
  553. function pass4()\
  554. \
  555. if fs.exists(\"/.password4\") then\
  556. \
  557.  term.setTextColor( colours.blue )\
  558.  \
  559.  write(\"Password: \")\
  560.  term.setTextColor( colours.lime )\
  561.  acc1A = read(\"*\")\
  562.  \
  563.  file = fs.open(\"/.password4\",\"r\")\
  564.  acc1 = file.readAll()\
  565.  file.close()\
  566. \
  567.   if acc1A == acc1 then\
  568.  \
  569.    term.setTextColor( colours.red )\
  570.    print(\"Lights On!\")\
  571.   \
  572.   else\
  573.  \
  574.    term.setTextColor( colours.red )\
  575.    print(\"Access Denied!\")\
  576.    sleep(2)\
  577.    shell.run(\"pass4\")\
  578. \
  579.   end\
  580.  \
  581.  elseif not fs.exists(\"/.password4\") then\
  582.    \
  583.   term.setTextColor( colours.blue )\
  584.   \
  585.   write(\"New Password: \")\
  586.   term.setTextColor( colours.black )\
  587.   newUser1 = read(\"*\")\
  588.   \
  589.   file = fs.open(\"/.password4\",\"w\")\
  590.   file.write(newUser1)\
  591.   file.close()\
  592.   \
  593.   term.setTextColor( colours.red )\
  594.   print(\"New Password is set.\")\
  595.   sleep(2)\
  596.   \
  597.   pass4()\
  598. \
  599. end\
  600. end\
  601. \
  602. pass4()\
  603. shell.run(\"RSmenu1\")",
  604.   uninstall = "os.pullEvent = os.pullEventRaw\
  605. \
  606. term.setTextColor( colours.lime )\
  607. term.setCursorPos( 5, 15 )\
  608. \
  609. in1 = \"yes\"\
  610. in2 = \"no\"\
  611. \
  612. print(\"Are you sure you want\")\
  613. print(\"    to uninstall your OS?\")\
  614. print()\
  615. \
  616. term.setTextColor( colours.blue )\
  617. write(\"yes/no: \")\
  618. term.setTextColor( colours.lime )\
  619. input = read()\
  620. \
  621. if input == in1 then\
  622. \
  623.  if fs.exists(\"/.account1\") then\
  624.   fs.delete(\"/.account1\")\
  625.  end\
  626.  \
  627.  if fs.exists(\"/.account2\") then\
  628.   fs.delete(\"/.account2\")\
  629.  end\
  630.  \
  631.  if fs.exists(\"/.password2\") then\
  632.   fs.delete(\"/.password2\") \
  633.  end\
  634.  \
  635.  if fs.exists(\"/.password3\") then\
  636.   fs.delete(\"/.password3\")\
  637.  end\
  638.  \
  639.  if fs.exists(\"/.password5\") then\
  640.   fs.delete(\"/.password5\")\
  641.  end\
  642.  \
  643.  if fs.exists(\"/.yes1\") then\
  644.   fs.delete(\"/.yes1\")\
  645.  end\
  646.  \
  647.  \
  648.  if fs.exists(\"/.yes2\") then\
  649.   fs.delete(\"/.yes2\")\
  650.  end\
  651.  \
  652.  if fs.exists(\"/.yes3\") then\
  653.   fs.delete(\"/.yes3\")\
  654.  end\
  655.  \
  656.  if fs.exists(\"/.no1\") then\
  657.   fs.delete(\"/.no1\")\
  658.  end\
  659.  \
  660.  if fs.exists(\"/.no2\") then\
  661.   fs.delete(\"/.no2\")\
  662.  end\
  663.  \
  664.  if fs.exists(\"/.no3\") then\
  665.   fs.delete(\"/.no3\")\
  666.  end\
  667.  \
  668.  if fs.exists(\"/.password1\") then\
  669.   fs.delete(\"/.password1\")\
  670.  end\
  671.  \
  672.  if fs.exists(\"/.password4\") then\
  673.   fs.delete(\"/.password4\")\
  674.  end\
  675.  \
  676.  if fs.exists(\"/.iopen\") then\
  677.   fs.delete(\"/.iopen\")\
  678.  end\
  679.  \
  680.  if fs.exists(\"/.openA1\") then\
  681.   fs.delete(\"/.openA1\")\
  682.  end\
  683.  \
  684.  if fs.exists(\"/.openA2\") then\
  685.   fs.delete(\"/.openA2\")\
  686.  end\
  687.  \
  688.  if fs.exists(\"/.openA3\") then\
  689.   fs.delete(\"/.openA3\")\
  690.  end\
  691.  \
  692.  if fs.exists(\"/.openA4\") then\
  693.   fs.delete(\"/.openA4\")\
  694.  end\
  695.  \
  696.  if fs.exists(\"/.openA5\") then\
  697.   fs.delete(\"/.openA5\")\
  698.  end\
  699.  \
  700.  if fs.exists(\"/.onA1\") then\
  701.   fs.delete(\"/.onA1\")\
  702.  end\
  703.  \
  704.  if fs.exists(\"/.onA2\") then\
  705.   fs.delete(\"/.onA2\")\
  706.  end\
  707.  \
  708.  if fs.exists(\"/.onA3\") then\
  709.   fs.delete(\"/.onA3\")\
  710.  end\
  711.  \
  712.  if fs.exists(\"/.onA4\") then\
  713.   fs.delete(\"/.onA4\")\
  714.  end\
  715.  \
  716.  if fs.exists(\"/.onA5\") then\
  717.   fs.delete(\"/.onA5\")\
  718.  end\
  719.  \
  720.  if fs.exists(\"uninstall\") then\
  721.   fs.delete(\"uninstall\")\
  722.  end\
  723.  \
  724.  if fs.exists(\"/.ion\") then\
  725.   fs.delete(\"/.ion\")\
  726.  end\
  727.        \
  728. fs.delete(\"startup\")\
  729. fs.delete(\"startScreen\")\
  730. fs.delete(\"acc1\")\
  731. fs.delete(\"acc2\")\
  732. fs.delete(\"pass1\")\
  733. fs.delete(\"pass2\")\
  734. fs.delete(\"pass3\")\
  735. fs.delete(\"pass4\")\
  736. fs.delete(\"pass5\")\
  737. fs.delete(\"beforePass\")\
  738. fs.delete(\"afterPass\")\
  739. fs.delete(\"changeSetup\")\
  740. fs.delete(\"openSetup\")\
  741. fs.delete(\"onSetup\")\
  742. fs.delete(\"change\")\
  743. fs.delete(\"OSsig\")\
  744. fs.delete(\"OSterm\")\
  745. fs.delete(\"ROselect\")\
  746. fs.delete(\"RSmenu\")\
  747. fs.delete(\"openSetting\")\
  748. fs.delete(\"outputTop\")\
  749. fs.delete(\"outputRight\")\
  750. fs.delete(\"outputBottom\")\
  751. fs.delete(\"outputLeft\")\
  752. fs.delete(\"outputBack\")\
  753. fs.delete(\"onSetting\")\
  754. fs.delete(\"RSmenu1\")\
  755. fs.delete(\"OOselect\")\
  756. fs.delete(\"SOtop\")\
  757. fs.delete(\"SOright\")\
  758. fs.delete(\"SObottom\")\
  759. fs.delete(\"SOleft\")\
  760. fs.delete(\"SOback\")\
  761. os.shutdown()\
  762. \
  763. elseif input == in2 then\
  764. \
  765. shell.run(\"afterPass\")\
  766. shell.run(\"OSterm\")\
  767. \
  768. else\
  769. \
  770. term.setTextColor( colours.red )\
  771. print(\"that is not an option\")\
  772. sleep(2)\
  773. shell.run(\"afterPass\")\
  774. shell.run(\"OSterm\")\
  775. shell.run(\"uninstall\")\
  776. \
  777. end\
  778.  ",
  779.   startup = "os.pullEvent = os.pullEventRaw\
  780. \
  781. if fs.exists(\"startup\") then\
  782. \
  783. function S() \
  784.  \
  785.  term.clear()\
  786.  term.setCursorPos( 1, 1 )\
  787.  term.setTextColor( colours.lime )\
  788.  print(\"There is already an OS!\")\
  789.  print()\
  790.  term.setTextColor( colours.blue )\
  791.  print(\"Delete old OS to install\")\
  792.  print(\"Kersey Operating System\")\
  793.  sleep(1)\
  794.  S()\
  795. \
  796. end\
  797. \
  798. S()\
  799. \
  800. else\
  801. \
  802. function h1() \
  803.  \
  804.  term.setBackgroundColor( colours.blue )\
  805.  term.setTextColor( colours.lime )\
  806.  term.setCursorPos( 1, 1 )\
  807.  term.clear()\
  808. \
  809.  print(\"Installing KerseyOS\")\
  810.  term.setTextColor( colours.black )\
  811.  print()\
  812.  print(\"accessing KerseyOS files,\")\
  813.  print(\"please wait...\")\
  814.  print()\
  815.  term.setTextColor( colours.black )\
  816.  \
  817. end\
  818. \
  819. function h2()\
  820. \
  821.  term.setTextColor( colours.white )\
  822.  \
  823. end\
  824. \
  825. print()\
  826. sleep(1)\
  827. h1()\
  828. sleep(1)\
  829. \
  830. print(\"accounts\")\
  831. h2()\
  832. print(\"   0 %\")\
  833. print(\"--------------------\")\
  834. sleep(1)\
  835. h1()\
  836. \
  837. print(\"passwords\")\
  838. h2()\
  839. print(\"   1 %\")\
  840. print(\"--------------------\")\
  841. sleep(1)\
  842. h1()\
  843. \
  844. print(\"startup\")\
  845. h2()\
  846. print(\"   2 %\")\
  847. print(\"--------------------\")\
  848. print()\
  849. sleep(1)\
  850. h1()\
  851. \
  852. print(\"redstone\")\
  853. h2()\
  854. print(\"  32 %\")\
  855. print(\"++++++--------------\")\
  856. sleep(1)\
  857. h1()\
  858. \
  859. print(\"routine sys\")\
  860. h2()\
  861. print(\"  78 %\")\
  862. print(\"+++++++++++++++-----\")\
  863. sleep(1)\
  864. h1()\
  865. \
  866. print(\"uninstall\")\
  867. h2()\
  868. print(\"  81 %\")\
  869. print(\"++++++++++++++++----\")\
  870. sleep(1)\
  871. h1()\
  872. \
  873. print(\"uninstall\")\
  874. h2()\
  875. print(\" 100 %\")\
  876. print(\"====================\")\
  877. sleep(1)\
  878. print()\
  879. \
  880. term.setTextColor( colours.lime )\
  881. \
  882. fs.copy(\"disk/1\", \"startup\")\
  883. fs.copy(\"disk/acc1\", \"acc1\")\
  884. fs.copy(\"disk/acc2\", \"acc2\")\
  885. fs.copy(\"disk/pass1\", \"pass1\")\
  886. fs.copy(\"disk/pass2\", \"pass2\")\
  887. fs.copy(\"disk/OSsig\", \"OSsig\")\
  888. fs.copy(\"disk/OSterm\", \"OSterm\")\
  889. fs.copy(\"disk/beforePass\", \"beforePass\")\
  890. fs.copy(\"disk/afterPass\", \"afterPass\")\
  891. fs.copy(\"disk/changeSetup\", \"changeSetup\")\
  892. fs.copy(\"disk/openSetup\", \"openSetup\")\
  893. fs.copy(\"disk/change\", \"change\")\
  894. fs.copy(\"disk/uninstall\", \"uninstall\")\
  895. fs.copy(\"disk/pass3\", \"pass3\")\
  896. fs.copy(\"disk/pass4\", \"pass4\")\
  897. fs.copy(\"disk/pass5\", \"pass5\")\
  898. fs.copy(\"disk/startScreen\", \"startScreen\")\
  899. fs.copy(\"disk/outputTop\", \"outputTop\")\
  900. fs.copy(\"disk/outputRight\", \"outputRight\")\
  901. fs.copy(\"disk/outputBottom\", \"outputBottom\")\
  902. fs.copy(\"disk/outputLeft\", \"outputLeft\")\
  903. fs.copy(\"disk/outputBack\", \"outputBack\")\
  904. fs.copy(\"disk/RSmenu\", \"RSmenu\")\
  905. fs.copy(\"disk/ROselect\", \"ROselect\")\
  906. fs.copy(\"disk/openSetting\", \"openSetting\")\
  907. fs.copy(\"disk/onSetup\", \"onSetup\")\
  908. fs.copy(\"disk/OOselect\", \"OOselect\")\
  909. fs.copy(\"disk/onSetting\", \"onSetting\")\
  910. fs.copy(\"disk/RSmenu1\", \"RSmenu1\")\
  911. fs.copy(\"disk/SOtop\", \"SOtop\")\
  912. fs.copy(\"disk/SOright\", \"SOright\")\
  913. fs.copy(\"disk/SObottom\", \"SObottom\")\
  914. fs.copy(\"disk/SOleft\", \"SOleft\")\
  915. fs.copy(\"disk/SOback\", \"SOback\")\
  916. \
  917. print(\"Kersey Operating System installed!\")\
  918. sleep(2)\
  919. shell.run(\"startup\")\
  920. \
  921. end",
  922.   change = "os.pullEvent = os.pullEventRaw\
  923. \
  924. term.setTextColor( colours.red )\
  925. \
  926. if fs.exists(\"/.account1\") then\
  927.  fs.delete(\"/.account1\")\
  928. end\
  929. \
  930. print(\"account1 deleted\")\
  931. \
  932. if fs.exists(\"/.password1\") then\
  933.  fs.delete(\"/.password1\")\
  934. end\
  935. \
  936. print(\"password1 deleted\")\
  937. \
  938. if fs.exists(\"/.account2\") then\
  939.  fs.delete(\"/.account2\")\
  940. end\
  941. \
  942. print(\"account2 deleted\") \
  943. \
  944. if fs.exists(\"/.password2\") then\
  945.  fs.delete(\"/.password2\")\
  946. end\
  947. \
  948. print(\"password2 deleted\")\
  949. \
  950. term.setTextColor( colours.red )\
  951. print(\"Ready to change\")\
  952. \
  953. shell.run(\"afterPass\")\
  954. shell.run(\"OSterm\")",
  955.   SOback = "if rs.getOutput(\"back\") then\
  956. \
  957. rs.setOutput( \"back\", false )\
  958. \
  959. else\
  960. \
  961. rs.setOutput( \"back\", true )\
  962. \
  963. end",
  964.   pass2 = "--------[ ACCOUNT 1 SETUP ]--------\
  965. \
  966. function pass2()\
  967. \
  968. if fs.exists(\"/.password2\") then\
  969. \
  970.  term.setTextColor( colours.blue )\
  971.  \
  972.  write(\"Password: \")\
  973.  file = fs.open(\"/.password2\",\"r\")\
  974.  acc1 = file.readAll()\
  975.  file.close()\
  976. \
  977.  term.setTextColor( colors.black )\
  978.  \
  979.  acc1A = read(\"*\")\
  980. \
  981.   if acc1A == acc1 then\
  982.  \
  983.    term.setTextColor( colours.lime )\
  984.    print(\"Door Open!\")\
  985.   \
  986.   else\
  987.  \
  988.    term.setTextColor( colours.red )\
  989.    print(\"Access Denied!\")\
  990.    sleep(2)\
  991.    os.shutdown()\
  992. \
  993.   end\
  994.  \
  995.  elseif not fs.exists(\"/.password2\") then\
  996.    \
  997.   term.setTextColor( colours.blue )\
  998.   \
  999.   print()\
  1000.   write(\"New Password: \")\
  1001.   \
  1002.   term.setTextColor( colours.black )\
  1003.   \
  1004.   newUser1 = read(\"*\")\
  1005.   \
  1006.   term.setTextColor( colours.black )\
  1007.   \
  1008.   file = fs.open(\"/.password2\",\"w\")\
  1009.   file.write(newUser1)\
  1010.   file.close()\
  1011.   term.setTextColor( colours.red )\
  1012.   print(\"New Password is set.\")\
  1013.   sleep(2)\
  1014.   pass2()\
  1015. \
  1016. end\
  1017. end\
  1018. \
  1019. pass2()\
  1020. shell.run(\"afterPass\")\
  1021. shell.run(\"OSterm\")",
  1022.   SOleft = "if rs.getOutput(\"left\") then\
  1023. \
  1024. rs.setOutput( \"left\", false )\
  1025. \
  1026. else\
  1027. \
  1028. rs.setOutput( \"left\", true )\
  1029. \
  1030. end",
  1031.   SOright = "if rs.getOutput(\"right\") then\
  1032. \
  1033. rs.setOutput( \"right\", false )\
  1034. \
  1035. else\
  1036. \
  1037. rs.setOutput( \"right\", true )\
  1038. \
  1039. end",
  1040.   OOselect = "os.pullEvent = os.pullEventRaw\
  1041. \
  1042. if fs.exists(\"/.ion\") then\
  1043. \
  1044. fs.delete(\"/.ion\")\
  1045. \
  1046. in1 = \"top\"\
  1047. in2 = \"right\"\
  1048. in3 = \"bottom\"\
  1049. in4 = \"left\"\
  1050. in5 = \"back\"\
  1051. \
  1052. term.setTextColor( colours.lime )\
  1053. write(\"\")\
  1054. \
  1055. term.setTextColor( colours.lime )\
  1056. input = read()\
  1057. \
  1058. if input == in1 then\
  1059. \
  1060.  shell.run(\"SOtop\")\
  1061.  file = fs.open(\"/.onA1\", \"w\")\
  1062.  file.write(input)\
  1063.  file.close()\
  1064.  \
  1065. elseif input == in2 then\
  1066. \
  1067.  shell.run(\"SOright\")\
  1068.  file = fs.open(\"/.onA2\", \"w\")\
  1069.  file.write(input)\
  1070.  file.close()\
  1071.  \
  1072. elseif input == in3 then\
  1073. \
  1074.  shell.run(\"SObottom\")\
  1075.  file = fs.open(\"/.onA3\", \"w\")\
  1076.  file.write(input)\
  1077.  file.close()\
  1078.  \
  1079. elseif input == in4 then\
  1080. \
  1081.  shell.run(\"SOleft\")\
  1082.  file = fs.open(\"/.onA4\", \"w\")\
  1083.  file.write(input)\
  1084.  file.close()\
  1085.  \
  1086. elseif input == in5 then\
  1087. \
  1088.  shell.run(\"SOback\")\
  1089.  file = fs.open(\"/.onA5\", \"w\")\
  1090.  file.write(input)\
  1091.  file.close()\
  1092.  \
  1093. else\
  1094. \
  1095.  term.setTextColor( colours.red )\
  1096.  print(\"That is not an option!\")\
  1097.  sleep(2)\
  1098.  term.clear()\
  1099.  shell.run(\"RSmenu1\")\
  1100.  term.setCursorPos( 5, 17 )\
  1101.  \
  1102.  shell.run(\"OOselect\")\
  1103.  \
  1104. end\
  1105. \
  1106. else\
  1107. \
  1108. shell.run(\"afterPass\")\
  1109. shell.run(\"onSetting\")\
  1110. \
  1111. end\
  1112. \
  1113. shell.run(\"afterPass\")\
  1114. term.setCursorPos( 5, 15 )\
  1115. shell.run(\"OSterm\") ",
  1116.   openSetup = "os.pullEvent = os.pullEventRaw\
  1117. \
  1118. if fs.exists(\"/.yes1\") then\
  1119.  \
  1120.  shell.run(\"pass3\")\
  1121.  \
  1122. elseif fs.exists(\"/.no1\") then\
  1123. \
  1124.  shell.run(\"openSetting\")\
  1125.  \
  1126. else\
  1127. \
  1128.  term.clear()\
  1129.  shell.run(\"afterPass\")\
  1130.  term.setCursorPos( 5, 15 )\
  1131.  term.setTextColor( colours.lime )\
  1132. \
  1133.  print(\"Would you like to\")\
  1134.  print(\"    password this file?\")\
  1135.  print()\
  1136.    \
  1137.  yes = \"yes\"\
  1138.  no = \"no\"\
  1139.  \
  1140.  term.setTextColor( colours.blue )\
  1141.  write(\"yes/no: \")\
  1142. \
  1143.  term.setTextColor( colours.lime )\
  1144.  input = read()\
  1145.  \
  1146.   if input == yes then\
  1147.   \
  1148.    file = fs.open( \"/.yes1\", \"w\" )\
  1149.    file.write(input)\
  1150.    file.close()\
  1151.    \
  1152.    shell.run(\"pass3\")\
  1153.    \
  1154.   elseif input == no then\
  1155.   \
  1156.    file = fs.open( \"/.no1\", \"w\" )\
  1157.    file.write(input)\
  1158.    file.close()\
  1159.    \
  1160.    shell.run(\"RSmenu\")\
  1161.    term.setCursorPos( 5, 17 )\
  1162.    shell.run(\"ROselect\")\
  1163.    \
  1164.   else\
  1165.   \
  1166.    term.setTextColor( colours.red )\
  1167.    print(\"That is not an option!\")\
  1168.    sleep(2)\
  1169.    \
  1170.    shell.run(\"openSetup\")\
  1171.    \
  1172.   end\
  1173.  end",
  1174.   OSsig = "term.setTextColor( colours.lime )\
  1175. print(\"KerseyOS v5.0\")",
  1176.   OSterm = "os.pullEvent = os.pullEventRaw\
  1177. \
  1178. in1 = \"open\"\
  1179. in2 = \"lights\"\
  1180. in4 = \"change\"\
  1181. in5 = \"uninstall\"\
  1182. \
  1183. term.setTextColor( colours.lime )\
  1184. write(\"\")\
  1185. \
  1186. term.setTextColor( colours.lime )\
  1187. input = read()\
  1188. \
  1189. if input == in1 then\
  1190. \
  1191.  shell.run(\"openSetup\")\
  1192.  \
  1193. elseif input == in2 then\
  1194. \
  1195.  shell.run(\"onSetup\")\
  1196.  \
  1197. elseif input == in4 then\
  1198. \
  1199.  shell.run(\"changeSetup\")\
  1200.  \
  1201. elseif input == in5 then\
  1202. \
  1203.  shell.run(\"uninstall\")\
  1204.  \
  1205. else\
  1206. \
  1207.  term.setTextColor( colours.red )\
  1208.  print(\"Program does not exist!\")\
  1209.  sleep(2)\
  1210.  term.clear()\
  1211.  shell.run(\"afterPass\")\
  1212.  term.setCursorPos( 5, 15 )\
  1213.  \
  1214.  shell.run(\"OSterm\")\
  1215.  \
  1216. end",
  1217.   pass1 = "--------[ ACCOUNT 1 SETUP ]--------\
  1218. \
  1219. function pass1()\
  1220. \
  1221. if fs.exists(\"/.password1\") then\
  1222. \
  1223.  term.setTextColor( colours.blue )\
  1224.  \
  1225.  write(\"Password: \")\
  1226.  file = fs.open(\"/.password1\",\"r\")\
  1227.  acc1 = file.readAll()\
  1228.  file.close()\
  1229. \
  1230.  term.setTextColor( colors.black )\
  1231.  \
  1232.  acc1A = read(\"*\")\
  1233. \
  1234.   if acc1A == acc1 then\
  1235.  \
  1236.    term.setTextColor( colours.lime )\
  1237.    print(\"Granted Succsess\")\
  1238.   \
  1239.   else\
  1240.  \
  1241.    term.setTextColor( colours.red )\
  1242.    print(\"Access Denied!\")\
  1243.    sleep(2)\
  1244.    os.shutdown()\
  1245. \
  1246.   end\
  1247.  \
  1248.  elseif not fs.exists(\"/.password1\") then\
  1249.    \
  1250.   term.setTextColor( colours.blue )\
  1251.   \
  1252.   write(\"New Password: \")\
  1253.   \
  1254.   term.setTextColor( colours.black )\
  1255.   \
  1256.   newUser1 = read(\"*\")\
  1257.   \
  1258.   term.setTextColor( colours.black )\
  1259.   \
  1260.   file = fs.open(\"/.password1\",\"w\")\
  1261.   file.write(newUser1)\
  1262.   file.close()\
  1263.   term.setTextColor( colours.red )\
  1264.   print(\"New Password is set.\")\
  1265.   sleep(2)\
  1266.   \
  1267.   pass1()\
  1268. \
  1269. end\
  1270. end\
  1271. \
  1272. pass1()\
  1273. shell.run(\"afterPass\")\
  1274. shell.run(\"OSterm\")",
  1275.   off = "term.setTextColor( colours.red )\
  1276. print(\"Lights Off!\")\
  1277. rs.setOutput( \"back\", false )\
  1278. sleep(2)\
  1279. \
  1280. shell.run(\"afterPass\")\
  1281. shell.run(\"OSterm\")",
  1282.   outputRight = "rs.setOutput(\"right\", true )\
  1283. sleep(3)\
  1284. rs.setOutput(\"right\", false )",
  1285.   ROselect = "os.pullEvent = os.pullEventRaw\
  1286. \
  1287. if fs.exists(\"/.iopen\") then\
  1288. \
  1289. fs.delete(\"/.iopen\")\
  1290. \
  1291. in1 = \"top\"\
  1292. in2 = \"right\"\
  1293. in3 = \"bottom\"\
  1294. in4 = \"left\"\
  1295. in5 = \"back\"\
  1296. \
  1297. term.setTextColor( colours.lime )\
  1298. write(\"\")\
  1299. \
  1300. term.setTextColor( colours.lime )\
  1301. input = read()\
  1302. \
  1303. if input == in1 then\
  1304. \
  1305.  shell.run(\"outputTop\")\
  1306.  file = fs.open(\"/.openA1\", \"w\")\
  1307.  file.write(input)\
  1308.  file.close()\
  1309.  \
  1310. elseif input == in2 then\
  1311. \
  1312.  shell.run(\"outputRight\")\
  1313.  file = fs.open(\"/.openA2\", \"w\")\
  1314.  file.write(input)\
  1315.  file.close()\
  1316.  \
  1317. elseif input == in3 then\
  1318. \
  1319.  shell.run(\"outputBottom\")\
  1320.  file = fs.open(\"/.openA3\", \"w\")\
  1321.  file.write(input)\
  1322.  file.close()\
  1323.  \
  1324. elseif input == in4 then\
  1325. \
  1326.  shell.run(\"outputLeft\")\
  1327.  file = fs.open(\"/.openA4\", \"w\")\
  1328.  file.write(input)\
  1329.  file.close()\
  1330.  \
  1331. elseif input == in5 then\
  1332. \
  1333.  shell.run(\"outputBack\")\
  1334.  file = fs.open(\"/.openA5\", \"w\")\
  1335.  file.write(input)\
  1336.  file.close()\
  1337.  \
  1338. else\
  1339. \
  1340.  term.setTextColor( colours.red )\
  1341.  print(\"That is not an option!\")\
  1342.  sleep(2)\
  1343.  term.clear()\
  1344.  shell.run(\"RSmenu\")\
  1345.  term.setCursorPos( 5, 17 )\
  1346.  \
  1347.  shell.run(\"ROselect\")\
  1348.  \
  1349. end\
  1350. \
  1351. else\
  1352. \
  1353. shell.run(\"openSetting\")\
  1354. \
  1355. end\
  1356. \
  1357. shell.run(\"afterPass\")\
  1358. term.setCursorPos( 5, 15 )\
  1359. shell.run(\"OSterm\") ",
  1360.   changeSetup = "os.pullEvent = os.pullEventRaw\
  1361. \
  1362. if fs.exists(\"/.yes3\") then\
  1363.  \
  1364.  shell.run(\"pass5\")\
  1365.  \
  1366. elseif fs.exists(\"/.no3\") then\
  1367. \
  1368.  term.setTextColor( colours.red )\
  1369.  print(\"Door Open!\")\
  1370.  shell.run(\"change\")\
  1371.  \
  1372. else\
  1373. \
  1374.  term.clear()\
  1375.  shell.run(\"afterPass\")\
  1376.  term.setCursorPos( 5, 15 )\
  1377.  term.setTextColor( colours.lime )\
  1378. \
  1379.  print(\"Would you like to\")\
  1380.  print(\"    password this file?\")\
  1381.  print()\
  1382.    \
  1383.  yes = \"yes\"\
  1384.  no = \"no\"\
  1385.  \
  1386.  term.setTextColor( colours.blue )\
  1387.  write(\"yes/no: \")\
  1388. \
  1389.  term.setTextColor( colours.lime )\
  1390.  input = read()\
  1391.  \
  1392.   if input == yes then\
  1393.   \
  1394.    file = fs.open( \"/.yes3\", \"w\" )\
  1395.    file.write(input)\
  1396.    file.close()\
  1397.    \
  1398.    shell.run(\"pass5\")\
  1399.    \
  1400.   elseif input == no then\
  1401.   \
  1402.    file = fs.open( \"/.no3\", \"w\" )\
  1403.    file.write(input)\
  1404.    file.close()\
  1405.    \
  1406.    shell.run(\"change\")\
  1407.    \
  1408.   else\
  1409.   \
  1410.    term.setTextColor( colours.red )\
  1411.    print(\"That is not an option!\")\
  1412.    sleep(2)\
  1413.    \
  1414.    shell.run(\"changeSetup\")\
  1415.    \
  1416.   end\
  1417.  end",
  1418.   RSmenu = "term.setBackgroundColor( colours.black )\
  1419. term.setCursorPos( 1, 1 )\
  1420. term.clear()\
  1421. \
  1422. shell.run(\"OSsig\")\
  1423. print()\
  1424. \
  1425. term.setTextColor( colours.blue )\
  1426. \
  1427. -- 32 spaces --\
  1428. \
  1429. print(\" +----------------------------------+\")\
  1430. print(\" |                                  |\")\
  1431. print(\" |                                  |\")\
  1432. print(\" |                                  |\")\
  1433. print(\" |                                  |\")\
  1434. print(\" |                                  |\")\
  1435. print(\" |                                  |\")\
  1436. print(\" |                                  |\")\
  1437. print(\" |                                  |\")\
  1438. print(\" |                                  |\")\
  1439. print(\" |                                  |\")\
  1440. print(\" |                                  |\")\
  1441. print(\" +----------------------------------+\")\
  1442. print()\
  1443. \
  1444. term.setTextColor( colours.red )\
  1445. \
  1446. term.setCursorPos( 4, 5 )\
  1447. print(\"Output top ................. top\")\
  1448. print()\
  1449. \
  1450. term.setCursorPos( 4, 7 )\
  1451. print(\"Output Right ............. right\")\
  1452. print()\
  1453. \
  1454. term.setCursorPos( 4, 9 )\
  1455. print(\"Output Bottom ........... bottom\")\
  1456. print()\
  1457. \
  1458. term.setCursorPos( 4, 11 )\
  1459. print(\"Output Left ............... left\")\
  1460. print()\
  1461. \
  1462. term.setCursorPos( 4, 13 )\
  1463. print(\"Output Back ............... back\")\
  1464. term.setCursorPos( 5, 17 )\
  1465. shell.run(\"ROselect\")",
  1466.   SObottom = "if rs.getOutput(\"bottom\") then\
  1467. \
  1468. rs.setOutput( \"bottom\", false )\
  1469. \
  1470. else\
  1471. \
  1472. rs.setOutput( \"bottom\", true )\
  1473. \
  1474. end",
  1475. }
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484. local function writeFile(path,content)
  1485.     local file = fs.open(path,"w")
  1486.     file.write(content)
  1487.     file.close()
  1488. end
  1489. function writeDown(input,dir)
  1490.         for i,v in pairs(input) do
  1491.         if type(v) == "table" then
  1492.             writeDown(v,dir.."/"..i)
  1493.         elseif type(v) == "string" then
  1494.             writeFile(dir.."/"..i,v)
  1495.         end
  1496.     end
  1497. end
  1498.  
  1499. args = {...}
  1500. if #args == 0 then
  1501.     print("Please input a destination folder.")
  1502. else
  1503.     writeDown(inputTable,args[1])
  1504. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement