Advertisement
joshgreatuk

LUAOS Startup 0.4 Indev

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