Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("pastebin", "get", "JaQMssHV", "/load")
- if not load then
- os.loadAPI("/load") -- TheOriginalBIT's API
- end
- --[[
- your logo didn't fit on the screen, now it does
- ]]--
- local logo = {
- "5555 5 5 5555 5555 5555 5555 55555",
- "5 5 5 5 5 5 5 5 5 ",
- "5 555 5 5 55555 5555 555 5 5 55555",
- "5 5 5 5 5 55 5 5555 5",
- "55555 5 5 55555 5555 5555 5555 55555",
- }
- --[[
- We use this because the pastebin program spams stuff to the screen and to reduce screen tearing my api only updates the lines it needs to on the screen
- so we make our own to stop the printing to the screen
- ]]--
- local function download(code, path)
- local response = http.get( "http://pastebin.com/raw.php?i="..textutils.urlEncode( code ) )
- if response then
- local contents = response.readAll()
- response.close()
- local file = fs.open( path, "w" )
- file.write( contents )
- file.close()
- end
- end
- --[[
- This is all the instructions you want the installer to do.
- func is the function that it has to call
- param is what to give to the function
- visual can only be used if you are wanting to show them text, it doesn't move the progress bar, it just updates the progress text
- ]]--
- local instructions = {
- {func = fs.makeDir, param = {"gliese"}},
- {func = fs.makeDir, param = {"gliese/sysfiles"}},
- {visual = "Installing Gliese OS Development Stage..."},
- {func = download, param = {"bJR1Zsut", "gliese/clrs"}},
- {func = fs.delete, param = { "/startup" }},
- {func = download, param = {"Zwj4pttD", "/startup"}},
- {func = download, param = {"UEfxpFg3", "gliese/set"}},
- {func = download, param = {"VqhvSXJd", "gliese/start"}},
- {func = download, param = {"sqY4sUBU", "gliese/list"}},
- {func = download, param = {"kTWKJzVg", "gliese/gfb"}},
- {func = download, param = {"HyDGJaXG", "gliese/delete"}},
- {func = download, param = {"i8KHsHgR", "gliese/mdp"}},
- {func = download, param = {"gMYRfL9i", "gliese/help"}},
- {func = download, param = {"1e0XC30i", "gliese/text"}},
- {func = download, param = {"q9CeVngm", "gliese/pastebin"}},
- {func = download, param = {"t3D4tbpY", "gliese/quit"}},
- {func = download, param = {"73r1J115", "gliese/restart"}},
- {func = download, param = {"D8Dz7X83", "gliese/shell"}},
- {func = download, param = {"ZcDyAW6U", "gliese/tacoinstall"}},
- {func = download, param = {"zJ7qtPVx", "gliese/gui"}},
- {func = download, param = {"HfbAuqBG", "gliese/sysfiles/fLib"}},
- {func = download, param = {"DZP7i7XA", "gliese/taco"}},
- {func = download, param = {"b8zZfN7m", "gliese/sysfiles/background"}},
- {func = download, param = {"dhU58yVF", "gliese/icon.nfp"}},
- {visual = "Done!"},
- }
- --[[
- the total number of instructions - 2
- why do we use #instructions because its the number of instructions we wish to perform that are in the above table
- why -2 because we have 2 visuals in there, they don't tigger an update, so the api will be waiting for 2 updates it will never get
- ]]--
- local totalTriggers = #instructions - 2
- local bar = load.init( load.LOGO_IS_LOAD, logo, totalTriggers, nil, 14, colors.red, "Starting up...", "Gliese OS Installer", "By Thegreatstudio" )
- --[[
- Main function. this downloads and installs all the files
- ]]--
- local function install()
- -- just a simple message to them
- bar:setMessage( "Making a file system directory...")
- -- make sure they see it
- sleep(0.1)
- -- now lets go through and do the instructions
- for i = 1, #instructions do
- -- out current instruction
- local inst = instructions[i]
- if inst.func then
- -- call the function with the parameters
- inst.func( unpack(inst.param) )
- -- trigger an update
- bar:triggerUpdate( "Loading ("..bar:getFormattedProgress()..")..." )
- else -- it didn't have a function so lets assume it is a visual update
- -- change the message
- bar:setMessage(inst.visual)
- -- make sure they see it
- sleep(0.1)
- end
- end
- -- tell them its rebooting
- bar:setMessage( "System is now rebooting..." )
- end
- --[[ run the api ]]--
- local function render()
- bar:run()
- end
- parallel.waitForAll( render, install )
- -- sleep so they can see the message and then reboot
- sleep(1)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement