Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ThodOS 18 Installer
- local brunning = true
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.magenta)
- textutils.slowPrint("DreamOS Installer initializg...")
- local bground
- local adminSetup = "root"
- local passInput
- local confpassInput
- local confpassnomatch
- local missingpass
- local curUsers = {}
- local newUser
- local newPass
- local newConfPass
- w,h = term.getSize()
- local slc = 1
- local selectedDSFile
- local function dlfile(pid,nFile)
- local r = http.get("https://pastebin.com/raw/"..pid);
- local f = fs.open( shell.resolve( nFile ), "w" );
- f.write( r.readAll() ); f.close();
- r.close()
- end
- if fs.exists("DreamOS") then
- print("It appears there are already DreamOS file\(s\) files on your computer. Delete these?")
- print("[Y/N]")
- local filesFoundStartup = true
- while filesFoundStartup do
- local delInput = io.read()
- if delInput == "Y" or delInput == "y" then
- shell.run("delete","DreamOS")
- print("Deleted.")
- filesFoundStartup = false
- elseif delInput == "N" or delInput == "n" then
- print("Keeping these files is not recommended before installing, back them up and delete original?")
- print("[Y/N]")
- local filesFoundStartupBackup = true
- while filesFoundStartupBackup do
- local delInputBackup = io.read()
- if delInputBackup == "Y" or delInputBackup == "y" then
- shell.run("rename","DreamOS","backup_DreamOS")
- print("Your file\(s\) have been backed up in \"backup_DreamOS\"")
- filesFoundStartupBackup = false
- filesFoundStartup = false
- elseif delInputBackup == "N" or delInputBackup == "n" then
- print("Continuing")
- filesFoundStartupBackup = false
- filesFoundStartup = false
- end
- end
- end
- end
- end
- textutils.slowPrint("Downloading required files...")
- -- Thanks to Krakaen for Pastebin fix (https://www.youtube.com/channel/UC2P4zFOgP_gx8jDtTJpUjAA)
- dlfile("SyzKgTuT","DreamOS/installer/bground.nfp")
- bground = "DreamOS/installer/bground.nfp"
- local function drawBground()
- term.setBackgroundColor(colors.cyan)
- term.clear()
- local loadBground = paintutils.loadImage(bground)
- paintutils.drawImage(loadBground,1,1)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.magenta)
- print(" DreamOS Installer ")
- end
- local function printRight(str,ypos)
- term.setCursorPos(w/2-2,ypos)
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.gray)
- print(str)
- active1320.csbchotp6tva.us-east-2.rds.amazonaws.com
- end
- local function page1()
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- term.setCursorPos(3,5)
- print(" BEGIN ")
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos(2,10)
- print(" CANCEL ")
- printRight("Welcome to DreamOS!",5)
- printRight("DreamOS is a branch of",6)
- printRight("ThodOS18",7)
- end
- local function page2()
- printRight("Welcome to DreamOS",5)
- printRight("We are downloading",6)
- printRight("neccessary files,",7)
- printRight("this'll likely be",8)
- printRight("quicker than it takes",9)
- printRight("to read this",10)
- term.setCursorPos(2,4)
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.blue)
- print(" Downloading")
- term.setCursorPos(2,5)
- term.setBackgroundColor(colors.green)
- --dl kernel
- dlfile("jJ9nsr24","DreamOS/system/kernel")
- write(" ")
- write(" ")
- --dl ccatch
- dlfile("b5s4VujU","DreamOS/system/ccatch")
- write(" ")
- write(" ")
- --dl core
- dlfile("RLEbDRXn","DreamOS/system/desktop.ds")
- write(" ")
- write(" ")
- --dl cfg
- dlfile("AjVXvFhu","DreamOS/user/root/cfg/main.cfg")
- write(" ")
- write(" ")
- --dl img1
- dlfile("Wx3Vcg8W","DreamOS/system/img/powermenu.nfp")
- dlfile("Bdiu9NQ6","DreamOS/system/pastebin.dsc")
- write(" ")
- write(" ")
- --dl img2
- dlfile("XTqhJbMk","DreamOS/system/img/setmenu.nfp")
- dlfile("yFdEn1N1","DreamOS/system/filemanager.ds")
- write(" ")
- write(" ")
- slc = 3
- end
- local function page3()
- printRight("Finished downloading!",5)
- printRight("Now you can configure",6)
- printRight("the system",7)
- term.setCursorPos(3,6)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.green)
- print(" NEXT ")
- term.setBackgroundColor(colors.red)
- term.setCursorPos(3,11)
- print(" CANCEL ")
- end
- local function page4()
- printRight("Paint your background",5)
- printRight("or choose an existing",6)
- printRight("file",7)
- term.setCursorPos(3,5)
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.white)
- print(" Paint ")
- term.setCursorPos(3,10)
- print(" File ")
- if selectedDSFile == nil then else
- term.setCursorPos(2,h-1)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- print(selectedDSFile)
- term.setCursorPos(3,15)
- term.setBackgroundColor(colors.green)
- print(" Next ")
- end
- end
- local function page5()
- while slc == 4.5 do
- sleep(0.1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.yellow)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.lightBlue)
- term.clearLine()
- term.setCursorPos(1,h-1)
- term.setBackgroundColor(colors.lightBlue)
- term.clearLine()
- term.setCursorPos(2,h-1)
- print(selectedDSFile)
- term.setBackgroundColor(colors.green)
- term.setCursorPos(w-6,h-1)
- print("Select")
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.lightBlue)
- print("Pick file")
- term.setBackgroundColor(colors.yellow)
- local fileList = fs.list("")
- local fileListTable = {}
- local lastDir = 0
- for k,v in pairs(fileList) do
- if fs.isDir(v) then
- table.insert(fileListTable,v)
- lastDir = lastDir + 1
- end
- end
- for k,v in pairs(fileList) do
- if not fs.isDir(v) then
- table.insert(fileListTable,v)
- end
- end
- for k,v in pairs(fileListTable) do
- if k <= h-3 then
- term.setCursorPos(2,k+1)
- if k <= lastDir then
- term.setTextColor(colors.green)
- else
- term.setTextColor(colors.white)
- end
- elseif k >= h-2 then
- term.setCursorPos(w/2,k-(h-4))
- if k <= lastDir then
- term.setTextColor(colors.green)
- else
- term.setTextColor(colors.white)
- end
- end
- print(v)
- end
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- for k,v in pairs(fileListTable) do
- if k <= h-2 then
- if e[3] >= 2 and e[3]<=#v and e[4] == k+1 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.lightBlue)
- term.clearLine()
- term.setCursorPos(2,h)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightBlue)
- selectedDSFile = v
- end
- elseif k > h-3 then
- if e[3] >=w/2 and e[4] == k-(h-2)+2 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.lightBlue)
- term.clearLine()
- term.setCursorPos(2,h)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightBlue)
- selectedDSFile = v
- end
- end
- end
- if e[3] >= w-6 and e[4] == (h-1) then
- slc = 4
- end
- end
- end
- end
- local function page6()
- printRight("Set up the admin",5)
- printRight("account. This account",6)
- printRight("will have acces to all",7)
- printRight("files and info stored",8)
- printRight("on this computer.",9)
- term.setCursorPos(2,5)
- term.setTextColor(colors.white)
- print("User: ")
- term.setCursorPos(2,6)
- print(adminSetup)
- term.setCursorPos(2,8)
- print("Password: ")
- term.setCursorPos(2,11)
- print("Confirm: ")
- term.setCursorPos(2,15)
- term.setBackgroundColor(colors.green)
- print(" SUBMIT ")
- if confpassnomatch then
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,16)
- term.setTextColor(colors.red)
- print("Confirm pass \n and pass\n don't match.")
- term.setTextColor(colors.white)
- end
- if missingpass then
- term.setCursorPos(2,16)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.red)
- print("Must include \n a password.")
- term.setTextColor(colors.white)
- end
- end
- local function page7()
- printRight("Here you can add",5)
- printRight("additional users",6)
- term.setCursorPos(2,5)
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.white)
- print("+Add user")
- term.setCursorPos(2,12)
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- print(" NEXT ")
- term.setCursorPos(1,15)
- for k,v in pairs(curUsers) do
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- write(" "..v.name..",")
- end
- end
- local function page_add_user()
- printRight("Set up account",5)
- term.setCursorPos(2,5)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.cyan)
- print("User: ")
- term.setCursorPos(2,6)
- print(newUser)
- term.setCursorPos(2,8)
- print("Password: ")
- local i = 0
- term.setCursorPos(2,9)
- if newPass == nil then else
- while i < #newPass do
- write("*")
- i = i + 1
- end
- end
- term.setCursorPos(2,11)
- print("Confirm: ")
- if newConfPass == nil then else
- i = 0
- term.setCursorPos(2,12)
- while i < #newConfPass do
- write("*")
- i = i + 1
- end
- end
- term.setCursorPos(2,15)
- term.setBackgroundColor(colors.green)
- print(" SUBMIT ")
- if confpassnomatch then
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,16)
- term.setTextColor(colors.red)
- print("Confirm pass \n and pass\n don't match.")
- term.setTextColor(colors.white)
- end
- if missingpass then
- term.setCursorPos(2,16)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.red)
- print("Must include \n a password.")
- term.setTextColor(colors.white)
- end
- end
- local function exitInstaller()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.magenta)
- term.setCursorPos(1,1)
- term.clear()
- print("Exiting installer...")
- print("Delete files?")
- print("[Y/N]")
- local delExit = true
- while delExit do
- local delInputExit = io.read()
- if delInputExit == "Y" or delInputExit == "y" then
- print("Deleting files...")
- shell.run("delete","DreamOS")
- delExit = false
- elseif delInputExit == "N" or delInputExit == "n" then
- print("Keeping files.")
- delExit = false
- end
- end
- brunning = false
- end
- local function page8()
- printRight("Setup complete!",5)
- printRight("Note that DreamOS",6)
- printRight("is in development,",7)
- printRight("not all features may",8)
- printRight("be implemented yet",9)
- term.setCursorPos(2,5)
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- print(" Finish ")
- end
- local function finishInstall()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.magenta)
- term.setCursorPos(1,1)
- print("DreamOS Installation complete!")
- print("Run DreamOS on startup?")
- print("[Y/N]")
- local runInputFin = true
- while runInputFin do
- local runInput = io.read()
- if runInput == "y" or runInput == "Y" then
- local runStart = fs.open("startup","w")
- runStart.write("term.clear\(\)\nshell.run\(\"DreamOS/system/desktop.ds\"\)")
- runStart.close()
- runInputFin = false
- elseif runInput == "n" or runInput == "N" then
- runInputFin = false
- end
- end
- print("Thank you for installing DreamOS. You may run it through \"DreamOS/system/desktop.ds\"")
- brunning = false
- shell.run("delete",bground)
- end
- while brunning do
- sleep(0.1)
- drawBground()
- if slc == 1 then
- page1()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=3 and e[3]<=14 and e[4]==5 then
- slc = 2
- elseif e[3]>2 and e[3]<=15 and e[4]==10 then
- exitInstaller()
- end
- end
- elseif slc == 2 then
- page2()
- elseif slc == 3 then
- page3()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=3 and e[3]<=12 and e[4]==6 then
- slc = 6
- elseif e[3]>=3 and e[3]<=15 and e[4]==11 then
- exitInstaller()
- end
- end
- elseif slc == 4 then
- page4()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=3 and e[3]<=10 and e[4]==5 then
- shell.run("paint","DreamOS/Documents/Images/desktop.nfp")
- if fs.exists("DreamOS/Documents/Images/desktop.nfp") then
- selectedDSFile = "DreamOS/Documents/Images/desktop.nfp"
- slc = 5
- end
- elseif e[3]>=3 and e[3]<=10 and e[4]==10 then
- slc = 4.5
- elseif e[3]>3 and e[3]<=10 and e[4] == 15 then
- if not selectedDSFile == "DreamOS/Documents/Images/desktop.nfp" then
- shell.run("copy",selectedDSFile,"DreamOS/Documents/Images/desktop.nfp")
- selectedDSFile = "DreamOS/Documents/Images/desktop.nfp"
- end
- slc = 5
- end
- end
- elseif slc == 4.5 then
- page5()
- elseif slc == 5 then
- page7()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=2 and e[3]<=11 and e[4] == 5 then
- missingpass = false
- confpassnomatch = false
- newUser = nil
- newPass = nil
- newConfPass = nil
- slc = 5.5
- elseif e[3]>=2 and e[3]<=9 and e[4] == 12 then
- slc = 7
- end
- end
- elseif slc == 5.5 then
- page_add_user()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=2 and e[3]<=11 and e[4]==9 then
- term.setCursorPos(2,9)
- term.setBackgroundColor(colors.blue)
- local i = 0
- if newPass == nil then else
- while i <= #newPass do
- write(" ")
- i = i + 1
- end
- end
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,9)
- newPass = read("*")
- elseif e[3]>=2 and e[3]<=10 and e[4]==12 then
- term.setCursorPos(1,12)
- term.setBackgroundColor(colors.blue)
- local i = 0
- if newConfPass == nil then else
- while i <= #newConfPass do
- write(" ")
- i = i + 1
- end
- end
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,12)
- newConfPass = read("*")
- elseif e[3]>=2 and e[3]<=10 and e[4] == 6 then
- term.setCursorPos(1,6)
- term.setBackgroundColor(colors.blue)
- local i = 0
- if newUser == nil then else
- while i <= #newUser do
- write(" ")
- i = i + 1
- end
- end
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,6)
- newUser = read()
- elseif e[3]>=2 and e[3]<=10 and e[4] == 15 then
- if newUser == nil then
- confpassnomatch = false
- missingpass = true
- else
- if newConfPass == newPass then
- local newUserInfo = {}
- newUserInfo["name"] = newUser
- newUserInfo["pass"] = newPass
- newUserInfo["confpass"] = newConfPass
- table.insert(curUsers, newUserInfo)
- slc = 5
- else
- missingpass = false
- confpassnomatch = true
- end
- end
- elseif e[3]>=2 and e[4]<=8 and e[4] == 12 then
- slc = 7
- end
- end
- elseif slc == 6 then
- page6()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=2 and e[3]<=11 and e[4]==9 then
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,9)
- passInput = read("*")
- elseif e[3]>=2 and e[3]<=10 and e[4]==12 then
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(2,12)
- confpassInput = read("*")
- elseif e[3]>=2 and e[3]<=10 and e[4] == 15 then
- if passInput == nil then
- confpassnomatch = false
- missingpass = true
- else
- if confpassInput == passInput then
- slc = 4
- else
- missingpass = false
- confpassnomatch = true
- end
- end
- end
- end
- elseif slc == 7 then
- page8()
- e = {os.pullEvent()}
- if e[1] == "mouse_click" and e[2] == 1 then
- if e[3]>=2 and e[3]<=10 and e[4] == 5 then
- finishInstall()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement