To help developers set up some of their environment, I have some small files that need to be installed to various locations in a user's home directory, plus modifications that need to be made to some rc files like ~/.zshrc
.
The previous maintainer had a script with a set of "if this $file
doesn't exist, write this text to $file
". Unfortunately that hasn't been very robust, and doesn't edit preexisting files.
What are the best practices and tools for installing files and modifying dotfiles or rc files?
I've not had much luck finding anything other than GNU install which can take care of the file installation. I'm more interested in making edits to various text config files. A tool like Ansible seems like it would be too heavyweight just for installing a couple of shell scripts, and I'm not sure how well it can edit pre-existing files.