Advertisement
joshgreatuk

LUAOS Startup 0.1 Indev

Jun 22nd, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.39 KB | None | 0 0
  1. function ud(v)
  2.   term.clear()
  3.   term.setCursorPos(3,3)
  4.   paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  5.   paintutils.drawBox(1,1,51,19,colors.blue)
  6.   print("LUAOS version:", v)
  7.   shell.run("pastebin get AC6USdEP version")
  8.   f = fs.open("/version", "r")
  9.   nv = f.readAll()
  10.   f.close()
  11.   print("the newest version of LUAOS is:", nv)
  12.   if nv > v then
  13.     u = y
  14.   else
  15.     u = n
  16.   end
  17.   if u == "y" then
  18.     shell.run("pastebin get WnjNK63g version1")
  19.     f = fs.open("/version1", "r")
  20.     pb = f.readAll()
  21.     f.close()
  22.     shell.run("pastebin get ", pb, " LUAOSinstall")
  23.     dofile("/LUAOSinstall")
  24.   else
  25.     print("your version of LUAOS is up to date")
  26.     sleep(5)
  27.     os.reboot()
  28.   end
  29. function li(eu)
  30.   term.clear()
  31.   term.setCursorPos(4,3)
  32.   print("welcome to the LUAOS Indev 0.1 Menu")
  33.   term.setCursorPos(4,6)
  34.   print("1 : shutdown")
  35.   term.setCursorPos(4,8)
  36.   print("2 : restart")
  37.   term.setCursorPos(4,10)
  38.   print("3 : update")
  39.   term.setCursorPos(4,12)
  40.   print("4 : file browser")
  41.   term.setCursorPos(4,16)
  42.   s = read()
  43.   if s == "1" then
  44.     os.shutdown()
  45.   else if s == "2" then
  46.     os.reboot()
  47.   else if s == "3" then
  48.     v = 0.1
  49.     ud(v)
  50.   else if s == "4" then
  51.     dofile("/LUAOS/C/filebrowser")
  52.   else
  53.     term.setCursorPos(4,17)
  54.     print("selection not valid")
  55.     sleep(3)
  56.     li(eu)
  57.   end
  58.   end
  59.   end
  60.   end
  61. end
  62. function uc1()
  63.   term.clear()
  64.   term.setTextColor(colors.white)
  65.   term.setCursorPos(3,3)
  66.   print("welcome to the LUAOS first user setup")
  67.   term.setCursorPos(3,4)
  68.   print("your first user will be an administrator")
  69.   term.setCursorPos(3,5)
  70.   print("administrators can edit and add users")
  71.   term.setCursorPos(3,6)
  72.   print("while normal users cant, administrators")
  73.   term.setCursorPos(3,7)
  74.   print("can also install apps onto the PC but")
  75.   term.setCursorPos(3,8)
  76.   print("normal users also can if they have their")
  77.   term.setCursorPos(3,9)
  78.   print("administrators password.")
  79.   back = read()
  80.   term.clear()
  81.   term.setCursorPos(3,3)
  82.   print("now to make your administrator account")
  83.   term.setCursorPos(3,5)
  84.   print("Username:")
  85.   term.setCursorPos(3,6)
  86.   print("Password:")
  87.   term.setCursorPos(12,5)
  88.   nu = read()
  89.   term.setCursorPos(12,6)
  90.   np = read("*")
  91.   fs.makeDir("/LUAOS/S/Users/1")
  92.   f = fs.open("/LUAOS/S/Users/1/u", "w")
  93.   f.write(nu)
  94.   f.close()
  95.   f = fs.open("/LUAOS/S/Users/1/p", "w")
  96.   f.write(np)
  97.   f.close()
  98.   f = fs.open("/LUAOS/S/Users/1/t", "w")
  99.   f.write("a")
  100.   f.close()
  101.   term.setCursorPos(3,8)
  102.   print("Your new account has been made!")
  103.   term.setCursorPos(3,9)
  104.   print("Restarting now!")
  105.   sleep(5)
  106.   os.reboot()
  107. end
  108. function boot()
  109.   term.clear()
  110.   term.setTextColor(colors.white)
  111.   if not fs.exists("/LUAOS/S/Users/1") then
  112.     uc1()
  113.   end
  114.   term.setCursorPos(3,3)
  115.   print("Welcome to LUAOS login")
  116.   term.setCursorPos(3,5)
  117.   print("Username:")
  118.   term.setCursorPos(3,6)
  119.   print("Password:")
  120.   term.setCursorPos(12,5)
  121.   eu = read()
  122.   term.setCursorPos(12,6)
  123.   ep = read("*")
  124.   if fs.exists("/LUAOS/S/Users/1/u") and fs.exists("/LUAOS/S/Users/1/p") then
  125.     f = fs.open("/LUAOS/S/Users/1/u", "r")
  126.     ru = f.readLine(1)
  127.     f.close()
  128.     f = fs.open("/LUAOS/S/Users/1/p", "r")
  129.     rp = f.readLine(1)
  130.     f.close()
  131.     if eu == ru and ep == rp then
  132.       term.setCursorPos(3,8)
  133.       print("welcome", eu)
  134.       sleep(3)
  135.       li(eu)
  136.     else
  137.       term.setCursorPos(3,8)
  138.       print("your username and or password is incorrect")
  139.       term.setCursorPos(3,9)
  140.       print("would you like to shutdown your computer")
  141.       term.setCursorPos(3,10)
  142.       print("Y/N")
  143.       local sEvent, param = os.pullEvent("key")
  144.       if sEvent == "21" then
  145.         os.shutdown()
  146.       else
  147.         os.reboot()
  148.       end
  149.     end
  150.   else
  151.     recovery()
  152.   end
  153. end
  154. function recovery()
  155.   term.clear()
  156.   print("something went wrong with booting your PC")
  157.   print("recovery is going to try and fix this error now")
  158.   print("if this does not work then recovery will")
  159.   print("reinstall LUAOS for you, if this doesnt work")
  160.   print("then report this to the owner of the OS")
  161.   print("thank you for using LUAOS")
  162.   sleep(20)
  163.   fs.makeDir("/LUAOS")
  164.   fs.makeDir("/LUAOS/C")
  165.   fs.makeDir("/LUAOS/S")
  166.   fs.makeDir("/LUAOS/S/Users")
  167.   shell.run("pastebin get 3TtKX5tR /LUAOS/C/filebrowser")
  168.   if not fs.exists("/LUAOS") then
  169.     print("LUAOS Recovery has failed to fix your computer")
  170.     print("please report this code to the owner")
  171.     print("LUAOSRFSNE(/LUAOS)")
  172.     sleep(10)
  173.     print("this computer will now shutdown")
  174.     sleep(3)
  175.     os.shutdown()
  176.   end
  177.   if not fs.exist("/LUAOS/C") then
  178.     print("LUAOS Recovery has failed to fix your computer")
  179.     print("please report this code to the owner")
  180.     print("LUAOSRFSNE(/LUAOS/C)")
  181.     sleep(10)
  182.     print("this computer will now shutdown")
  183.     sleep(3)
  184.     os.shutdown()
  185.   end
  186.   if not fs.exists("/LUAOS/S") then
  187.     print("LUAOS Recovery has failed to fix your computer")
  188.     print("please report this code to the owner")
  189.     print("LUAOSRFSNE(/LUAOS/S")
  190.     sleep(10)
  191.     print("this computer will now shutdown")
  192.     sleep(3)
  193.     os.shutdown()
  194.   end
  195.   if not fs.exists("/LUAOS/S/Users") then
  196.     print("LUAOS Recovery has failed to fix your computer")
  197.     print("please report this code to the owner")
  198.     print("LUAOSRFSNE(/LUAOS/S/Users)")
  199.     sleep(10)
  200.     print("this computer will now shutdown")
  201.     sleep(3)
  202.     os.shutdown()
  203.   end
  204.   if not fs.exists("/LUAOS/C/filebrowser") then
  205.     print("LUAOS Recovery has failed to fix your computer")
  206.     print("please report this code to the owner")
  207.     print("LUAOSRFSNE(/LUAOS/C/filebrowser)")
  208.     sleep(10
  209.     print("this computer will now shutdown")
  210.     sleep(3)
  211.     os.shutdown()
  212.   end
  213.   print("LUAOS Recovery has fixed your computer, this computer will now restart")
  214.   sleep(5)
  215.   os.reboot()
  216. end
  217. function fc()
  218.   if not fs.exists("/LUAOS") then
  219.     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")
  220.     sleep(10)
  221.     recovery()
  222.   end
  223.   if not fs.exists("/LUAOS/C") then
  224.     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")
  225.     sleep(10)
  226.     recovery()
  227.   end
  228.   if not fs.exists("/LUAOS/S") then
  229.     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")
  230.     sleep(10)
  231.     recovery()
  232.   end
  233.   if not fs.exists("/LUAOS/S/Users") then
  234.     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")
  235.     sleep(10)
  236.     recovery()
  237.   end
  238.   if not fs.exists("/LUAOS/C/filebrowsser") then
  239.     print("/LUAOS/c/filebrowser does not exist, if you get this error please \n reinstall LUAOS of that doesnt work \n hen contact the owner, recovery will start now")
  240.     sleep(10)
  241.     recovery()
  242.   end
  243.   print("all essential drives files succesfully found")
  244.   sleep(5)
  245.   boot()
  246. end
  247. term.clear()
  248. term.setCursorPos(1,1)
  249. term.setTextColor(colors.red)
  250. build = "0.1 Indev"
  251. print("Welcome To LUAOS Version:",build)
  252. sleep(3)
  253. print("preparing to check files")
  254. textutils.slowPrint("|||||||||||||||||||||||||||||||||||||||||||||||||||")
  255. sleep(1)
  256. print("checking files now")
  257. fc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement