example_create.sh (1245B)
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) before running this script: 6 # - copy style.css, logo.png and favicon.png manually, a style.css example 7 # is included. 8 # 9 # - write clone URL, for example "git://git.codemadness.org/dir" to the "url" 10 # file for each repo. 11 # - write owner of repo to the "owner" file. 12 # - write description in "description" file. 13 # 14 # Usage: 15 # - mkdir -p htmldir && cd htmldir 16 # - sh example_create.sh 17 18 if [ -z "${2}" ]; 19 then 20 echo "args missing, usage: example_create.sh <path to repos> <baseurl of stagit>" 21 exit 1 22 fi 23 24 # path must be absolute. 25 reposdir="${1}" 26 baseurl="${2}" 27 curdir="$(pwd)" 28 29 # make index. 30 stagit-index "${reposdir}/"*.git/ > "${curdir}/index.html" 31 32 # make files per repo. 33 for dir in "${reposdir}/"*.git/; do 34 # strip .git suffix. 35 r=$(basename "${dir}") 36 d=$(basename "${dir}" ".git") 37 printf "%s... " "${d}" 38 39 mkdir -p "${curdir}/${d}" 40 cd "${curdir}/${d}" || continue 41 stagit -c ".cache" -u "${baseurl}/$d/" "${reposdir}/${r}" 42 43 # symlinks 44 ln -sf log.html index.html 45 ln -sf ../style.css style.css 46 ln -sf ../logo.png logo.png 47 ln -sf ../favicon.png favicon.png 48 49 echo "done" 50 done