Browse Source

Fixed a dup bug in the boostrap script

master
Drew Short 9 years ago
parent
commit
0cfdaf0d02
  1. 12
      bootstrap.sh

12
bootstrap.sh

@ -21,11 +21,16 @@ link() {
link_dir() { link_dir() {
# Only make a backup if an existing directory is there and is not a link # Only make a backup if an existing directory is there and is not a link
if [ -d "$1/$2" ] && [ ! -L "$1/$2" ]; then
if [ -d "$1/$2" ] && [ ! -L "$1/$2" ]; then
mv "$1/$2" "$1/$2.old" mv "$1/$2" "$1/$2.old"
echo "Backed up original $2 to $1/$2.old" echo "Backed up original $2 to $1/$2.old"
fi fi
ln -sf "$3" "$1/$2"
# Don't overwrite links
if [ ! -L "$1/$2" ]; then
echo "ln -sf $3 $1/$2"
ln -sf "$3" "$1/$2"
fi
} }
set -x set -x
@ -45,9 +50,11 @@ fi
VIM_BUNDLE=$HOME/.vim/bundle VIM_BUNDLE=$HOME/.vim/bundle
mkdir -p $VIM_BUNDLE mkdir -p $VIM_BUNDLE
plugins=($(ls -d $PWD/.vim/bundle/* | tr -s ' ')) plugins=($(ls -d $PWD/.vim/bundle/* | tr -s ' '))
echo "${plugins[@]}"
for plugin in ${plugins[@]}; do for plugin in ${plugins[@]}; do
parts=($(echo "$plugin" | tr '/' ' ')) parts=($(echo "$plugin" | tr '/' ' '))
plugin_name=${parts[-1]} plugin_name=${parts[-1]}
echo "$VIM_BUNDLE $plugin_name $plugin"
link_dir $VIM_BUNDLE $plugin_name $plugin link_dir $VIM_BUNDLE $plugin_name $plugin
done done
@ -64,6 +71,7 @@ if [ ! -f "$HOME/.update_dotfiles.sh" ]; then
echo "cd $PWD" >> $HOME/.update_dotfiles.sh echo "cd $PWD" >> $HOME/.update_dotfiles.sh
echo "git checkout master" >> $HOME/.update_dotfiles.sh echo "git checkout master" >> $HOME/.update_dotfiles.sh
echo "git pull" >> $HOME/.update_dotfiles.sh echo "git pull" >> $HOME/.update_dotfiles.sh
echo "git submodule init" >> $HOME/.update_dotfiles.sh
echo "git submodule update" >> $HOME/.update_dotfiles.sh echo "git submodule update" >> $HOME/.update_dotfiles.sh
chmod +x $HOME/.update_dotfiles.sh chmod +x $HOME/.update_dotfiles.sh
fi fi
Loading…
Cancel
Save