2011-09-05 12:19:31 -06:00
|
|
|
#!/bin/bash
|
2013-09-30 23:21:02 -06:00
|
|
|
case `uname` in
|
|
|
|
'Darwin')
|
|
|
|
readlink_command='greadlink'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
readlink_command='readlink'
|
|
|
|
esac
|
|
|
|
|
|
|
|
CURRENT_DIRECTORY="$(dirname "${BASH_SOURCE}" | xargs "${readlink_command}" -f)"
|
2013-09-25 17:38:16 -06:00
|
|
|
cd $CURRENT_DIRECTORY
|
|
|
|
|
|
|
|
echo "Linking From $CURRENT_DIRECTORY"
|
|
|
|
|
2011-09-05 12:19:31 -06:00
|
|
|
function doIt() {
|
2013-09-25 17:38:16 -06:00
|
|
|
[[ -a ~/.dotfiles-backups ]] || mkdir ~/.dotfiles-backups
|
|
|
|
exclude_list="setup.sh Monaco-Powerline.otf web_start.sh oh-my-zsh tmux-powerline .git .gitmodules .DS_store bootstrap.sh README.md more_python.txt . .. requirements.txt"
|
|
|
|
|
|
|
|
for i in .*; do
|
|
|
|
if ! [ -z ${i/*.swp/} ] && ! [[ $exclude_list =~ $i ]]
|
|
|
|
then
|
|
|
|
[[ -a ~/$i ]] && mv ~/$i ~/.dotfiles-backups/$i
|
|
|
|
ln -si $CURRENT_DIRECTORY/$i ~/$i
|
|
|
|
fi
|
|
|
|
done
|
2011-09-05 12:19:31 -06:00
|
|
|
}
|
2013-03-31 20:16:52 -06:00
|
|
|
|
2011-09-05 12:19:31 -06:00
|
|
|
if [ "$1" == "--force" -o "$1" == "-f" ]; then
|
2013-03-17 16:46:42 -06:00
|
|
|
doIt
|
2011-09-05 12:19:31 -06:00
|
|
|
else
|
2013-03-17 16:46:42 -06:00
|
|
|
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
|
|
|
|
echo
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
doIt
|
|
|
|
fi
|
2011-09-05 12:19:31 -06:00
|
|
|
fi
|
|
|
|
unset doIt
|
2013-03-17 03:33:15 -06:00
|
|
|
source ~/.bash_profile
|