install_dotfiles.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. # BASH_SOURCE means the directory location of this bash script
  3. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
  4. exclude=("scripts")
  5. configs=("conky" "openbox" "tint2")
  6. elemIn() {
  7. for e in "${@:2}"; do
  8. [[ "$e" = "$1" ]] && return 1
  9. done
  10. return 0
  11. }
  12. link() {
  13. if [ -e "$1/$3$2" ]; then
  14. read -p "$1/$3$2 exists! Delete? [y/N] " -n 1 -r
  15. if [[ $REPLY =~ ^[Yy]$ ]]; then
  16. # It might be a very, very bad idea to rm -rf.
  17. rm -rf "$1/$3$2"
  18. ln -sn "$DIR/$2" "$1/$3$2"
  19. fi
  20. echo ""
  21. else
  22. ln -sn "$DIR/$2" "$1/$3$2"
  23. fi
  24. }
  25. for i in $(ls "$DIR"); do
  26. elemIn "$i" "${exclude[@]}"
  27. if [[ $? == 1 ]]; then continue; fi
  28. elemIn "$i" "${configs[@]}"
  29. if [[ $? == 1 ]]; then
  30. echo "Linking $i to $HOME/.config/$i"
  31. link "$HOME/.config" "$i"
  32. else
  33. echo "Linking $i to $HOME/.$i"
  34. link "$HOME" "$i" "."
  35. fi
  36. done
  37. ln -fsn $DIR/../vim "$HOME"/.vim
  38. ln -fsn $DIR/../vim/pathogen/autoload "$DIR"/../vim/
  39. mkdir -p "$DIR"/../vim/tmp/{backup,swap,undo}
  40. git submodule update --init --recursive
  41. git submodule foreach --recursive git pull origin master
  42. #Very specific to Arch
  43. read -p "Install boost and airline glyphs [y/N] " -n 1 -r
  44. if [[ $REPLY =~ ^[Yy]$ ]]; then
  45. yaourt -S boost powerline-fonts-git
  46. fi
  47. echo ""
  48. read -p "Auto compile YouCompleteMe? [y/N] " -n 1 -r
  49. if [[ $REPLY =~ ^[Yy]$ ]]; then
  50. echo ""
  51. echo "Compiling YouCompleteMe"
  52. cd "$DIR"/../vim/bundle/YouCompleteMe
  53. ./install.sh
  54. fi
  55. echo ""
  56. read -p "Auto compile exuberant-ctags? [y/N] " -n 1 -r
  57. if [[ $REPLY =~ ^[Yy]$ ]]; then
  58. echo ""
  59. git clone git://github.com/jakedouglas/exuberant-ctags.git "$DIR"/exuberant-ctags
  60. cd "$DIR"/exuberant-ctags
  61. ./configure
  62. make
  63. sudo make install
  64. rm -rf "$DIR"/exuberant-ctags
  65. fi
  66. echo ""