Skip to content
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

Overwriting my homebrew index.json on container start. #11

Open
Bumsbirne opened this issue Sep 6, 2023 · 5 comments
Open

Overwriting my homebrew index.json on container start. #11

Bumsbirne opened this issue Sep 6, 2023 · 5 comments

Comments

@Bumsbirne
Copy link

Hi since i think the last update, every time i restart the container it "updates" my homebrew index.json file back to the original empty one from the repository.

SOURCE=GITHUB
 === Using GitHub mirror at https://github.com/5etools-mirror-1/5etools-mirror-1.github.io.git
 === Using existing git repository
 === Pulling from GitHub with images... (This will take a while)
M	homebrew/index.json
Your branch is up to date with 'origin/master'.
Already up to date.
 === Starting version 1.185.1
@Jafner
Copy link
Owner

Jafner commented Nov 24, 2023

Yeah, this is an issue I've been dealing with in my personal instance as well.

I'm not sure what the best approach is to dealing with it, since we're essentially introducing a "patch" to the main 5eT code when we add homebrew.

I can think of two approaches, but there is probably an optimal solution I just don't know about.

  1. Using .gitignore to bypass pulling a new version of the index and wiping the homebrew directory.

  2. Using git stash to save our changes, pull the new version, and then re-applying the stash after.

If you've worked out a solution in the last three months, I'd love to hear it. Otherwise, I'll see what I can do.

@Bumsbirne
Copy link
Author

Not really, since iam not that familiar with git. My solution is kinda dumb. I made a script that restarts the container once a week to update and then replace the index.json with a saved one.

@lightlike
Copy link

I think the simplest solution would be to list all json files in the homebrew directory (except index.json) and adding them to the toImport array on container start.
This would also mean that there would be no chance of git deleting the json files and files could be disabled by changing the file extension.

The problem would be if the user renames/deletes a file or something similar and does not restart the server.
But that could be helped by generating a small readme file to explain the homebrew process or by replacing the readme section inside the index.json.

Manipulating json could be a bit annoying with bash but there are tools (e.g. here).
I thing python would be the simplest as it should be preinstalled and not that easily broken.
Or you could just use sed but that could break with changes in 5e-tools.

@oakbrad
Copy link

oakbrad commented Apr 3, 2024

Not really, since iam not that familiar with git. My solution is kinda dumb. I made a script that restarts the container once a week to update and then replace the index.json with a saved one.

I am attempting to do the same but I don't seem to be able get any homebrew to load at all.

I restart the container, copy back my index.json, correct the permissions and I get nothing showing up in 5eTools. Is there another step necessary here? I am seeing an error here, not sure if it's the source of my issue:

Your branch and 'origin/main' have diverged,
and have 1 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
hint: You have divergent branches and need to specify how to reconcile them.
fatal: Need to specify how to reconcile divergent branches.

It would be great if we could load homebrew from URLs instead of files, so that restarting the container also re-pulls homebrew and generates an index.json file instead of managing these files locally.

@Jafner
Copy link
Owner

Jafner commented Apr 3, 2024

@oakbrad I like that idea. If you open a feature request for that, I'll get around to building it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants