One of the things I go REALLY tired of when I was setting up new machines without shared home directories was copying over ALL my personalized configurations over and over and over again. So I wrote a script to copy everything over. And then I realized that, somewhere along system number 10, the configuration files I was copying were tuned differently from the earlier ones, and in order to keep my settings consistent, I needed to go back and recopy everything…
…if you’re a developer or a sysadmin, you know where this is going. I checked everything into a version control system – git in this case – and started checking out the files on the new locations, and pulling updates on the others. This makes perfect sense, and as things get updated on one box, I can just pull the changes on the others on demand.
And this REALLY works well for me.
I recently added Dropbox to the mix. Howso? I moved the “master” git repository int a Dropbox folder. So on the machines where I have Dropbox (i.e. all my home systems, my work desktop, etc) I no longer have to pull the changes – Dropbox is doing that for me. And for the systems where I can’t use Dropbox (like the VM I have at Lylix or my hosted server out at Dash Systems) I can still check in & out the files like I always did.
I realize this is probably old news to some of you (and if you have a shared drive for your home directory, you probably don’t need this at all). Be aware that file conflicts might come up if you’re not careful, but in general it’s been the perfect solution for me.
So, for those who want to know “How I do that” and have a fair grip of the Linux and/or OSX command line, here is the step-by-step :
- Get Dropbox if you don’t already have it.
- Create a folder in the dropbox called “myconfigs”
- Do a “git init myconfigs” from the Dropbox folder
- Identify what files you want to keep there.
- Move in the files into the myconfig directory, i.e. “mv ~/.bashrc ~/Dropbox/myconfigs/bashrc”
- Use a symlink to point back to the original location. i.e. “ln -s ~/Dropbox/myconfigs/bashrc ~/.bashrc”
- Add the files to the git repository with “git add”
- Commit the files with “git commit”
- Wait for dropbox to sync everything up
- On the next machine, make a backup of the old file, e.g. “mv ~/.bashrc ~/.bashrc.orig”
- Use a symlink to get the “common” file, just like above : “ln -s ~/Dropbox/myconfigs/bashrc ~/.bashrc”
Voila! You’re done. On systems that aren’t Dropbox-able, you can use the git clone/push/pull commands to get the same configs.
So what do I keep in my personal “myconfigs” directory? As shown above, my bash configuration. Also in there are my mutt configs, emacs configs, signatures, and some scripts I use for cron jobs – and other configurations that I need/want to keep consistent from box to box. I also added a shell script to do all the backup/symlink stems for me. Setup is now a breeze – get to new system, sync with Dropbox (or git pull), run script.
This has made my life MUCH easier, and bootstraps my productivity when I’m on a new system.
One final word of advice – some things you do NOT want to keep in there. I tried keeping my Thunderbird configs on Dropbox, and it was WAY too much churn. The same with Firefox and Pidgin. And until they get the security tidbits cleaned up, I’d avoid storing anything like ssh keys, password files, or gpg keyrings on there.