2012-11-09 20:44:06 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2013-03-21 20:56:52 -07:00
|
|
|
# Initialize any submodules
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
2012-11-09 20:44:06 -08:00
|
|
|
|
2013-03-21 21:30:06 -07:00
|
|
|
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
OS="$(lsb_release -si)"
|
2012-11-09 20:44:06 -08:00
|
|
|
|
2013-03-21 20:56:52 -07:00
|
|
|
# Helper function to remove old file and link the new one
|
|
|
|
function linkFile() {
|
|
|
|
if [ -f $1 ]; then
|
|
|
|
rm $1;
|
|
|
|
elif [ -d $1 ]; then
|
|
|
|
rm -rf $1
|
|
|
|
fi
|
|
|
|
ln -s $DIR/$1 $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
function createDirectory() {
|
|
|
|
if [ -d $1 ]; then
|
|
|
|
rm -rf $1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir $1
|
|
|
|
}
|
|
|
|
|
2013-03-21 21:30:06 -07:00
|
|
|
echo "This will create symlinks and destroy any conflicting configs already in place.";
|
|
|
|
read -p "Continue? [y/N] " choice
|
|
|
|
|
2013-03-21 20:56:52 -07:00
|
|
|
# Perform the logic
|
2012-11-09 20:44:06 -08:00
|
|
|
case "$choice" in
|
|
|
|
Y|y|yes )
|
|
|
|
echo "Moving to Home directory...";
|
|
|
|
cd ~;
|
|
|
|
|
2013-03-21 20:56:52 -07:00
|
|
|
echo "Linking shell configs...";
|
|
|
|
linkFile .bashrc
|
2013-03-04 20:59:34 -08:00
|
|
|
|
2012-11-09 20:44:06 -08:00
|
|
|
echo "Linking vim...";
|
2013-03-21 20:56:52 -07:00
|
|
|
linkFile .vimrc
|
|
|
|
createDirectory ~/.vim
|
|
|
|
createDirectory ~/.vim/swaps
|
|
|
|
createDirectory ~/.vim/backups
|
2012-11-09 20:44:06 -08:00
|
|
|
|
|
|
|
echo "Linking Git...";
|
2013-03-21 20:56:52 -07:00
|
|
|
linkFile .gitconfig
|
2012-11-09 20:44:06 -08:00
|
|
|
|
|
|
|
echo "Linking tmux...";
|
2013-03-21 20:56:52 -07:00
|
|
|
linkFile .tmux.conf
|
|
|
|
linkFile .tmux-powerline
|
2012-11-20 11:13:43 -08:00
|
|
|
|
2013-04-25 07:31:07 -07:00
|
|
|
echo "Linking inputrc..."
|
|
|
|
linkFile .inputrc
|
|
|
|
|
2013-03-21 20:56:52 -07:00
|
|
|
echo "Done! Restart your shell to see changes"
|
2012-11-09 20:44:06 -08:00
|
|
|
;;
|
|
|
|
* ) echo "Aborted!";;
|
|
|
|
esac
|