From 68752533ab685ea281aef57bb1b30242abb72860 Mon Sep 17 00:00:00 2001 From: Orien Vandenbergh Date: Thu, 15 Sep 2016 23:55:43 -0600 Subject: [PATCH] Add resiliancy, and update local repos if run again --- initialize_environment.sh | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/initialize_environment.sh b/initialize_environment.sh index 8fc1ce0..0ff821e 100755 --- a/initialize_environment.sh +++ b/initialize_environment.sh @@ -1,14 +1,24 @@ #!/bin/bash +function update_or_clone { + dir=`basename $1 | awk -F. '{print $1}'` + directory=${2:-$dir} + if [ -d $directory ]; then + cd $directory + git pull + cd .. + else + git clone --depth=1 $1 $directory + fi +} + [ -e $HOME/.vimrc ] && rm $HOME/.vimrc ln -s $(pwd)/vimrc $HOME/.vimrc mkdir -p $HOME/.vim/autoload $HOME/.vim/bundle curl -LSso $HOME/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim -MODULES="git://github.com/altercation/vim-colors-solarized.git - https://github.com/sheerun/vim-wombat-scheme.git - git://github.com/tpope/vim-fugitive.git +MODULES="git://github.com/tpope/vim-fugitive.git git://github.com/tpope/vim-git.git https://github.com/tpope/vim-sensible.git https://github.com/rust-lang/rust.vim.git @@ -19,16 +29,24 @@ MODULES="git://github.com/altercation/vim-colors-solarized.git https://github.com/pangloss/vim-javascript https://github.com/tpope/vim-surround https://github.com/scrooloose/syntastic + https://github.com/Marfisc/vorange.git + https://github.com/sjl/badwolf.git + https://github.com/YorickPeterse/happy_hacking.vim.git + https://github.com/owickstrom/vim-colors-paramount.git + https://github.com/pbrisbin/vim-colors-off.git + https://github.com/kristijanhusak/vim-hybrid-material.git https://github.com/dsolstad/vim-wombat256i.git - https://github.com/jnurmine/Zenburn.git" + https://github.com/jnurmine/Zenburn.git + git://github.com/altercation/vim-colors-solarized.git + https://github.com/sheerun/vim-wombat-scheme.git" cd $HOME/.vim/bundle for module in $MODULES; do - git clone --depth=1 $module + update_or_clone $module done mkdir -p $HOME/.zsh cd $HOME/.zsh -git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git -git clone https://github.com/nichus/zsh-customizations custom +update_or_clone https://github.com/robbyrussell/oh-my-zsh.git +update_or_clone https://github.com/nichus/zsh-customizations custom