]> git.armaanb.net Git - stagit.git/blob - example.sh
refs_cmp: simplify check, functionally the same
[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 reposdir="/var/www/domains/git.codemadness.nl/home/src"
16 curdir=$(pwd)
17
18 # make index.
19 cd "${reposdir}"
20 find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index > "${curdir}/index.html"
21
22 # make files per repo.
23 cd "${reposdir}"
24 find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
25         d=$(basename "${dir}")
26         printf "%s... " "${d}"
27
28         mkdir -p "${curdir}/${d}"
29         cd "${curdir}/${d}"
30         stagit -c ".cache" "${reposdir}/${d}"
31
32         # symlinks
33         ln -sf log.html index.html
34         ln -sf ../style.css style.css
35         ln -sf ../logo.png logo.png
36         ln -sf ../favicon.png favicon.png
37
38         printf "done\n"
39 done