Why I use git and puppet to manage my dotfiles
jaxelson.com
jaxelson.com
mv ~/.bashrc ~/.bashrc.bak; ln -s $DOTFILES_PATH/.bashrc ~/.bashrc
I do a slightly more sophisticated version of: echo "source $DOTFILES_PATH/.bashrc" >> ~/.bashrc
(The sophistication comes in checking if that line already exists.)Here's my install script: https://github.com/shazow/dotfiles/blob/master/install.sh
I've found many benefits in this, such as easily having machine-specific configuration side by side with my unified dotfiles and no backup clutter. This works especially well for things like vim configs, too.
$ cat ~/.vimrc
source $DOTFILES_PATH/.vimrcUsage:
git clone https://github.com/aonic/vim-settings.git
cd vim-settings
make
Remove: make cleanOf course, you're just using it for one folder so it's not an issue for you ;)
Perhaps there's room for a simple puppet-style configuration manager that lives in just a single script, in some ways similar to sqllite.
#named link.sh, greps out some common things we don't want to link, also have vim stuff in a different dotfiles repo
cd $(dirname $0)
for F in $(ls -a1 | grep -v link.sh | egrep -v "^..?$" | grep -v .DS_Store | egrep -v ".hg(ignore)?$" | egrep -v "^vim$"); do
if [ -a $HOME/$F ]; then
echo "**** Found existing $F, skipping..."
elif [ -h $HOME/$F ]; then
echo "Already symlinked $F, skipping..."
else
echo "Linking $F"
ln -s $PWD/$F $HOME/$F
fi
doneStuff like this is why I enjoy Hacker News.
But I think I am going to switch to puppet, because there are a few things I always need done on a new machine; adding myself as a sudoer, installing packages, editing the imapd config (for a local imap cache), etc.
Host- specific files I handle by doing if [ -f ~/.host-bashrc ]; then . ~/.host-bashrc; fi
I also use proper extensions on my files like bashrc.sh and emacs.el for automatic syntax highlighting in editors.
My shell script just goes through the current dir turning eg. bashrc.sh into a link at ~/.bashrc