bug(chezmoi): `chezmoi-update.timer` fails when dotfile is deleted or renamed
fiftydinar opened this issue ยท 5 comments
Solution: Use chezmoi update
with --force
flag to solve this.
This is probably intended to not interfere with local-user changes to the file.
However, I think that using --force
flag would be useful in certain cases, especially if user or the program should not touch the dotfile.
Maybe additional option would be good for this, although, I don't know how to handle the scenario where some image-maintainer might want --force
for some files & normal update
for other files in the same repo.
I'm pinging you @exponentactivity, since you made the chezmoi module to look into this, as this is the 1st time I use chezmoi.
When some dotfile is deleted or renamed, chezmoi-update.timer
fails the whole updating process, no matter if every other file is unchanged in naming.
When manually running chezmoi update
, it will ask if affected file should be overwrited.
If approved, it makes the new file if it was previously deleted, while it additionally keeps the renamed file if previously renamed.
Using chezmoi update --force
solves the issue with chezmoi-update.timer
in mentioned case.
If there's an opposite flag, one that skips those files without prompting, would be nice to make that on option. I was planning on including something like duplicate-file-policy: skip | replace
in homefiles
eventually.
If there's an opposite flag, one that skips those files without prompting, would be nice to make that on option. I was planning on including something like
duplicate-file-policy: skip | replace
inhomefiles
eventually.
--keep-going
flag is good for this purpose.
There is also --no-tty
flag, which fixes the error that systemd unit can't access tty & it now shows this clearer error:
maj 09 12:30:38 fedora chezmoi[6918]: .var/app/com.github.neithern.g4music has changed since chezmoi last wrote it (overwrite/all-overwrite/skip/quit)? chezmoi: .var/app/com.github.neithern.g4music: EOF
It shows that systemd unit failed when this happens, but files are still updated, so it should be good.
So updating the chezmoi-update.service
with this should be good for duplicate-file-policy: skip
:
chezmoi update --no-tty --keep-going
While duplicate-file-policy: replace
should look like this:
chezmoi update --no-tty --force
Thanks for tagging me. I was looking into it when i saw #219 (comment) . I didn't know about --no-tty
and --keep-going
, thanks!
I'll implement duplicate-file-policy
like you said.
I'm thinking duplicate-file-policy: "skip"
will be the default, since that is non-desctructive.
I'm thinking
duplicate-file-policy: "skip"
will be the default, since that is non-desctructive.
I agree