Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Minif OS Installer
- --Functions and Variables
- launchScreenSizeX, launchScreenSizeY = term.getSize()
- function launchFillBG(selColor)
- paintutils.drawFilledBox(1,1,launchScreenSizeX,launchScreenSizeY,selColor)
- term.setCursorPos(1,1)
- term.setBackgroundColor(selColor)
- if selColor == colors.white then
- term.setTextColor(colors.black)
- else
- term.setTextColor(colors.white)
- end
- end
- function launchInstall(code)
- fs.delete("temp/install")
- shell.run("pastebin get "..code.." /temp/install")
- if fs.exists("/temp/install") then
- local file = fs.open("/temp/install","r")
- print("Installing "..file.readLine())
- local noFiles = file.readLine()
- print("Total Files: ".. noFiles)
- for i=1,tonumber(noFiles) do
- local ncode = file.readLine()
- local location = file.readLine()
- fs.delete(location)
- shell.run("pastebin get "..ncode.." "..location)
- if fs.exists(location) then
- print("Success")
- else
- print("Failure")
- end
- end
- file.close()
- else
- print("File Map Failure")
- end
- end
- function installNumber(version)
- print("installing".. version)
- fs.delete("temp/versions")
- shell.run("pastebin get vczUSAiy /temp/versions")
- if fs.exists("/temp/versions") then
- local file = fs.open("/temp/versions","r")
- print("Latest Version: "..file.readLine())
- local noVersions = file.readLine()
- print("Total Versions: "..noVersions)
- for i=1, tonumber(noVersions) do
- local nversion = file.readLine()
- local code = file.readLine()
- if nversion == version then
- print("Installing: "..version)
- launchInstall(code)
- end
- end
- file.close()
- else
- print("Version Failure")
- end
- end
- --Execution
- launchFillBG(colors.cyan)
- fs.delete("temp/versions")
- shell.run("pastebin get vczUSAiy /temp/versions")
- if fs.exists("/temp/versions") then
- local file = fs.open("/temp/versions","r")
- print("Latest Version: "..file.readLine())
- local noVersions = file.readLine()
- print("Total Versions: "..noVersions)
- for i=1, tonumber(noVersions) do
- local nversion = file.readLine()
- local code = file.readLine()
- print(i..": ".. nversion)
- end
- file.close()
- local choose = read()
- installNumber(choose)
- else
- print("Version Failure")
- end
- sleep(2)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment