-
I'm looking for recommendations on how to manage my Right now, I'm using a simple script to periodically copy some directories and files from Is there a "better" way that I can manage them, preferably without executing chezmoi as the root user or changing permission of |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 16 replies
-
I think that running as root would be a need, otherwise how could chezmoi write to /etc? In my dotfiles, I currently configure the files under It may not be the cleanest approach, neither the most performant and bullet proof, but it works for me. |
Beta Was this translation helpful? Give feedback.
-
This is straying into the territory of managing files outside your home directory - which is an explicit non-goal for chezmoi. You might be better off with Ansible/Chef/Puppet/Salt. |
Beta Was this translation helpful? Give feedback.
-
@ayushnix You can take a look on my branch friends, where I manage install profiles and run_once scripts if a certain file changes: |
Beta Was this translation helpful? Give feedback.
-
Marked as answer link doesn't exist anymore :( Updated link from @felipecrs dotfiles: run_once_before_1_setup_apt_packages.sh.tmpl#L68-L74 |
Beta Was this translation helpful? Give feedback.
-
There's a great tool to manage /etc, etckeeper |
Beta Was this translation helpful? Give feedback.
-
I know it's not recommended as it put security at risk, but I managed to create such chezmoi config. If you don't care about security - my alias from alias schezmoi="sudo chezmoi --destination /etc --source /etc/chezmoi/data --working-tree /etc/chezmoi/data --config /etc/chezmoi/chezmoi.toml" then but once again be aware of security risks e.g. here simple marcin@pc:~$ schezmoi status
[sudo] password for marcin:
M root/.bashrc
marcin@pc:~$ schezmoi cd
root@pc:/etc/chezmoi/data# whoami
root
root@pc:/etc/chezmoi/data# ouch! you have been warned ;) |
Beta Was this translation helpful? Give feedback.
-
Sorry for necro-bump :-X Heavily inspired by this discussion, I built a simple chezmoi wrapper called chezetc for managing files under Its usage is identical to chezmoi because it just forwards all flags to chezmoi. It is quite simple and complete to handle the permission issue. For example, Please checkout https://github.com/SilverRainZ/chezetc for more details. I hope it is helpful for some guys. |
Beta Was this translation helpful? Give feedback.
I think that running as root would be a need, otherwise how could chezmoi write to /etc? In my dotfiles, I currently configure the files under
/etc
withsudo
inside of myrun_
scripts. An example:https://github.com/felipecrs/dotfiles/blob/master/home/run_once_before_1_setup_apt_packages.sh.tmpl#L68-L74
It may not be the cleanest approach, neither the most performant and bullet proof, but it works for me.