[sysadmin-bin: 22/168] Add script to discover git repos and generate cgit config file.



commit e7b986e0e0014e57f47865fc1325289472ba7c0c
Author: Kristian HÃgsberg <krh redhat com>
Date:   Thu Jan 8 23:23:53 2009 -0500

    Add script to discover git repos and generate cgit config file.

 find-repos.sh |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/find-repos.sh b/find-repos.sh
new file mode 100755
index 0000000..4ba995c
--- /dev/null
+++ b/find-repos.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+function list_repos() {
+    paths=$1
+    group=$2
+    for p in $paths; do
+	for r in $(echo $p/*); do
+	    if test -d $r/objects; then
+		shortname=${r/\/git\//}
+		shortname=${shortname/\/srv\//}
+		shortname=${shortname%%.git}
+		shortname=${shortname/\/home\//\~}
+		url=${shortname}
+		test -z "$group" || echo repo.group=$group
+		echo repo.url=$url
+		echo repo.name=$shortname
+		echo repo.desc=$(test -f $r/description && cat $r/description)
+		echo repo.path=$r
+		echo repo.owner=$(stat -c %U $r)
+		echo
+	    fi
+	done
+    done
+}
+
+list_repos "/git" "GNOME git repositories"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]