Added updating git repository if it already exists, removed verification check when using method 2

This commit is contained in:
Tony Grosinger 2014-01-04 15:50:07 -08:00
parent 53a1c6bf1e
commit 806cc51a21

View File

@ -84,25 +84,6 @@ function performSetup() {
if [ -f install.sh ]; then if [ -f install.sh ]; then
echo "Running in Mode 1: Already cloned repository" echo "Running in Mode 1: Already cloned repository"
REPO_DIR="$( cd "$( dirname "$0" )" && pwd )" REPO_DIR="$( cd "$( dirname "$0" )" && pwd )"
else
echo "Running in Mode 2: Direct from Curl"
# Make sure git is installed. Exit if it isn't.
if ! which git; then
echo "Please install git before continuing."
echo "Alternatively, download the files and run manually from https://github.com/tgrosinger/dotfiles/archive/master.zip"
exit 1
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"
fi
################################################################################
# Main Operation
################################################################################
echo "This will create symlinks and destroy any conflicting configs already in place."; echo "This will create symlinks and destroy any conflicting configs already in place.";
read -p "Continue? [y/N] " choice read -p "Continue? [y/N] " choice
@ -115,3 +96,26 @@ case "$choice" in
;; ;;
* ) echo "Aborted!";; * ) echo "Aborted!";;
esac esac
else
echo "Running in Mode 2: Direct from Curl"
# Make sure git is installed. Exit if it isn't.
if ! which git; then
echo "Please install git before continuing."
echo "Alternatively, download the files and run manually from https://github.com/tgrosinger/dotfiles/archive/master.zip"
exit 1
fi
# Clone the repository into current location using readonly url.
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