Allow chezmoi to manage readonly
-type files and directories
#3441
Labels
enhancement
New feature or request
readonly
-type files and directories
#3441
Is your feature request related to a problem? Please describe.
I tried adding the
readonly
target type to some of my files because I will sometimes modify them (or some program will modify them) and it won't be until some time later that I realize I need to add them to my chezmoi source.Chezmoi is unable to manage files and directories with the
readonly
target type after initially setting them to readonly.This seems somewhat related to #3392 and #1400, but I think this scenario is a more general cross-platform concern.
Describe the solution you'd like
I would like chezmoi to be able to continue managing readonly files and directories while still preventing the user from modifying them. During an
apply
, Chezmoi would need to temporarily add write permissions (which is possible for the owner of the file or directory to do, at least on Linux). Once modifications are complete, thereadonly
type could be re-applied.Describe alternatives you've considered
As suggested in #3392 and #1400, I can use
before_
andafter_
scripts to take care of this myself. That is what I intend to do for now, but I would be tickled if chezmoi could still manage my readonly files.Additional context
I was initially surprised to find that files and directories with the target type
readonly
could only be created but not updated. It makes sense to me now, but my initial naive assumption was thatreadonly
would restrict changing files or directories by the user while still allowing chezmoi to manage them.I understand this could add non-trivial complexity and overhead to chezmoi operations, which I agree might not be worth the tradeoff. If you don't mind, however, I'd like some additional thoughts on the usefulness of this feature aside from those tradeoffs.
It's possible I could work on a proof-of-concept to evaluate viability of this feature, if you would be interested.
The text was updated successfully, but these errors were encountered: