You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
789 B

  1. #!/usr/bin/env bash
  2. #
  3. # A script to convert the local system to use my dotfiles my local dotfiles over
  4. # the provided ones already on the system. This script will backup any of the
  5. # existing dot files, before linking to the ones in this repository.
  6. #
  7. # Helper Functions
  8. # Make a backup of the existing file if it exists
  9. # Then link to our supplied dotfile
  10. link() {
  11. # Only make a backup if an existing file is there and is not a link
  12. if [ -f "$1/$2" ] && [ ! -L "$1/$2" ]; then
  13. cp "$1/$2" "$1/$2.old"
  14. echo "Backed up original $2 to $1/$2.old"
  15. fi
  16. ln -sf "$PWD/$3" "$1/$2"
  17. }
  18. set -x
  19. set -e
  20. # Configure .vimrc
  21. link "$HOME" ".vimrc" "vimrc"
  22. # Configure .gitconfig
  23. link "$HOME" ".gitconfig" "gitconfig"
  24. # Configure .zshrc
  25. link "$HOME" ".zshrc" "zshrc"