install.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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"
  26. for F in "$CMD_DIR/atom/"*; do
  27. FN=${F%%*/}
  28. link "$CMD_DIR/atom/$FN" "$HOME/atom/$FN"
  29. done
  30. if ! [[ -d "$HOME/.atom/packages/" ]]; then
  31. if which apm &>/dev/null; then
  32. "$CMD_DIR/install_atom_plugins.sh"
  33. else
  34. echo "# WARN: Unable to find Atom's \"apm\" command."
  35. echo "# WARN: 1. Get Atom from the website or automatically using \"gimme atom\""
  36. echo "# WARN: 2. Install the atom plugins using \"$CMD_DIR/install_atom_plugins.sh\""
  37. fi
  38. fi