Advertisement
joshgreatuk

LUAOS Startup 0.3.3 Indev

Jul 28th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.82 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. function pl(eid,t)
  3. term.clear()
  4. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  5. paintutils.drawFilledBox(1,1,51,3,colors.blue)
  6. paintutils.drawLine(2,2,50,2,colors.lightBlue)
  7. paintutils.drawLine(1,19,51,19,colors.blue)
  8. term.setBackgroundColor(colors.blue)
  9. term.setCursorPos(1,1)
  10. print("LUAOS App Library")
  11. local x1,y1 = 48,1
  12. local x2,y2 = 25,1
  13. local x3,y3 = 35,1
  14. local choice1 = "Exit"
  15. local choice2 = "Refresh"
  16. local choice3 = "Run"
  17. term.setCursorPos(x1,y1)
  18. write(choice1)
  19. term.setCursorPos(x2,y2)
  20. write(choice2)
  21. term.setCursorPos(x3,y3)
  22. write(choice3)
  23. while true do
  24. local event, button, cx, cy = os.pullEvent()
  25. if event == "mouse_click" then
  26. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  27. ag(eid,t)
  28. break
  29. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  30. dir = "LUAOS/C/Programs/"
  31. term.setBackgroundColor(colors.lightBlue)
  32. term.setCursorPos(1,4)
  33. local filelist = fs.list(dir)
  34. for _, file in ipairs(filelist) do
  35. print(file)
  36. end
  37. else if cx >= x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
  38. term.setCursorPos(2,2)
  39. term.setBackgroundColor(colors.lightBlue)
  40. print("File:")
  41. term.setCursorPos(7,2)
  42. run = read()
  43. frun = "/LUAOS/C/Programs/"..run
  44. if not fs.exists(frun) then
  45. term.setBackgroundColor(colors.blue)
  46. term.setCursorPos(2,3)
  47. print("program does not exist")
  48. sleep(3)
  49. pl(eid,t)
  50. break
  51. end
  52. shell.openTab(frun)
  53. pl(eid,t)
  54. end
  55. end
  56. end
  57. end
  58. end
  59. end
  60. function ad(app,eid,t)
  61. term.clear()
  62. if app == "network_manager" then
  63. term.clear()
  64. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  65. paintutils.drawLine(1,1,51,1,colors.blue)
  66. term.setBackgroundColor(colors.blue)
  67. term.setCursorPos(1,1)
  68. print("Download : "..app)
  69. local x1, y1 = 48,1
  70. local x2, y2 = 44,19
  71. local choice1 = "Exit"
  72. local choice2 = "Download"
  73. term.setBackgroundColor(colors.lightBlue)
  74. term.setCursorPos(1,3)
  75. print("Network Manager:")
  76. term.setCursorPos(1,5)
  77. print("Can be used to control a network of computers with an ender/wireless modem on top (NOTE:The modem must be on top of the computer otherwise this wont work). Can be used with server manager to create a network for a building or bigger")
  78. term.setBackgroundColor(colors.blue)
  79. term.setCursorPos(x1,y1)
  80. write(choice1)
  81. term.setBackgroundColor(colors.red)
  82. term.setCursorPos(x2,y2)
  83. write(choice2)
  84. while true do
  85. local event, button, cx, cy = os.pullEvent()
  86. if event == "mouse_click" then
  87. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  88. as(eid,t)
  89. else if cx >= x2 and cx < x2 + choice2:len() and cy == y1 and button == 1 then
  90. -- add download here
  91. end
  92. end
  93. end
  94. end
  95. else if app == "server_manager" then
  96. term.clear()
  97. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  98. paintutils.drawLine(1,1,51,1,colors.blue)
  99. term.setBackgroundColor(colors.blue)
  100. term.setCursorPos(1,1)
  101. print("Download : "..app)
  102. local x1, y1 = 48,1
  103. local x2, y2 = 44,19
  104. local choice1 = "Exit"
  105. local choice2 = "Download"
  106. term.setBackgroundColor(colors.lightBlue)
  107. term.setCursorPos(1,3)
  108. print("Server Manager:")
  109. term.setCursorPos(1,5)
  110. print("Can be used to control a network of hard drives connected by cable. can also be used with network manager to create a network for a building or bigger")
  111. term.setBackgroundColor(colors.blue)
  112. term.setCursorPos(x1,y1)
  113. write(choice1)
  114. term.setBackgroundColor(colors.red)
  115. term.setCursorPos(x2,y2)
  116. write(choice2)
  117. while true do
  118. local event, button, cx, cy = os.pullEvent()
  119. if event == "mouse_click" then
  120. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  121. as(eid,t)
  122. else if cx >= x2 and cx < x2 + choice2:len() and cy == y1 and button == 1 then
  123. -- add download here
  124. end
  125. end
  126. end
  127. end
  128. end
  129. end
  130. end
  131. function as(eid,t)
  132. term.clear()
  133. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  134. paintutils.drawLine(1,1,51,1,colors.blue)
  135. term.setBackgroundColor(colors.blue)
  136. term.setCursorPos(1,1)
  137. print("LUAOS App Store")
  138. local choice1 = "Exit"
  139. local choice2 = "Download"
  140. local x1, y1 = 48,1
  141. local x2, y2 = 44,2
  142. local x3, y3 = 44,3
  143. term.setCursorPos(x1,y1)
  144. write(choice1)
  145. term.setBackgroundColor(colors.red)
  146. term.setCursorPos(x2,y2)
  147. write(choice2)
  148. term.setCursorPos(x3,y3)
  149. write(choice2)
  150. term.setBackgroundColor(colors.lightBlue)
  151. term.setCursorPos(1,2)
  152. print("Network Manager:Manages Computer Networks")
  153. term.setCursorPos(1,3)
  154. print("Server Manager:Manages Server Networks")
  155. while true do
  156. local event, button, cx, cy = os.pullEvent()
  157. if event == "mouse_click" then
  158. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  159. ag(eid,t)
  160. break
  161. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  162. ad("network_manager",eid,t)
  163. break
  164. else if cx >= x3 and cx < x1 + choice3:len() and cy == y3 and button == 1 then
  165. ad("server_manager",eid,t)
  166. break
  167. end
  168. end
  169. end
  170. end
  171. end
  172. end
  173. function ag(eid,t)
  174. term.clear()
  175. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  176. paintutils.drawBox(1,1,51,19,colors.blue)
  177. term.setBackgroundColor(colors.lightBlue)
  178. if not fs.exists("/LUAOS/C/Programs") then
  179. term.setCursorPos(3,3)
  180. print("The LUAOS games and apps program is not")
  181. term.setCursorPos(3,4)
  182. print("installed ,do you want to install it now")
  183. term.setCursorPos(3,6)
  184. print("Y/N")
  185. local sevemt, param = os.pullEvent("key")
  186. if param == 21 then
  187. term.setCursorPos(3,8)
  188. print("installing now")
  189. fs.makeDir("/LUAOS/C/Programs")
  190. term.setCursorPos(3,10)
  191. print("installed")
  192. sleep(5)
  193. ag(eid,t)
  194. else if param == 49 then
  195. li(eid,t)
  196. else
  197. ag(eid,t)
  198. end
  199. end
  200. end
  201. term.clear()
  202. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  203. paintutils.drawBox(1,1,51,19,colors.blue)
  204. term.setBackgroundColor(colors.lightBlue)
  205. term.setCursorPos(3,3)
  206. print("Select the option you with to choose")
  207. choice1 = " App Store "
  208. choice2 = " Exit "
  209. choice3 = " Program Library "
  210. local x1, y1 = 3,5
  211. local x2, y2 = 3,7
  212. local x3, y3 = 3,9
  213. term.setBackgroundColor(colors.red)
  214. term.setCursorPos(x1,y1)
  215. write(choice1)
  216. term.setCursorPos(x2,y2)
  217. write(choice2)
  218. term.setCursorPos(x3,y3)
  219. write(choice3)
  220. while true do
  221. local event, button, cx, cy = os.pullEvent()
  222. if event == "mouse_click" then
  223. if cx >= x1 and cx < choice1:len() and cy == y1 and button == 1 then
  224. as(eid,t)
  225. break
  226. else if cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  227. li(eid,t)
  228. break
  229. else if cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  230. pl(eid,t)
  231. break
  232. end
  233. end
  234. end
  235. end
  236. end
  237. end
  238. function ac1(eid,t)
  239. term.clear()
  240. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  241. paintutils.drawBox(1,1,51,19,colors.blue)
  242. term.setBackgroundColor(colors.lightBlue)
  243. term.setCursorPos(3,3)
  244. print("Please type an ID to create or type exit")
  245. term.setCursorPos(3,5)
  246. print("ID:")
  247. term.setCursorPos(6,5)
  248. nid = read()
  249. if nid == "exit" then
  250. ac(eid,t)
  251. end
  252. term.setCursorPos(3,7)
  253. fs.makeDir("/LUAOS/S/Users/"..nid)
  254. term.setCursorPos(3,9)
  255. print("Now type a username and password")
  256. term.setCursorPos(3,11)
  257. print("Username:")
  258. term.setCursorPos(12,11)
  259. nu = read()
  260. term.setCursorPos(3,13)
  261. print("Password:")
  262. term.setCursorPos(12,13)
  263. np = read()
  264. f = fs.open("/LUAOS/S/Users/"..nid.."/u","w")
  265. f.write(nu)
  266. f.close()
  267. f = fs.open("/LUAOS/S/Users/"..nid.."/p","w")
  268. f.write(np)
  269. f.close()
  270. term.setCursorPos(3,15)
  271. print("finally time to enter the user's")
  272. term.setCursorPos(3,16)
  273. print("level of permission (a / n)")
  274. term.setCursorPos(3,18)
  275. print("Permission level:")
  276. term.setCursorPos(20,18)
  277. nt = read()
  278. if not nt == "a" and not nt == "n" then
  279. term.clear()
  280. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  281. paintutils.drawBox(1,1,51,19,colors.blue)
  282. term.setBackgroundColor(colors.lightBlue)
  283. term.setCursorPos(3,3)
  284. print("invalid permission level")
  285. sleep(5)
  286. ac(eid,t)
  287. end
  288. f= fs.open("/LUAOS/S/Users/"..nid.."/t","w")
  289. f.write(nt)
  290. f.close()
  291. term.clear()
  292. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  293. paintutils.drawBox(1,1,51,19,colors.blue)
  294. term.setBackgroundColor(colors.lightBlue)
  295. term.setCursorPos(3,3)
  296. print("Account created")
  297. sleep(5)
  298. ac(eid,t)
  299. end
  300. function ac2(eid,t)
  301. term.clear()
  302. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  303. paintutils.drawBox(1,1,51,19,colors.blue)
  304. term.setBackgroundColor(colors.lightBlue)
  305. term.setCursorPos(3,3)
  306. print("enter an ID to delete")
  307. term.setCursorPos(3,5)
  308. print("ID:")
  309. term.setCursorPos(6,5)
  310. did = read()
  311. did1 = "/LUAOS/S/Users/"..did
  312. if not fs.exists(did1) then
  313. term.setCursorPos(3,7)
  314. print("Invalid ID")
  315. sleep(5)
  316. ac(eid,t)
  317. end
  318. fs.delete(did1)
  319. term.clear()
  320. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  321. paintutils.drawBox(1,1,51,19,colors.blue)
  322. term.setBackgroundColor(colors.lightBlue)
  323. term.setCursorPos(3,3)
  324. print("Account deleted")
  325. sleep(5)
  326. ac(eid,t)
  327. end
  328. function fb(eid,t)
  329. dir = "/LUAOS/C/"
  330. print("directory:",dir)
  331. print("type a command")
  332. cmd = read()
  333. if cmd == "cd" then
  334. print("enter a directory to go to")
  335. ed = read()
  336. ede = dir..ed
  337. if not fs.exists(ede) then
  338. print("directory not found")
  339. fb(eid,t)
  340. else if ede == dir.."/" then
  341. dir = "/LUAOS"
  342. end
  343. end
  344. dir = ed
  345. fb(eid,t)
  346. else if cmd == "ls" then
  347. local filelist = fs.list(dir)
  348. for _, file in ipairs(filelist) do
  349. print(file)
  350. end
  351. fb(eid,t)
  352. else if cmd == "exit" then
  353. li(eid,t)
  354. else if cmd == "run" then
  355. print("enter a program directory to run")
  356. run = read()
  357. rune = dir..run
  358. if rune == "" then
  359. print("invalid program")
  360. fb(eid,t)
  361. end
  362. shell.openTab(rune)
  363. else if cmd == "help" then
  364. print("help guide:")
  365. print("cd: This command moves your directory to what you enter, if you enter '/' then it will put you at the directory /LUAOS")
  366. print("ls: This command will tell you all the files in your current directory")
  367. print("exit: This command will make you exit back to the LUAOS menu")
  368. print("run: This command will run any program in your current directory that you type as long as it is real")
  369. print("help: This command will bring up this help guide")
  370. print("move: This command will move an entered file in the current directory to an entered directory")
  371. print("delete: This command will delete an entered file in the current directory")
  372. fb(eid,t)
  373. else if cmd == "move" then
  374. print("enter the file to move in your current directory")
  375. file = read()
  376. filee = dir..file
  377. if not fs.exists(filee) then
  378. print("file does not exist")
  379. fb(eid,t)
  380. end
  381. print("enter the directory to move the file to (must be a full directory e.g /LUAOS/C/Programs)")
  382. fmd = read()
  383. if not fs.exists(fmd) then
  384. print("directory does not exist")
  385. fb(eid,t)
  386. end
  387. fs.move(filee,fmd)
  388. fb(eid,t)
  389. else if cmd == "delete" then
  390. print("enter the file in the current directory to delete")
  391. fdel = read()
  392. fdele = dir..fdele
  393. if not fs.exists(fdele) then
  394. print("file does not exist")
  395. fb(eid,t)
  396. end
  397. if fdele == "/LUAOS" or fdele == "/LUAOS/S" or fdele == "/LUAOS/S/Users" or fdele == "/LUAOS/S/Users/1" or fdele == "/LUAOS/C" then
  398. print("access denied")
  399. fb(eid,t)
  400. end
  401. else
  402. print("invalid command. Type 'help' to see all the commands")
  403. fb(eid,t)
  404. end
  405. end
  406. end
  407. end
  408. end
  409. end
  410. end
  411. end
  412. function ac(eid,t)
  413. term.clear()
  414. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  415. paintutils.drawBox(1,1,51,19,colors.blue)
  416. term.setBackgroundColour(colors.lightBlue)
  417. local x1, y1 = 3,5
  418. local x2, y2 = 3,7
  419. local x3, y3 = 3,9
  420. local choice1 = " Add Account "
  421. local choice2 = " Delete Account "
  422. local choice3 = " Exit "
  423. term.setCursorPos(3,3)
  424. print("Welcome to LUAOS account control")
  425. term.setBackgroundColor(colors.red)
  426. term.setCursorPos(x1,y1)
  427. write(choice1)
  428. term.setCursorPos(x2,y2)
  429. write(choice2)
  430. term.setCursorPos(x3,y3)
  431. write(choice3)
  432. while true do
  433. local event, button, cx, cy = os.pullEvent()
  434. if event == "mouse_click" then
  435. if cx >= x1 and cx < choice1:len() and cy == y1 and button == 1 then
  436. term.clear()
  437. ac1(eid,t)
  438. break
  439. end
  440. if cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  441. term.clear()
  442. ac2(eid,t)
  443. break
  444. end
  445. if cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  446. term.clear()
  447. li(eid,t)
  448. break
  449. end
  450. end
  451. end
  452. end
  453. function ud(v,eid,t)
  454. shell.run("pastebin get AC6USdEP version")
  455. term.clear()
  456. term.setCursorPos(3,3)
  457. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  458. paintutils.drawBox(1,1,51,19,colors.blue)
  459. term.setBackgroundColor(colors.lightBlue)
  460. f = fs.open("/version", "r")
  461. v = 0.33
  462. nv = tonumber(f.readAll())
  463. f.close()
  464. term.clear()
  465. term.setCursorPos(3,3)
  466. print("LUAOS version:"..v)
  467. print("the newest version of LUAOS is:"..nv)
  468. sleep(3)
  469. if nv > v then
  470. u = true
  471. else
  472. u = false
  473. end
  474. if u == true then
  475. term.setCursorPos(3,5)
  476. print("updating now")
  477. shell.run("pastebin get WnjNK63g version1")
  478. f = fs.open("/version1", "r")
  479. pb = f.readAll()
  480. f.close()
  481. shell.run("pastebin get ", pb, " LUAOSinstall")
  482. dofile("/LUAOSinstall")
  483. else
  484. print("your version of LUAOS is up to date")
  485. fs.delete("/version")
  486. sleep(5)
  487. li(eid, t)
  488. end
  489. end
  490. function li(eid,t)
  491. term.clear()
  492. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  493. paintutils.drawBox(1,1,51,19,colors.blue)
  494. term.setBackgroundColor(colors.lightBlue)
  495. term.setCursorPos(4,3)
  496. print("Welcome to the LUAOS Indev 0.3.3 Menu")
  497. local x1, y1 = 4,5
  498. local x2, y2 = 4,7
  499. local x3, y3 = 4,9
  500. local x4, y4 = 4,11
  501. local x5, y5 = 4,13
  502. local x6, y6 = 4,15
  503. local x7, y7 = 4,17
  504. local choice1 = "Shutdown"
  505. local choice2 = "Restart"
  506. local choice3 = "Sign Out"
  507. local choice4 = "File Browser"
  508. local choice5 = "Account Control"
  509. local choice6 = "Update"
  510. local choice7 = "Apps/Games"
  511. term.setBackgroundColor(colors.red)
  512. term.setCursorPos(x1,y1)
  513. write(choice1)
  514. term.setCursorPos(x2,y2)
  515. write(choice2)
  516. term.setCursorPos(x3,y3)
  517. write(choice3)
  518. term.setCursorPos(x4,y4)
  519. write(choice4)
  520. term.setCursorPos(x5,y5)
  521. write(choice5)
  522. term.setCursorPos(x6,y6)
  523. write(choice6)
  524. term.setCursorPos(x7,y7)
  525. write(choice7)
  526. while true do
  527. local event, button, cx, cy = os.pullEvent()
  528. if event == "mouse_click" then
  529. if cx >= x1 and cx < choice1:len() and cy == y1 and button == 1 then
  530. os.shutdown()
  531. break
  532. else if cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  533. os.reboot()
  534. break
  535. else if cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  536. boot()
  537. break
  538. else if cx >= x4 and cx < choice4:len() and cy == y4 and button == 1 then
  539. term.clear()
  540. term.setCursorPos(1,1)
  541. fb(eid,t)
  542. break
  543. else if cx >= x5 and cx < choice5:len() and cy == y5 and button == 1 then
  544. ac(eid,t)
  545. break
  546. else if cx >= x6 and cx < choice6:len() and cy == y6 and button == 1 then
  547. ud(eid,t)
  548. break
  549. else if cx >= x7 and cx < choice7:len() and cy == y7 and button == 1 then
  550. ag(eid,t)
  551. end
  552. end
  553. end
  554. end
  555. end
  556. end
  557. end
  558. end
  559. end
  560. end
  561. function uc1()
  562. term.clear()
  563. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  564. paintutils.drawBox(1,1,51,19,colors.blue)
  565. term.setBackgroundColor(colors.lightBlue)
  566. term.setTextColor(colors.white)
  567. term.setCursorPos(3,3)
  568. print("welcome to the LUAOS first user setup")
  569. term.setCursorPos(3,4)
  570. print("your first user will be an administrator")
  571. term.setCursorPos(3,5)
  572. print("administrators can edit and add users")
  573. term.setCursorPos(3,6)
  574. print("while normal users cant, administrators")
  575. term.setCursorPos(3,7)
  576. print("can also install apps onto the PC but")
  577. term.setCursorPos(3,8)
  578. print("normal users also can if they have their")
  579. term.setCursorPos(3,9)
  580. print("administrators password.The ID of this")
  581. term.setCursorPos(3,10)
  582. print("account will be '1'")
  583. term.setCursorPos(3,11)
  584. print("press enter to create your account.")
  585. back = read()
  586. term.clear()
  587. term.setCursorPos(3,3)
  588. print("now to make your administrator account")
  589. term.setCursorPos(3,5)
  590. print("Username:")
  591. term.setCursorPos(3,6)
  592. print("Password:")
  593. term.setCursorPos(12,5)
  594. nu = read()
  595. term.setCursorPos(12,6)
  596. np = read("*")
  597. fs.makeDir("/LUAOS/S/Users/1")
  598. f = fs.open("/LUAOS/S/Users/1/u", "w")
  599. f.write(nu)
  600. f.close()
  601. f = fs.open("/LUAOS/S/Users/1/p", "w")
  602. f.write(np)
  603. f.close()
  604. f = fs.open("/LUAOS/S/Users/1/t", "w")
  605. f.write("a")
  606. f.close()
  607. term.setCursorPos(3,8)
  608. print("Your new account has been made!")
  609. term.setCursorPos(3,9)
  610. print("Restarting now!")
  611. sleep(5)
  612. os.reboot()
  613. end
  614. function boot()
  615. term.clear()
  616. if not fs.exists("LUAOS/S/Users/1") then
  617. uc1()
  618. end
  619. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  620. paintutils.drawBox(1,1,51,19,colors.blue)
  621. term.setTextColor(colors.white)
  622. term.setBackgroundColor(colors.lightBlue)
  623. term.setCursorPos(3,3)
  624. print("Welcome to LUAOS login")
  625. term.setCursorPos(3,6)
  626. print("Enter your ID to contine")
  627. term.setCursorPos(3,9)
  628. eid = read()
  629. if not fs.exists("LUAOS/S/Users/"..eid) then
  630. term.clear()
  631. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  632. paintutils.drawBox(1,1,51,19,colors.blue)
  633. term.setBackgroundColor(colors.lightBlue)
  634. term.setCursorPos(3,3)
  635. print("Your ID is invalid, it may not exist")
  636. sleep(5)
  637. term.setCursorPos(3,5)
  638. print("Do you want to shutdown?, Y/N")
  639. local sEvent, param = os.pullEvent("key")
  640. if param == "49" then
  641. os.shutdown()
  642. else
  643. boot()
  644. end
  645. else if eid == "" then
  646. term.clear()
  647. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  648. paintutils.drawBox(1,1,51,19,colors.blue)
  649. term.setBackgroundColor(colors.lightBlue)
  650. term.setCursorPos(3,3)
  651. print("Your ID is invalid, it may not exist")
  652. sleep(5)
  653. term.setCursorPos(3,5)
  654. print("Do you want to shutdown?, Y/N")
  655. local sEvent, param = os.pullEvent("key")
  656. if param == "49" then
  657. os.shutdown()
  658. else
  659. boot()
  660. end
  661. end
  662. end
  663. term.clear()
  664. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  665. paintutils.drawBox(1,1,51,19,colors.blue)
  666. term.setBackgroundColor(colors.lightBlue)
  667. term.setCursorPos(3,3)
  668. print("Now login to your account")
  669. term.setCursorPos(3,6)
  670. print("Username:")
  671. term.setCursorPos(3,8)
  672. print("Password:")
  673. term.setCursorPos(12,6)
  674. eu = read()
  675. term.setCursorPos(12,8)
  676. ep = read("*")
  677. dir1 = "/LUAOS/S/Users/"..eid.."/u"
  678. dir2 = "/LUAOS/S/Users/"..eid.."/p"
  679. dir3 = "/LUAOS/S/Users/"..eid.."/t"
  680. fu = fs.open(dir1,"r")
  681. ru = fu.readAll()
  682. fu.close()
  683. fp = fs.open(dir2,"r")
  684. rp = fp.readAll()
  685. fp.close()
  686. ft = fs.open(dir3,"r")
  687. t = ft.readAll()
  688. ft.close()
  689. if eu == ru and ep == rp then
  690. term.setCursorPos(3,11)
  691. print("Welcome to LUAOS",ru)
  692. sleep(5)
  693. li(eid,t)
  694. else
  695. term.setCursorPos(3,11)
  696. print("Incorrect username and/or password")
  697. print("Do you want to shutdown?, Y/N")
  698. local sEvent, param = os.pullEvent("key")
  699. if param == "49" then
  700. os.shutdown()
  701. else
  702. boot()
  703. end
  704. end
  705. end
  706. function recovery()
  707. term.clear()
  708. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  709. paintutils.drawBox(1,1,51,19,colors.blue)
  710. term.setBackgroundColor(colors.lightBlue)
  711. print("something went wrong with booting your PC")
  712. print("recovery is going to try and fix this error now")
  713. print("if this does not work then recovery will")
  714. print("reinstall LUAOS for you, if this doesnt work")
  715. print("then report this to the owner of the OS")
  716. print("thank you for using LUAOS")
  717. sleep(20)
  718. fs.makeDir("/LUAOS")
  719. fs.makeDir("/LUAOS/C")
  720. fs.makeDir("/LUAOS/S")
  721. fs.makeDir("/LUAOS/S/Users")
  722. if not fs.exists("/LUAOS") then
  723. print("LUAOS Recovery has failed to fix your computer")
  724. print("please report this code to the owner")
  725. print("LUAOSRFSNE(/LUAOS)")
  726. sleep(10)
  727. print("this computer will now shutdown")
  728. sleep(3)
  729. os.shutdown()
  730. end
  731. if not fs.exist("/LUAOS/C") then
  732. print("LUAOS Recovery has failed to fix your computer")
  733. print("please report this code to the owner")
  734. print("LUAOSRFSNE(/LUAOS/C)")
  735. sleep(10)
  736. print("this computer will now shutdown")
  737. sleep(3)
  738. os.shutdown()
  739. end
  740. if not fs.exists("/LUAOS/S") then
  741. print("LUAOS Recovery has failed to fix your computer")
  742. print("please report this code to the owner")
  743. print("LUAOSRFSNE(/LUAOS/S")
  744. sleep(10)
  745. print("this computer will now shutdown")
  746. sleep(3)
  747. os.shutdown()
  748. end
  749. if not fs.exists("/LUAOS/S/Users") then
  750. print("LUAOS Recovery has failed to fix your computer")
  751. print("please report this code to the owner")
  752. print("LUAOSRFSNE(/LUAOS/S/Users)")
  753. sleep(10)
  754. print("this computer will now shutdown")
  755. sleep(3)
  756. os.shutdown()
  757. end
  758. print("LUAOS Recovery has fixed your computer, this computer will now restart")
  759. sleep(5)
  760. os.reboot()
  761. end
  762. function fc()
  763. if not fs.exists("/LUAOS") then
  764. print("/LUAOS does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  765. sleep(10)
  766. recovery()
  767. end
  768. if not fs.exists("/LUAOS/C") then
  769. print("/LUAOS/C does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  770. sleep(10)
  771. recovery()
  772. end
  773. if not fs.exists("/LUAOS/S") then
  774. print("/LUAOS/S does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  775. sleep(10)
  776. recovery()
  777. end
  778. if not fs.exists("/LUAOS/S/Users") then
  779. print("/LUAOS/S/Users does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  780. sleep(10)
  781. recovery()
  782. end
  783. print("all essential files succesfully found")
  784. sleep(5)
  785. boot()
  786. end
  787. term.clear()
  788. term.setCursorPos(1,1)
  789. term.setTextColor(colors.red)
  790. build = "0.3.3 Indev"
  791. print("Welcome To LUAOS Version:",build)
  792. sleep(3)
  793. print("preparing to check files")
  794. textutils.slowPrint("|||||||||||||||||||||||||||||||||||||||||||||||||||")
  795. sleep(1)
  796. print("checking files now")
  797. fc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement