Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "22.0224.R1"
- local tArgs = { ... }
- local w,h = term.getSize()
- local sum = 0
- local upd = 0
- if fs.exists("/C/system/RAM/UpdateList.txt") then fs.delete("/C/system/RAM/UpdateList.txt") end
- term.setCursorPos(1,-5)
- 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 all system files !", 5)
- prc ("Please wait...", h/2)
- prc ("Don't turn off your computer!", h/2+2)
- prc ("The computer will restart automatically.", h/2+4)
- logo()
- end
- function updateCore(path, verze, Pcode, Dcode)
- if fs.exists(path) then
- term.setCursorPos(1,-5)
- fs.delete(path)
- shell.run("pastebin get "..Pcode.." "..path)
- 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
- if fs.exists(cesta) then
- upd = upd + 1
- end
- end
- until cesta == nil
- data.close()
- end
- end
- function ucheck()
- 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)
- if fs.exists(cesta) then
- sum = sum +1
- zprava = ("Completed "..sum.."/"..upd)
- term.setTextColor(colors.black)
- prc (zprava, h/2-4/2)
- end
- end
- until cesta == nil
- data.close()
- end
- if fs.exists("/C/system/RAM/UpdateList.txt") then fs.delete("/C/system/RAM/UpdateList.txt") end
- sleep(2)
- shell.run("/startup.lua reboot")
- end
- vycistit()
- check()
- ucheck()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement