]> git.armaanb.net Git - stagit.git/blob - example.sh
3998fe8c50fa95efcecf3f22fe178e54db49bcc0
[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 repo-dir
14
15 set -e
16
17 reposdir="/var/www/domains/git.codemadness.nl/home/src/"
18 curdir=$(pwd)
19
20 # make index.
21 cd "${reposdir}"
22 find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs urmoms-index > "${curdir}/index.html"
23
24 # make files per repo.
25 find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
26         cd "${reposdir}"
27         d=$(basename "${dir}")
28
29         printf "%s..." "${d}"
30         cd "${curdir}"
31         
32         test -d "${d}" || mkdir -p "${d}"
33         cd "${d}"
34         urmoms "${reposdir}${d}"
35
36         printf " done\n"
37 done