Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pastebin=""
- backup=""
- file=""
- print("[ Updating script to latest version ]")
- if (fs.exists(backup)) then
- print("Old backup file detected, deleting: " .. backup)
- fs.delete(backup)
- end
- if (fs.exists(file)) then
- print("Creating new backup file: " .. backup)
- fs.move(file, backup)
- end
- print("Fetching latest (" .. file .. ") version from pastebin: " .. pastebin)
- result = shell.run("pastebin", "get " .. pastebin .. " " .. file)
- print("Operation finished. Result: ")
- if (result) then print("Success")
- else print("Failure")
- end
- print("Attempting to run: " .. file)
- if (not fs.exists(file)) then
- print("Error: File not found: " .. file)
- print("Attempting reverting to backup...")
- if (not fs.exists(backup)) then
- print("Fatal error: No backup file found.")
- error("Stopping...")
- end
- fs.copy(backup, file)
- end
- print("Executing: " .. file)
- shell.run(file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement