Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of programs to check for updates
- local programs = {
- {name = "Bastion", pastebinCode = "Czt0xUgp"},
- {name = "RBastion", pastebinCode = "YLMd18xC"},
- {name = "FBastion", pastebinCode = "8pF6ds3s"},
- {name = "GPS", pastebinCode = "d8WLzv0U"},
- {name = "Stripmine", pastebinCode = "BkFdvGdv"},
- {name = "Update", pastebinCode = "8w6Ni2U1"},
- {name = "Greeting", pastebinCode = "REfxrLkG"},
- {name = "startup", pastebinCode = "u2ey5fkZ"},
- {name = "CargoGate", pastebinCode = "uDQ9GX0F"},
- {name = "ArtillaryControl", pastebinCode = "BGUJrLzV"},
- {name = "StargateLogs", pastebinCode = "eg0sWHxc"}
- -- Add more programs as needed
- }
- -- Function to check for updates
- local function checkForUpdates(program)
- -- Loop through the list of programs
- for i, program in ipairs(programs) do
- -- Check if the file already exists
- if not fs.exists(program.name) then
- -- Open a new file with the current program name
- local file = fs.open(program.name, "w")
- -- Write a message to the file
- file.write("This is " .. program.name .. ". The pastebin code is " .. program.pastebinCode)
- -- Close the file
- file.close()
- end
- end
- print("Files have been created.")
- print("Checking for updates for " .. program.name .. "...")
- local response = http.get("https://pastebin.com/raw/" .. program.pastebinCode)
- if response then
- local remoteVersion = response.readAll()
- response.close()
- local localVersion = fs.exists(program.name) and fs.open(program.name, "r").readAll() or nil
- if localVersion and localVersion ~= remoteVersion then
- print("Updating " .. program.name .. "...")
- local file = fs.open(program.name, "w")
- file.write(remoteVersion)
- file.close()
- print(program.name .. " updated successfully.")
- else
- print(program.name .. " is up to date.")
- end
- else
- print("Failed to check for updates for " .. program.name)
- end
- end
- -- Main function to check for updates for all programs
- local function main()
- for _, program in ipairs(programs) do
- checkForUpdates(program)
- end
- end
- -- Run main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement