#!/bin/bash set -e cd IFS='' find . -not -path '*/.*' -path '*.git' -type d | while read -r git_dir; do mkdir -p -- "${git_dir}/hooks" find "${git_dir}/hooks" \( -name '*.sample' -o -type l \) -delete if ! [[ -f "${git_dir}/hooks/post-receive" ]]; then ln -srv git-hooks/post-receive.agefile "${git_dir}/hooks/post-receive" fi done