#!/usr/bin/env sh set -u # Base location of all mirrors MIRRORS_BASE_DIR="{{ git_mirrors_base_dir }}/mirrored" # Locate repositories knowing that there will be a HEAD file inside them FOUND_REPOS=$(find "$MIRRORS_BASE_DIR" -name "HEAD" -print0 | xargs -0 dirname) for repo in $FOUND_REPOS; do cd "$repo"; echo "Updating $repo mirror..." if ! nice git fetch -q --prune; then echo "Error: Failed to update repository $repo" exit 1 fi echo "Updated repository." cd - done