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.

  • Just a personal/professional note (sorry): I would go absolutely nuts if someone "helped" med set up my development environment, especially if it involved modifying existing files. It's highly personal. What about giving the developers access to the various files they need and documenting the modifications, and then leaving it up to them to actually copy and modify the needed files? I mean, they are developers, after all.
    – Kusalananda
    Commented Jun 16, 2022 at 14:28
  • Unfortunately, if we leave the developers to install on their own, each of their dev environments ends up misconfigured somehow. I've written extensive documentation, detailing each step needed and the desired end result, but steps get skipped and instructions misunderstood. Each dev has access to all the files needed, and have been told where to find them. I agree that they are developers and should be able to handle this flawlessly, but leadership has decided to not penalize devs who don't set up their environment correctly.
    – acjca2
    Commented Jun 16, 2022 at 14:38
  • @Kusalananda : Has anyone ever been complaining with default settings of whatever ? From my personal point of view and well versed in software development I have been more than happy the first time I started cross-building that things worked out of the box (thanks to wisely preset config files)
    – MC68020
    Commented Jun 16, 2022 at 14:41
  • @MC68020 Did you mean to address me with that comment? I'm not quite sure what you are asking.
    – Kusalananda
    Commented Jun 16, 2022 at 14:57


You must log in to answer this question.

Browse other questions tagged .