deploy 629 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. # Deploys the dotfiles in this directory using GNU stow
  3. set -euo pipefail
  4. # Get this script's directory
  5. SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
  6. # Change to the dotfiles directory (push current dir on the stack)
  7. pushd "$SCRIPT_DIR" > /dev/null || exit 1
  8. # Loop through non-hidden top-level dirs and stow them
  9. for dir in */; do
  10. [[ $dir == .* || $dir == secrets/ ]] && continue # Skip dot-directories
  11. echo "Stowing $dir"
  12. if ! stow "$dir"; then
  13. errorcode=$?
  14. echo "Error stowing $dir"
  15. fi
  16. done
  17. # Return to original directory
  18. popd > /dev/null || exit 1
  19. exit "${errorcode:-0}"