aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gitmirror/templates/rsync-metadata.sh
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-02-09 13:55:50 +0000
committerColin Guthrie <colin@mageia.org>2014-02-09 13:55:50 +0000
commit45c3e15f063ba493f67e6c3e67780118c86bb1bd (patch)
treee6f82243a318f2f0f6793ed1409a35306f074ebf /modules/gitmirror/templates/rsync-metadata.sh
parent07a56dfcfdfd9ccdf97454e589492eb8f6fb7223 (diff)
downloadpuppet-45c3e15f063ba493f67e6c3e67780118c86bb1bd.tar
puppet-45c3e15f063ba493f67e6c3e67780118c86bb1bd.tar.gz
puppet-45c3e15f063ba493f67e6c3e67780118c86bb1bd.tar.bz2
puppet-45c3e15f063ba493f67e6c3e67780118c86bb1bd.tar.xz
puppet-45c3e15f063ba493f67e6c3e67780118c86bb1bd.zip
Add a new system to ensure our git repos are mirrored properly.
This is a simple python daemon that I wrote which can be 'pinged' and told to update (or freshly clone) given git repos. Deploy this script on alamut (not started automatically yet)
Diffstat (limited to 'modules/gitmirror/templates/rsync-metadata.sh')
-rwxr-xr-xmodules/gitmirror/templates/rsync-metadata.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/gitmirror/templates/rsync-metadata.sh b/modules/gitmirror/templates/rsync-metadata.sh
new file mode 100755
index 00000000..7176cc54
--- /dev/null
+++ b/modules/gitmirror/templates/rsync-metadata.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+REPO="$1"
+GITROOT="/git"
+RSYNCROOT="rsync://valstar.mageia.org/git"
+
+if [ ! -d "$GITROOT/$REPO" ]; then
+ echo "No repository found $REPO" >&2
+ exit 1
+fi
+
+cp -af "$GITROOT/$REPO/config" "$GITROOT/$REPO/config.orig"
+/usr/bin/rsync -a --delete --include="description" --include="config" --include="info" --include="info/web" --include="info/web/last-modified" --exclude="*" "$RSYNCROOT/$REPO/" "$GITROOT/$REPO/"
+cp -af "$GITROOT/$REPO/config" "$GITROOT/$REPO/config.upstream"
+mv -f "$GITROOT/$REPO/config.orig" "$GITROOT/$REPO/config"
+
+OWNER=$(git config --file "$GITROOT/$REPO/config.upstream" gitweb.owner)
+DESC=$(git config --file "$GITROOT/$REPO/config.upstream" gitweb.description)
+rm -f "$GITROOT/$REPO/config.upstream"
+
+CUROWNER=$(git config --file "$GITROOT/$REPO/config" gitweb.owner)
+if [ "$CUROWNER" != "$OWNER" ]; then
+ git config --file "$GITROOT/$REPO/config" gitweb.owner "$OWNER"
+fi
+
+CURDESC=$(git config --file "$GITROOT/$REPO/config" gitweb.description)
+if [ "$CURDESC" != "$DESC" ]; then
+ git config --file "$GITROOT/$REPO/config" gitweb.owner "$DESC"
+fi