Wrap git install to also update.

This commit is contained in:
David Tomaschik
2015-11-17 10:39:06 -08:00
parent 9520a9b484
commit 4858e33ff1

View File

@@ -14,21 +14,17 @@ function prerequisites {
echo 'Enter password to change shell.' 1>&2 echo 'Enter password to change shell.' 1>&2
chsh -s `which zsh` chsh -s `which zsh`
fi fi
if [[ ! -d $HOME/.oh-my-zsh ]] ; then git_install https://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
git clone https://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
fi
else else
echo "ZSH not found!" > /dev/stderr echo "ZSH not found!" > /dev/stderr
fi fi
if which vim > /dev/null ; then if which vim > /dev/null ; then
mkdir -p $HOME/.vim/bundle mkdir -p $HOME/.vim/bundle
if [[ ! -d $HOME/.vim/bundle/Vundle.vim ]] ; then git_install https://github.com/VundleVim/Vundle.vim.git \
git clone https://github.com/VundleVim/Vundle.vim.git \ $HOME/.vim/bundle/Vundle.vim
$HOME/.vim/bundle/Vundle.vim
fi
fi fi
if which gdb > /dev/null ; then if which gdb > /dev/null ; then
git clone https://github.com/longld/peda.git $HOME/.peda git_install https://github.com/longld/peda.git $HOME/.peda
fi fi
} }
@@ -60,6 +56,17 @@ function install_basic_dir {
done done
} }
function install_git {
# Install or update a git repository
local REPO="${1}"
local DESTDIR="${2}"
if [[ -d ${DESTDIR}/.git ]] ; then
( cd ${DESTDIR} ; git pull -q )
else
git clone ${REPO} ${DESTDIR}
fi
}
function postinstall { function postinstall {
# Install Vundle plugins # Install Vundle plugins
if [[ -d $HOME/.vim/bundle/Vundle.vim ]] ; then if [[ -d $HOME/.vim/bundle/Vundle.vim ]] ; then