From 5ba4ab79d1c890e7367132ed6926ea643ae78025 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 6 Mar 2013 20:47:03 +0100 Subject: init_new_user.sh: only clone if repos don't exist yet Signed-off-by: Florian Pritz --- init_new_user.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/init_new_user.sh b/init_new_user.sh index c62601a..51fbec2 100644 --- a/init_new_user.sh +++ b/init_new_user.sh @@ -5,11 +5,19 @@ set -e cd $HOME mkdir -p git -git clone git://git.server-speed.net/users/flo/bin +clone_repo() { + repo_url=$1 + dest_dir=$2 -cd git -git clone git://git.server-speed.net/users/flo/dotfiles -cd $HOME + if [[ -e $dest_dir ]]; then + return 0 + fi + + git clone "$repo_url" "$dest_dir" +} + +clone_repo git://git.server-speed.net/users/flo/bin bin +clone_repo git://git.server-speed.net/users/flo/dotfiles git/dotfiles for i in .zshrc .vimrc .screenrc .screenrc-2 .zprofile .htoprc .dircolors .vim .gitconfig .gitignore .bashrc; do ln -sf git/dotfiles/$i $i -- cgit v1.2.3-24-g4f1b