Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "21.1010.R4"
- local tArgs = { ... }
- local w,h = term.getSize()
- cur = 0
- upd = 0
- nan = 0
- local gui = true
- local noface = false
- local setting = false
- if #tArgs > 0 then
- if (tArgs[1] == "nogui") then
- gui = false
- term.setCursorPos(1,-5)
- elseif(tArgs[1] == "noFace") then
- gui = false
- noface = true
- term.setCursorPos(1,-5)
- elseif(tArgs[1] == "setting") then
- gui = false
- noface = true
- setting = true
- term.setCursorPos(1,-5)
- end
- end
- if fs.exists("/C/system/RAM/UpdateList.txt") then fs.delete("/C/system/RAM/UpdateList.txt") end
- if fs.exists("/C/system/.core/.Registry/.disableUpdate") and not setting then error() end
- shell.run ("pastebin get kXX84wM3 /C/system/RAM/UpdateList.txt")
- if fs.exists("/C/system/RAM/online") then
- local data = fs.open("/C/system/RAM/online", "r")
- local Conser = data.readLine()
- if (Conser == "pastebin.com") then PastebinMode = true DevbinMode = false
- elseif (Conser == "devbin.dev") then DevbinMode = true PastebinMode = false
- else DevbinMode = false PastebinMode = false end
- data.close()
- else DevbinMode = false PastebinMode = false end
- local function logo()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(w/2-5,h-1)
- write" Pepek"
- term.setCursorPos(w/2+3,h-1)
- write"Soft "
- term.setCursorPos(w/2+2,h-1)
- term.setTextColor(colors.lime)
- write"@"
- end
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- term.setCursorPos(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function vycistit()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- prc ("Update some system files !", 5)
- prc ("Please wait...", h/2)
- prc ("Don't turn off your computer!", h/2+2)
- logo()
- end
- function updateCore(path, verze, Pcode, Dcode)
- if fs.exists(path) then
- local data = fs.open(path, "r")
- Current = data.readLine()
- data.close()
- if (string.find(Current, verze) ~= nil) then
- cur = cur + 1
- else
- upd = upd + 1
- if not noface then vycistit() end
- term.setCursorPos(1,-5)
- fs.delete(path)
- shell.run("pastebin get "..Pcode.." "..path)
- if (path == "/startup.lua") then shell.run("/startup.lua reboot") end
- end
- else
- nan = nan + 1
- end
- end
- function check()
- if fs.exists("/C/system/RAM/UpdateList.txt") then
- local data = fs.open("/C/system/RAM/UpdateList.txt", "r")
- repeat
- cesta = data.readLine()
- verze = data.readLine()
- Pcode = data.readLine()
- Dcode = data.readLine()
- local nic = data.readLine()
- if cesta ~= nil and (string.sub(cesta,1,1) == "/") then updateCore(cesta, verze, Pcode, Dcode) end
- until cesta == nil
- data.close()
- end
- if gui and not noface then
- print("Soubory: "..(cur+upd+nan))
- print("Aktualni: "..cur)
- print("Aktualizovat: "..upd)
- print("Neexistuje: "..nan)
- end
- if setting then
- if fs.exists("/C/system/RAM/UpdateList.tmp") then fs.delete("/C/system/RAM/UpdateList.tmp") end
- local data = fs.open ("/C/system/RAM/UpdateList.tmp", "w")
- data.writeLine("Total files: "..(cur+upd))
- data.writeLine("Current files: "..cur)
- data.writeLine("Updated files: "..upd)
- data.close()
- end
- if fs.exists("/C/system/RAM/UpdateList.txt") then fs.delete("/C/system/RAM/UpdateList.txt") end
- end
- check()
Add Comment
Please, Sign In to add comment