Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- repoUrl = "https://raw.githubusercontent.com/SuperRavenSn1per/RavenOS/master/"
- directories = {"rSystem", "rSystem/rStartup", "rSystem/rAPIs", "rSystem/rImages", "rSystem/rPrograms"}
- files = {"startup", "rSystem/rAPIs/rtext", "rSystem/login", "rSystem/createAccount", "rSystem/rImages/background1", "rSystem/rAPIs/background", "rSystem/desktop", "rSystem/rPrograms/settings"}
- w, h = term.getSize()
- function install(filename)
- content = http.get(repoUrl..filename).readAll()
- file = fs.open(filename, "w")
- file.write(content)
- file.close()
- end
- function startInstall()
- term.clear()
- term.setCursorPos(1,1)
- for i,dir in pairs (directories) do
- fs.makeDir(dir)
- end
- for i,file in pairs(files) do
- term.clear()
- term.setCursorPos(w / 2 - string.len("RavenOS Installer") / 2 , 2)
- print("RavenOS Installer")
- term.setCursorPos(w / 2 - string.len("Installing..."..file) / 2 , h / 2 + 2)
- percent = math.floor(i/#files * 100)
- numberOfBars = math.floor(20 * percent / 100)
- print("Installing..."..file)
- print("")
- term.setCursorPos(w / 2 - string.len(" ") / 2 , h / 2)
- term.setBackgroundColor(colors.green)
- write(" ")
- term.setBackgroundColor(colors.black)
- write(" "..percent.."%")
- term.setCursorPos(w / 2 - string.len(" ") / 2 , h / 2)
- term.setBackgroundColor(colors.lime)
- for i = 1,numberOfBars do
- write(" ")
- end
- term.setBackgroundColor(colors.black)
- install(file)
- end
- settings.set("syscolor", colors.green)
- settings.set("highlightcolor", colors.lime)
- settings.set("version", "0.1")
- settings.set("useLogin", false)
- settings.save("rSystem/settings")
- fts = fs.open("firstTimeStart", "w")
- fts.write("--Just a file to tell system that this is a new computer with RavenOS")
- fts.close()
- term.clear()
- term.setCursorPos(1,1)
- print("Installation complete... press any key to reboot")
- os.pullEvent()
- os.reboot()
- end
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------")
- print("| RavenOS Installer |")
- print("---------------------")
- term.setCursorPos(1,5)
- print("Are you sure you want to install RavenOS? (Y/n)")
- term.setTextColor(colors.red)
- print("Warning: Files will be deleted")
- term.setTextColor(colors.white)
- term.setCursorPos(1,8)
- while true do
- write("> ")
- input = read()
- input = string.lower(input)
- if input == "yes" or input == "ye" or input == "y" then
- startInstall()
- elseif input == "no" or input == "n" then
- print("Installation cancelled")
- break
- end
- end
Add Comment
Please, Sign In to add comment