2

Recently I've been experimenting with KVM and virtual machines. I'm lazy and tired of manually copying/syncing my .rc files. Some Googling didn't immediately turn up any tools. Are there any CLI tools available for easily distributing or replicating them? My current solution is some scripted wgets.

Pete
  • 274
  • This sounds like an opinion question and not a concrete factual problem/question... – Karel Aug 12 '14 at 18:03
  • 1
    @Karlo It's fair, since it's not asking "What is the best kind of citrus soda, A, B, or C?", it's asking, "Is there such thing as a prepackaged citrus soda? I am tired of making them myself." http://unix.stackexchange.com/help/on-topic It should perhaps be clarified regarding the relevance of KVM -- are these .rc files special to it, or they normal system things and maintaining multiple VM images is just an example of why one might want to replicate them? – goldilocks Aug 12 '14 at 18:38
  • 1
    KVM VMs is just an example of why I'd want to replicate them. It's also an issue between my home and work machines. I'll make some tweaks at work and want them at home. Normal system files, right now I'm looking at simple $HOME files like .vimrc .screenrc etc... although being able to package up other config system files would be nice, for example drop a file in /etc/apt/conf.d – Pete Aug 12 '14 at 18:57
  • 1
    I'm going to suggest that there are far too many ways of doing this. Could you narrow it down somewhat? E.g., ways vary from "put $HOME under version control" to "put your dotfiles on Dropbox, and symlink $HOME/.dotfile to Dropbox/dotfiles/dotfile", to unison, to... – derobert Aug 12 '14 at 20:33

1 Answers1

2

The best approach is to put your dot files under version control. To make them available on a new machine, simply check them out. If you don't care about privacy, you can put your files on a site like Github. If you do, you can check out over SSH. On a virtual machine, if available, you can check out from a mounted host filesystem.

Version control gives you benefits well beyond easy synchronization. In particular, it gives you a version history, so that if you break something, you can go back to when it broke, which helps a lot in figuring out why it broke. You also get a way to reconcile changes if you modify the same file on different machines.

If you really don't want to use version control, you can simply copy the files with a tool like rsync (or Unison for bidirectional synchronization). You can also upload your files to an online service and download them. Apart from Unison to some extent, these methods won't help you if you ever modify the same file on two different machines.

One thing you'll have to do no matter what solution you choose is decide which files to replicate. Unfortunately, many applications don't make a clear distinction between user configuration files (which needs to be synchronized) and local state (which cannot be synchronized meaningfully).

  • I read your answer on the linked question regarding a repo subdirectory and symlink script. I think that approach will work for me. – Pete Aug 13 '14 at 00:33