aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-11-19 17:43:22 +0530
committerGitHub <[email protected]>2025-11-19 17:43:22 +0530
commit0ce03c4073cb6a2f9d47b59e5b059dea59db7571 (patch)
tree61092ff1223c82e372a0b6f2b19c0c7836f37887
parent1c3f97cc2a3115e38235f4ddd940be63c4363d68 (diff)
downloadcgitconf-0ce03c4073cb6a2f9d47b59e5b059dea59db7571.tar.xz
cgitconf-0ce03c4073cb6a2f9d47b59e5b059dea59db7571.zip
Add mirror-sync script for repository synchronization
-rw-r--r--bin/mirror-sync21
1 files changed, 21 insertions, 0 deletions
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."