5etools-docker icon indicating copy to clipboard operation
5etools-docker copied to clipboard

Overwriting my homebrew index.json on container start.

Open Bumsbirne opened this issue 2 years ago • 5 comments

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

Bumsbirne avatar Sep 06 '23 18:09 Bumsbirne

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.

Jafner avatar Nov 24 '23 23:11 Jafner

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.

Bumsbirne avatar Nov 25 '23 18:11 Bumsbirne

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.

lightlike avatar Dec 06 '23 21:12 lightlike

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.

oakbrad avatar Apr 03 '24 19:04 oakbrad

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

Jafner avatar Apr 03 '24 19:04 Jafner