stagit

add example script to make repo index and files per dir

Hiltjo Posthuma contact@arjunchoudhary.com

commit: 0fc2c00 parent: 0f09889
1 files changed, 37 insertions(+), 0 deletions(-)
Aexample.sh+37-0
A · example.sh +37, -0
 1@@ -0,0 +1,37 @@
 2+#!/bin/sh
 3+# - Makes index for repositories in a single directory.
 4+# - Makes static pages for each repository directory.
 5+#
 6+# NOTE, things to do manually (once):
 7+# - copy style.css, logo.png and favicon.png manually, a style.css example
 8+#   is included.
 9+# - write clone url, for example "git://git.codemadness.org/dir" to the "url"
10+#   file for each repo.
11+#
12+# Usage:
13+# - mkdir -p htmldir && cd htmldir
14+# - sh example.sh repo-dir
15+
16+set -e
17+
18+reposdir="/var/www/domains/git.codemadness.nl/home/src/"
19+curdir=$(pwd)
20+
21+# make index.
22+cd "${reposdir}"
23+find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs urmoms-index > "${curdir}/index.html"
24+
25+# make files per repo.
26+find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
27+	cd "${reposdir}"
28+	d=$(basename "${dir}")
29+
30+	printf "%s..." "${d}"
31+	cd "${curdir}"
32+	
33+	test -d "${d}" || mkdir -p "${d}"
34+	cd "${d}"
35+	urmoms "${reposdir}${d}"
36+
37+	printf " done\n"
38+done