From 0ce03c4073cb6a2f9d47b59e5b059dea59db7571 Mon Sep 17 00:00:00 2001 From: Bobby <30593201+luciferreeves@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:43:22 +0530 Subject: Add mirror-sync script for repository synchronization --- bin/mirror-sync | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bin/mirror-sync diff --git a/bin/mirror-sync b/bin/mirror-sync new file mode 100644 index 0000000..e391030 --- /dev/null +++ b/bin/mirror-sync @@ -0,0 +1,21 @@ +#!/bin/bash + +REPO_DIR="/root/shifoogit/repos" + +echo "Syncing all mirrors in $REPO_DIR" + +for repo in "$REPO_DIR"/*; do + if [ -d "$repo" ] && [ -f "$repo/config" ]; then + echo "Updating $(basename "$repo") ..." + + setpriv --reuid 1000 --regid 1000 --clear-groups git -C "$repo" remote update --prune + + # Update agefile + LAST_COMMIT=$(git -C "$repo" log -1 --format="%ci") + mkdir -p "$repo/info/web" + echo "$LAST_COMMIT" > "$repo/info/web/last-modified" + chown -R 1000:1000 "$repo/info" + fi +done + +echo "All mirrors updated." -- cgit v1.2.3