dotfiles/install.sh

60 lines
1.2 KiB
Bash
Raw Normal View History

2012-11-09 20:44:06 -08:00
#!/bin/bash
# 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
# 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
# Perform the logic
2012-11-09 20:44:06 -08:00
case "$choice" in
Y|y|yes )
echo "Moving to Home directory...";
cd ~;
echo "Linking shell configs...";
linkFile .bashrc
2012-11-09 20:44:06 -08:00
echo "Linking vim...";
linkFile .vimrc
createDirectory ~/.vim
createDirectory ~/.vim/swaps
createDirectory ~/.vim/backups
2012-11-09 20:44:06 -08:00
echo "Linking Git...";
linkFile .gitconfig
2012-11-09 20:44:06 -08:00
echo "Linking tmux...";
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
echo "Done! Restart your shell to see changes"
2012-11-09 20:44:06 -08:00
;;
* ) echo "Aborted!";;
esac