From 0a2e84409efb7e979fe3dffe355264f7fe91569d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 30 Jul 2014 00:49:10 -0400 Subject: [PATCH] Smarter install script --- install.sh | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/install.sh b/install.sh index 5a0e8c64..0205b332 100755 --- a/install.sh +++ b/install.sh @@ -1,20 +1,11 @@ -#!/bin/sh - -function do_link { - if [ ! -h "$HOME/.$1" ]; then - echo "ln -sf '$HOME/.dotfiles/$1' '$HOME/.$1'" - ln -sf "$HOME/.dotfiles/$1" "$HOME/.$1" - fi -} +#!/bin/zsh +# In case this file was run via curl [ ! -d ~/.dotfiles ] && git clone https://github.com/hlissner/dotfiles ~/.dotfiles -do_link zsh -do_link zshrc -do_link zshenv -do_link tmux.conf -do_link gitignore -do_link gitconfig -do_link bashrc -do_link ctags -do_link rake +setopt EXTENDED_GLOB +for rcfile in "${ZDOTDIR:-$HOME}"/.dotfiles/^(README.md|Gemfile|install.sh)(.N); do + filep="${ZDOTDIR:-$HOME}/.${rcfile:t}" + + [ -h $filep ] || ln -s "$rcfile" $filep +done