aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gitmirror/files/rsync-metadata.sh
diff options
context:
space:
mode:
authorDan Fandrich <danf@mageia.org>2024-01-18 16:09:10 -0800
committerDan Fandrich <danf@mageia.org>2024-01-18 16:09:10 -0800
commitc96e287499d72cb86a15c499f47dc216f5cdc737 (patch)
tree01890e25df98ce2f0e293725c32feb50ab4581a0 /modules/gitmirror/files/rsync-metadata.sh
parentaa7a464e418c585440248b6f0a566ac55ce0bc79 (diff)
downloadpuppet-c96e287499d72cb86a15c499f47dc216f5cdc737.tar
puppet-c96e287499d72cb86a15c499f47dc216f5cdc737.tar.gz
puppet-c96e287499d72cb86a15c499f47dc216f5cdc737.tar.bz2
puppet-c96e287499d72cb86a15c499f47dc216f5cdc737.tar.xz
puppet-c96e287499d72cb86a15c499f47dc216f5cdc737.zip
Switch gitmirror files from templates to files
There are no template substitutions needed in these files, so allowing them opens the danger of substitutions happening unknowingly with future changes to these files.
Diffstat (limited to 'modules/gitmirror/files/rsync-metadata.sh')
-rwxr-xr-xmodules/gitmirror/files/rsync-metadata.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/gitmirror/files/rsync-metadata.sh b/modules/gitmirror/files/rsync-metadata.sh
new file mode 100755
index 00000000..03a0fe41
--- /dev/null
+++ b/modules/gitmirror/files/rsync-metadata.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+REPO="$1"
+GITROOT="/git"
+RSYNCROOT="rsync://duvel.mageia.org/git"
+
+if [ ! -d "$GITROOT/$REPO" ]; then
+ echo "No repository found $REPO" >&2
+ exit 1
+fi
+
+/usr/bin/rsync -a --include="description" --include="info" --include="info/web" --include="info/web/last-modified" --exclude="*" "$RSYNCROOT/$REPO/" "$GITROOT/$REPO/"
+/usr/bin/rsync -a "$RSYNCROOT/$REPO/config" "$GITROOT/$REPO/config.upstream"
+
+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.description "$DESC"
+fi