Smarter install script

This commit is contained in:
Henrik Lissner 2014-07-30 00:49:10 -04:00
parent 4f5c6cd8d5
commit 0a2e84409e

View file

@ -1,20 +1,11 @@
#!/bin/sh #!/bin/zsh
function do_link {
if [ ! -h "$HOME/.$1" ]; then
echo "ln -sf '$HOME/.dotfiles/$1' '$HOME/.$1'"
ln -sf "$HOME/.dotfiles/$1" "$HOME/.$1"
fi
}
# In case this file was run via curl
[ ! -d ~/.dotfiles ] && git clone https://github.com/hlissner/dotfiles ~/.dotfiles [ ! -d ~/.dotfiles ] && git clone https://github.com/hlissner/dotfiles ~/.dotfiles
do_link zsh setopt EXTENDED_GLOB
do_link zshrc for rcfile in "${ZDOTDIR:-$HOME}"/.dotfiles/^(README.md|Gemfile|install.sh)(.N); do
do_link zshenv filep="${ZDOTDIR:-$HOME}/.${rcfile:t}"
do_link tmux.conf
do_link gitignore [ -h $filep ] || ln -s "$rcfile" $filep
do_link gitconfig done
do_link bashrc
do_link ctags
do_link rake