From 806cc51a215cf192e3d2ab2ad6e1a7b7121b529f Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Sat, 4 Jan 2014 15:50:07 -0800 Subject: [PATCH] Added updating git repository if it already exists, removed verification check when using method 2 --- install.sh | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/install.sh b/install.sh index ee1c5e9..5c77b6c 100755 --- a/install.sh +++ b/install.sh @@ -84,6 +84,18 @@ function performSetup() { if [ -f install.sh ]; then echo "Running in Mode 1: Already cloned repository" REPO_DIR="$( cd "$( dirname "$0" )" && pwd )" + + echo "This will create symlinks and destroy any conflicting configs already in place."; + read -p "Continue? [y/N] " choice + + # Perform the logic + case "$choice" in + Y|y|yes ) + performSetup ${HOME} + echo "Done! Restart your shell to see changes" + ;; + * ) echo "Aborted!";; + esac else echo "Running in Mode 2: Direct from Curl" @@ -95,23 +107,15 @@ else fi # Clone the repository into current location using readonly url. - echo "Cloning dotfiles repository to ~/.dotfiles" - git clone https://github.com/tgrosinger/dotfiles.git ~/.dotfiles - REPO_DIR="~/.dotfiles" + echo "Cloning dotfiles repository to ${HOME}/.dotfiles" + if [ -d ${HOME}/.dotfiles ]; then + pushd ${HOME}/.dotfiles + git pull + popd + else + git clone https://github.com/tgrosinger/dotfiles.git ${HOME}/.dotfiles + fi + REPO_DIR="${HOME}/.dotfiles" + performSetup ${HOME} + echo "Done! Restart your shell to see changes" fi - -################################################################################ -# Main Operation -################################################################################ - -echo "This will create symlinks and destroy any conflicting configs already in place."; -read -p "Continue? [y/N] " choice - -# Perform the logic -case "$choice" in - Y|y|yes ) - performSetup ${HOME} - echo "Done! Restart your shell to see changes" - ;; - * ) echo "Aborted!";; -esac