install.sh 723 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. set -o errexit -o pipefail
  3. # support curl|bash
  4. if [[ "$0" =~ [-]?bash ]] && ! [[ "$BASH_SOURCE" ]]; then
  5. git clone "https://github.com/KylePDavis/dotfiles" "$HOME/.dotfiles"
  6. exec "$HOME/.dotfiles/install.sh"
  7. fi
  8. CMD_DIR=$(cd "${BASH_SOURCE%/*}"; echo "$PWD")
  9. link() {
  10. local SRC=$1
  11. local DST=$2
  12. if [[ -f "$DST" ]]; then
  13. if ! [[ -L "$DST" ]]; then
  14. mkdir -p "${DST%/*}"
  15. mv -vi "$DST" "$DST.bak"
  16. ln -sfv "$SRC" "$DST"
  17. fi
  18. fi
  19. }
  20. link "$CMD_DIR/.profile" "$HOME/.profile"
  21. link "$CMD_DIR/.profile" "$HOME/.bashrc"
  22. link "$CMD_DIR/.vimrc" "$HOME/.vimrc"
  23. link "$CMD_DIR/.jshintrc" "$HOME/.jshintrc"
  24. link "$CMD_DIR/.jscsrc" "$HOME/.jscsrc"
  25. link "$CMD_DIR/.node-inspectorrc" "$HOME/.node-inspectorrc"