Advertisement
RavenOS

RavenOS 2.0 Install Test

Apr 2nd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.86 KB | None | 0 0
  1. totalFiles = 0
  2. type = "generic"
  3. w, h = term.getSize()
  4.  
  5. if not term.isColor() then
  6.   term.clear()
  7.   term.setCursorPos(1,1)
  8.   print("Installation failed: Must have an advanced computer")
  9.   return
  10. end
  11.  
  12. function install(addr, fn)
  13.   term.clear()
  14.   writeText("Installing "..type.." files...", 0)
  15.   term.setCursorPos(1,19)
  16.   write("Total Files: "..totalFiles)
  17.   term.setCursorPos(1,1)
  18.   print("Installing..."..fn)
  19.   stuff = http.get(addr).readAll()
  20.   f = fs.open(fn, "w")
  21.   f.write(stuff)
  22.   f.close()
  23.   totalFiles = totalFiles + 1
  24. end
  25.  
  26. function centerText(txt, offset)
  27.   term.setCursorPos(w / 2 - math.floor(string.len(txt) / 2), h / 2 + offset)
  28.   print(txt)
  29. end
  30.  
  31. function topText(txt)
  32.   term.setCursorPos(w / 2 - math.floor(string.len(txt) / 2), 1)
  33.   print(txt)
  34. end
  35.  
  36. function writeText(txt, offset)
  37.   w, h = term.getSize()
  38.  
  39.   term.setCursorPos(w / 2 - math.floor(string.len(txt) / 2), h / 2 + offset)
  40.   write(txt)
  41. end
  42.  
  43. function installAll()
  44.   fs.makeDir("rSettings")
  45.   fs.makeDir("rOS")
  46.   fs.makeDir("rPrograms")
  47.   fs.makeDir("rPaints")
  48.   fs.makeDir("rPrograms/userPrograms")
  49.   fs.makeDir("rApis")
  50.   fs.makeDir("rPaints/icons")
  51.   fs.copy("temp", "rSettings/username")
  52.   un = fs.open("rSettings/username", "w")
  53.   un.writeLine(username)
  54.   un.close()
  55.   fs.copy("temp", "rSettings/password")
  56.   pass = fs.open("rSettings/password", "w")
  57.   pass.writeLine(password)
  58.   pass.close()
  59.   type = "OS"
  60.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/startup", "startup")
  61.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rOS/desktop", "rOS/desktop")
  62.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rOS/login", "rOS/login")
  63.   type = "API"
  64.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/apis/check", "rApis/check")
  65.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/apis/text", "rApis/text")
  66.   type = "settings"
  67.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rSettings/useAdmin", "rSettings/useAdmin")
  68.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rSettings/system", "rSettings/system")
  69.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rSettings/startMenu", "rSettings/startMenu")
  70.   type = "image"
  71.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPaints/startMenu", "rPaints/startMenu")
  72.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPaints/icon", "rPaints/icon")
  73.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPaints/icons/consoleIcon", "rPaints/icons/consoleIcon")
  74.   type = "program"
  75.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPrograms/console", "rPrograms/console")
  76.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPrograms/installer", "rPrograms/installer")
  77.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPrograms/settings", "rPrograms/settings")
  78.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPrograms/settingsLogin", "rPrograms/settingsLogin")
  79.   install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/rPrograms/settingsSystem", "rPrograms/settingsSystem")
  80.   shell.run("set shell.allow_disk_startup false")
  81.   os.reboot()
  82. end
  83.  
  84. print("Are you sure you want to install RavenOS? (Y/n)")
  85.  
  86. while true do
  87.   write("> ")
  88.   option = read()
  89.    
  90.   if string.lower(option) == "yes" then
  91.     break
  92.   elseif string.lower(option) == "y" then
  93.     break
  94.   elseif string.lower(option) == "ya" then
  95.     break  
  96.   elseif string.lower(option) == "yep" then
  97.     break
  98.   elseif string.lower(option) == "no" then
  99.     print("Installation cancelled!")
  100.     return
  101.   elseif string.lower(option) == "n" then
  102.     print("Installation cancelled!")
  103.     return
  104.   elseif string.lower(option) == "nah" then
  105.     print("Installation cancelled!")
  106.     return
  107.   elseif string.lower(option) == "nope" then
  108.     print("Installation cancelled!")
  109.     return    
  110.   else
  111.     print("Invalid Command")
  112.   end
  113. end
  114.  
  115. install("https://raw.githubusercontent.com/Raven0S/RavenOS-2.0/master/temp", "temp")
  116. term.setTextColor(colors.white)
  117. term.setBackgroundColor(colors.cyan)
  118. term.clear()
  119. term.setCursorPos(1,1)
  120. topText("===[ RavenOS Installer ]===")
  121. centerText("Create Account", 0)
  122. centerText("Skip", 2)
  123.  
  124. while true do
  125.   event, button, x, y = os.pullEvent("mouse_click")
  126.  
  127.   if button == 1 then
  128.     if y == 9 then
  129.       term.clear()
  130.       topText("===[ RavenOS Installer ]===")
  131.       centerText("Username:              ", -1)
  132.       centerText("Password:              ", 1)
  133.       term.setCursorPos(24, 8)
  134.       username = read()
  135.       term.setCursorPos(24, 10)
  136.       password = read()
  137.       installAll()
  138.     elseif y == 11 then
  139.       fs.copy("temp", "rSettings/doNotLogin")
  140.       installAll()
  141.     end
  142.   end
  143. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement