improved install script
This commit is contained in:
parent
dbd7f1e8e3
commit
9905e9ae62
1 changed files with 64 additions and 72 deletions
136
install.sh
136
install.sh
|
|
@ -1,78 +1,70 @@
|
||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
main() {
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
# sore the calling directory to return later
|
# sore the calling directory to return later
|
||||||
CALLING_DIR=$PWD
|
CALLING_DIR=$PWD
|
||||||
|
|
||||||
# update/init submodules
|
|
||||||
cd $DIR
|
|
||||||
echo "updating git modules..."
|
|
||||||
git submodule init
|
|
||||||
git submodule update --init --recursive
|
|
||||||
|
|
||||||
# move vim stuff
|
|
||||||
echo "setting up vim files..."
|
|
||||||
for FILENAME in vimrc vim
|
|
||||||
do
|
|
||||||
if [ -e $HOME/.$FILENAME ]; then
|
|
||||||
echo "Moving old .$FILENAME to .${FILENAME}.bak"
|
|
||||||
mv $HOME/.$FILENAME $HOME/.${FILENAME}.bak
|
|
||||||
fi
|
|
||||||
echo "linking $DIR/vim-files/$FILENAME $HOME/.$FILENAME"
|
|
||||||
ln -s $DIR/vim-files/$FILENAME $HOME/.$FILENAME
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "installing bundles (vim will appear)..."
|
|
||||||
vim +BundleInstall +qall
|
|
||||||
|
|
||||||
# YouCompleteMe is slow to setup, so don't do it if we don't have to
|
|
||||||
if [ -e $DIR/.youcompletemesetup ]; then
|
|
||||||
echo "YouCompleteMe already setup, skipping... (remove .youcompletemesetup to force)"
|
|
||||||
else
|
|
||||||
echo "setting up YouCompleteMe..."
|
|
||||||
cd vim-files/vim/bundle/YouCompleteMe
|
|
||||||
./install.sh --clang-completer
|
|
||||||
cd $DIR
|
cd $DIR
|
||||||
touch .youcompletemesetup
|
|
||||||
fi
|
|
||||||
|
|
||||||
# move tmux stuff
|
echo "updating git modules..."
|
||||||
echo "setting up tmux files..."
|
setup_gitmodules
|
||||||
for FILENAME in tmux.conf
|
|
||||||
do
|
echo "setting up vim files..."
|
||||||
if [ -f $HOME/.${FILENAME} ] || [ -L $HOME/.$FILENAME ]; then
|
symlink_files vim-files vimrc vim
|
||||||
echo "Moving old .$FILENAME to .${FILENAME}.bak"
|
echo "installing bundles (vim will appear)..."
|
||||||
mv $HOME/.$FILENAME $HOME/.${FILENAME}.bak
|
vim +BundleInstall +qall
|
||||||
|
#setup_youcompleteme
|
||||||
|
|
||||||
|
echo "setting up tmux files..."
|
||||||
|
symlink_files tmux-files tmux.conf
|
||||||
|
|
||||||
|
echo "setting up bash files..."
|
||||||
|
symlink_files bash-files bashrc bash_profile
|
||||||
|
|
||||||
|
echo "setting up zsh files..."
|
||||||
|
symlink_files zsh-files zshrc oh-my-zsh
|
||||||
|
|
||||||
|
echo "setting up powerline..."
|
||||||
|
|
||||||
|
echo "setting up git files..."
|
||||||
|
symlink_files git-files gitconfig
|
||||||
|
|
||||||
|
cd $CALLING_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_gitmodules() {
|
||||||
|
# assumes we're already in a git repo
|
||||||
|
git submodule init
|
||||||
|
git submodule update --init --recursive
|
||||||
|
}
|
||||||
|
|
||||||
|
symlink_files() {
|
||||||
|
source_dir=$1
|
||||||
|
filenames=${@:2}
|
||||||
|
|
||||||
|
for filename in $filenames
|
||||||
|
do
|
||||||
|
if [ -f $HOME/.${filename} ] || [ -L $HOME/.$filename ]; then
|
||||||
|
echo "Moving old .$filename to .${filename}.bak"
|
||||||
|
mv $HOME/.$filename $HOME/.${filename}.bak
|
||||||
|
fi
|
||||||
|
echo "linking $DIR/$source_dir/$filename $HOME/.$filename"
|
||||||
|
ln -s "$DIR/$source_dir/$filename" "$HOME/.$filename"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_youcompleteme() {
|
||||||
|
# YouCompleteMe is slow to setup, so don't do it if we don't have to
|
||||||
|
if [ -e $DIR/.youcompletemesetup ]; then
|
||||||
|
echo "YouCompleteMe already setup, skipping... (remove .youcompletemesetup to force)"
|
||||||
|
else
|
||||||
|
echo "setting up YouCompleteMe..."
|
||||||
|
cd vim-files/vim/bundle/YouCompleteMe
|
||||||
|
./install.sh --clang-completer
|
||||||
|
cd $DIR
|
||||||
|
touch .youcompletemesetup
|
||||||
fi
|
fi
|
||||||
echo "linking $DIR/tmux-files/$FILENAME $HOME/.$FILENAME"
|
}
|
||||||
ln -s $DIR/tmux-files/$FILENAME $HOME/.$FILENAME
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "setting up bash files..."
|
main
|
||||||
for FILENAME in bashrc bash_profile
|
|
||||||
do
|
|
||||||
if [ -f $HOME/.${FILENAME} ] || [ -L $HOME/.$FILENAME ]; then
|
|
||||||
echo "Moving old .$FILENAME to .${FILENAME}.bak"
|
|
||||||
mv $HOME/.$FILENAME $HOME/.${FILENAME}.bak
|
|
||||||
fi
|
|
||||||
echo "linking $DIR/bash-files/$FILENAME $HOME/.$FILENAME"
|
|
||||||
ln -s $DIR/bash-files/$FILENAME $HOME/.$FILENAME
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "setting up zsh files..."
|
|
||||||
for FILENAME in zshrc oh-my-zsh
|
|
||||||
do
|
|
||||||
if [ -f $HOME/.${FILENAME} ] || [ -L $HOME/.$FILENAME ]; then
|
|
||||||
echo "Moving old .$FILENAME to .${FILENAME}.bak"
|
|
||||||
mv $HOME/.$FILENAME $HOME/.${FILENAME}.bak
|
|
||||||
fi
|
|
||||||
echo "linking $DIR/zsh-files/$FILENAME $HOME/.$FILENAME"
|
|
||||||
ln -s $DIR/zsh-files/$FILENAME $HOME/.$FILENAME
|
|
||||||
done
|
|
||||||
|
|
||||||
# set up powerline
|
|
||||||
echo "setting up powerline..."
|
|
||||||
|
|
||||||
|
|
||||||
cd $CALLING_DIR
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue