Skip to content

Update utility #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 2, 2025
Merged

Update utility #267

merged 4 commits into from
Jun 2, 2025

Conversation

felacek
Copy link
Collaborator

@felacek felacek commented May 30, 2025

Pacman-esque update utility that runs every time the docker container is started. It compares hashes of each (important) file and updates the files accordingly. There are multiple scenarios (letters refer to the original, the current and the new files respectively):

  • the file has not been changed between versions and the user has not altered it (X X X)
    in this case nothing is done since no update is needed
  • the file has been changed between versions and the user has not altered it (X X Y)
    in this case the new file is copied instead of the old one
  • the file has not been changed between versions and the user has altered it (X Y X)
    in this case nothing is done
  • the file has been changed between versions and the user has altered it (X Y Z)
    in this case the new file is copied with a .new extension for the user to manually merge later, the script also outputs this into the console and writes a file with all files that need manual merging
  • the original file is newer than the new one
    this happens in case the user updates their hashes or tries to downgrade to an older version of trakman, no update is performed, too bad!

The Update.js script is fairly well documented, but the user shouldn't have to run it ever anyway.

@felacek felacek requested a review from wsrvn May 30, 2025 15:20
@felacek felacek self-assigned this May 30, 2025
@felacek felacek added the feature New features and requests label May 30, 2025
@felacek felacek temporarily deployed to docker-publish May 30, 2025 15:21 — with GitHub Actions Inactive
@felacek
Copy link
Collaborator Author

felacek commented May 30, 2025

Closes #259

@felacek
Copy link
Collaborator Author

felacek commented May 30, 2025

To test, you can try this sequence of actions:

  1. go into some directory, pull the repo and checkout into update-utility, this will be the repo that you will be "updating"
  2. run node Update.js to generate hashes
  3. now, as a user would, change some options in some configs or whatever
  4. create a new directory somewhere else, pull the repo and checkout into update-utility, this will be the repo with the "new" version
  5. change some files so that this is the new version, you can change one of the configs you touched in the other repo so that there is a conflict
  6. run node Update.js to generate hashes here too, including for the files you just changed
  7. now go back to that first repo and update it using node Update.js ../<path_to_the_other_repo>/trakman/.hashes.json
  8. if there are no conflicts, the update will succeed. if there are conflicts, it will tell you exactly what files you need to look at

obviously the user has to only care about the last step cuz everything will be done for them by the docker run script

Copy link
Collaborator

@wsrvn wsrvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works as intended.

@wsrvn wsrvn merged commit 1446486 into dev Jun 2, 2025
1 check was waiting
@felacek felacek deleted the update-utility branch June 4, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features and requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants