Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Paster = settings.get("paster")
- shell.run(Paster,"get", "cJJU1pDZ","os/System/TempFiles/Versions.txt")
- local file = fs.open("os/System/TempFiles/Versions.txt","r")
- local List = textutils.unserialize(file.readAll())
- file.close()
- local Version = settings.get("version")
- local Details = fs.open(fs.complete("os/Updater/StoredVersions",Version),"r")
- local Stamp = Details.readLine()
- Details.close()
- local Update = false
- for i = 1, #List do
- if List[i][2] > Stamp then Update = true end
- end
- function UpdateMenu()
- local New = {}
- for i = 1, #List do
- if List[i][2] > Stamp then New[#New+1] = i end
- end
- New[#New + 1] = "Cancel"
- term.clear()
- term.setCursorPos(1,1)
- print("current Version: "..Version)
- print("New Versions:")
- local n = 1
- while true do
- for i = 1, #New do
- term.setCursorPos(1,i + 2)
- term.clearLine()
- if n == i then term.write(">> "..i.." - "..List[New[i]][1]) else term.write(" "..i.." - "..List[New[i]][1]) end
- end
- local a, b = os.pullEvent("key")
- if b == keys.w then if n == 0 then n = #New else n = n - 1 end end
- if b == keys.s then if n == #New then n = 1 else n = n + 1 end end
- if b == keys.enter then break end
- end
- if n == #New then else shell.run("os/Updater/Installer.lua",List[New[n]][3]) end
- end
- function Prompt()
- term.clear()
- term.setCursorPos(1,1)
- print("Update Detected, Install?")
- print("y/n")
- local a, b
- repeat
- a, b = os.pullEvent("key")
- until b == keys.y or b == keys.n
- if b == keys.y then UpdateMenu() end
- end
- if Update == true then Prompt() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement