blob: ab79327a46201f8c7ceaf07234948943dfb6856d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/sh
# - Makes index for repositories in a single directory.
# - Makes static pages for each repository directory.
#
# NOTE, things to do manually (once) before running this script:
# - copy style.css, logo.png and favicon.png manually, a style.css example
# is included.
#
# - write clone url, for example "git://git.codemadness.org/dir" to the "url"
# file for each repo.
# - write owner of repo to the "owner" file.
# - write description in "description" file.
#
# Usage:
# - mkdir -p htmldir && cd htmldir
# - sh example_create.sh
# path must be absolute
reposdir="/srv/git"
webdir="/srv/git/html"
defaultdir="/usr/local/share/doc/stagit"
mkdir -p "$webdir" || exit 1
# set assets if not already there
ln -s "$defaultdir/style.css" "$webdir/style.css" 2> /dev/null
ln -s "$defaultdir/logo.png" "$webdir/logo.png" 2> /dev/null
ln -s "$defaultdir/favicon.png" "$webdir/favicon.png" 2> /dev/null
# clean
for dir in "$webdir/"*/; do
rm -rf "$dir"
done
repos=""
# make files per repo
for dir in "$reposdir/"*.git/; do
[ ! -f "$dir/git-daemon-export-ok" ] && continue
repos="$repos $dir"
# strip .git suffix
r=$(basename "$dir")
d=$(basename "$dir" ".git")
printf "%s... " "$d"
mkdir -p "$webdir/$d"
cd "$webdir/$d" || continue
stagit -c ".stagit-build-cache" "$reposdir/$r"
# symlinks
[ -f "about.html" ] \
&& ln -sf about.html index.html \
|| ln -sf log.html index.html
ln -sf "$reposdir/$r" ".git"
echo "done"
done
# make index
echo "$repos" | xargs stagit-index > "$webdir/index.html"
|