chiark / gitweb /
Provide cgit-regen-config command for cgi-grnet-01.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 Jul 2015 15:53:26 +0000 (16:53 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 Jul 2015 16:30:14 +0000 (17:30 +0100)
debian/changelog
infra/cgit-regen-config [new file with mode: 0755]

index 610322e..b5ae326 100644 (file)
@@ -5,6 +5,7 @@ dgit (0.31~~) unstable; urgency=low
 
   Infrastructure:
   * Provide for mirroring git updates to a different server.
+  * Provide cgit-regen-config command for cgi-grnet-01.
 
  -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sat, 11 Jul 2015 14:30:19 +0100
 
diff --git a/infra/cgit-regen-config b/infra/cgit-regen-config
new file mode 100755 (executable)
index 0000000..36228a1
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -e
+
+root=/srv/dgit.debian.org
+
+repos=$root/unpriv/repos
+outfile=$root/etc/projects.cgit
+lockfile=$outfile.lock
+template=$root/config/cgit-template
+
+flock $lockfile -c '
+       outfile='"$outfile"'
+       repos='"$repos"'
+       exec >"$outfile.tmp"
+       for ff in "$repos"/[0-9a-z]*.git; do
+               f=${ff##*/}
+               p=${f%.git}
+               cat <<END
+repo.url=$f
+repo.path=$repos/$f
+END
+               sed "s/%PACKAGE%/$p/g" <'"$template"'
+               echo
+       done
+       mv -f "$outfile.tmp" "$outfile"
+'