install_dotfiles.sh 1.6 KB

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