Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local remoteUrl = "https://raw.githubusercontent.com/realGiB/pocketOS/main/"
- local next = "/System/loadOS"
- local files = {"startup", "/System/.version", "/System/autoupdater", "/System/loadOS"}
- local remoteVersion = http.get(remoteUrl .. "System/.version")
- local localVersion = fs.open("System/.version", "r")
- local rVersion = remoteVersion.readAll()
- -- Initialize at 0 for first-time installation, etc.
- local lVersion = 0
- if localVersion ~= nil then
- lVersion = localVersion.readAll()
- localVersion.close()
- end
- if rVersion ~= lVersion then
- print("Downloading Update...")
- print("Your Verison: ", lVersion)
- print("New Version: ", rVersion)
- for k, file in pairs(files) do
- print("Downloading... " .. file)
- local currentFile = fs.open(file, "w")
- local remoteFile = http.get(remoteUrl .. file)
- if remoteFile ~= nil then
- currentFile.write(remoteFile.readAll())
- remoteFile.close()
- print("Remote file doesn't exist!")
- end
- currentFile.close()
- end
- else
- print("You're up to date!")
- end
- print('done')
- shell.run(next)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement