Closed Ionshard closed 4 years ago
Thank you very much for reporting this and for the very clear and complete report!
I think what's happening here is that chezmoi applies things in alphabetical order based on the target name. .ssh/config
begins with the character .
, which has byte value 46. run_once_00_bootstrap.sh
begins with the character 0
(after you strip the run_once_
prefix) which has byte value 48. This means that chezmoi will apply .ssh/config
before running run_once_00_bootstrap.sh
.
I think the work-around is to add a run_once_
script that sorts before .ssh/config
, for example (and this is a horrible hack) by renaming run_once_00_bootstrap.sh
to run_once_.00_bootstrap.sh
.
Please note that I haven't tested this and would very much appreciate it if you could test it and report back here. chezmoi certainly could do much better here.
Awesome! Thanks that was it. I was paying too much attention to the source name. I have changed my script to be run_once_+00_bootsrap.sh.tmpl
to make it a little more readable that the .
in the middle of the filename and it works great!
What exactly are you trying to do?
There is discussion in #664 to allow providing a custom init script. Furthermore in #794 it's discussed that chezmoi will run the files in alphabetic order though not actually documented.
I am trying to get chezmoi to be responsible for install lastpass so that I can use it within chezmoi since one of the big draws to chezmoi is limiting the "bootstrap" problem.
I have created a
run_once_00_bootstrap.sh.tmpl
file in my repository and I was hoping that would run before attempting to create my SSH keys. This is not the case.Super basic example of this here: https://gitlab.com/Kasuko/dotfiles
What have you tried so far?
I have tried calling the bootstrap file:
run_once_00_bootstrap.sh
run_once_zz_bootstrap.sh
exact_000_bootstrap
directoryNo matter what I do, chezmoi always seems to attempt to execute my SSH templates before running the bootstrap script.
Where else have you checked for solutions?
Output of any commands you've tried with
--verbose
Ignore all the white space above, I am also attempting to bootstrap chezmoi away from the single line install into the OS specific package. (which is not the issue because that's also not happening before rendering the template and does work if I manually install lastpass)
Output of
chezmoi doctor
Additional context
I understand this is not a supported feature and will probably be officially supported in v2, but I was wondering if there was something I could do in the meantime?