]> git.armaanb.net Git - stagit.git/blob - example.sh
reduce scope of repodir, remove unused branch parameter
[stagit.git] / example.sh
1 #!/bin/sh
2 # - Makes index for repositories in a single directory.
3 # - Makes static pages for each repository directory.
4 #
5 # NOTE, things to do manually (once):
6 # - copy style.css, logo.png and favicon.png manually, a style.css example
7 #   is included.
8 # - write clone url, for example "git://git.codemadness.org/dir" to the "url"
9 #   file for each repo.
10 #
11 # Usage:
12 # - mkdir -p htmldir && cd htmldir
13 # - sh example.sh
14
15 # path must be absolute.
16 reposdir="/var/www/domains/git.codemadness.nl/home/src"
17 curdir=$(pwd)
18
19 # make index.
20 stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
21
22 # make files per repo.
23 for dir in "${reposdir}/"*/; do
24         # strip .git suffix.
25         r=$(basename "${dir}")
26         d=$(basename "${dir}" ".git")
27         printf "%s... " "${d}"
28
29         mkdir -p "${curdir}/${d}"
30         cd "${curdir}/${d}"
31         stagit -c ".cache" "${reposdir}/${r}"
32
33         # symlinks
34         ln -sf log.html index.html
35         ln -sf ../style.css style.css
36         ln -sf ../logo.png logo.png
37         ln -sf ../favicon.png favicon.png
38
39         printf "done\n"
40 done