Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BrainStone's APIs autoupdater installer
- -- Version 1.12
- --
- -- This script will install BrainStone's APIs autoupdater
- --
- -- Execute " pastebin run V2uDhBFU " to install or update if already installed
- -- Execute " pastebin run V2uDhBFU update " to force update
- function getLastLine(file)
- if not fs.exists(file) then
- return nil
- end
- local handle = fs.open(file, "r")
- local line, lastline
- repeat
- lastline = line
- line = handle.readLine()
- until line == nil
- return lastline
- end
- local targs = {...}
- local mode = targs[1] or "install"
- local useColor = term.isColor ~= nil and term.isColor()
- if fs.exists("startup") then
- if mode ~= "update" and getLastLine("startup") == "-- 4024a1f38967b6f8d01e32a34688b43a" then
- mode = "update"
- end
- if mode == "install" then
- if fs.exists("startup.custom") then
- if useColor then
- term.setTextColor(colors.red)
- end
- print("Warning! \"startup\" and \"startup.custom\" already exsist!")
- print("If you install now \"startup.custom\" will be deleted!")
- if useColor then
- term.setTextColor(colors.white)
- end
- local text
- repeat
- write("Would you rather like to update instead? (y/n) ")
- text = read():sub(1, 1)
- until text == "y" or text == "n"
- if text == "n" then
- fs.delete("startup.custom")
- fs.move("startup", "startup.custom")
- else
- mode = "update"
- end
- else
- fs.move("startup", "startup.custom")
- end
- end
- fs.delete("startup")
- end
- if useColor then
- term.setTextColor(colors.lime)
- end
- if mode == "install" then
- write("Installing")
- elseif mode == "update" then
- write("Updating")
- end
- if useColor then
- term.setTextColor(colors.white)
- end
- print(" BrainStone's APIs autoupdater")
- shell.run("pastebin get mEYD0JM5 startup")
- shell.run("startup")
Advertisement
Add Comment
Please, Sign In to add comment