oshgit

Shell scripts based on stagit to manage OSHs git repositories.
git clone git://git.oshgnacknak.de/oshgit.git
Log | Files | Refs | README

build.sh (1175B)


      1 #!/bin/bash
      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 here=$(realpath $(dirname $0))
     15 repos=$(realpath $here)/../*.git/
     16 output=/var/www/html
     17 
     18 echo Building repository list to $output
     19 stagit-index $repos > $output/index.html
     20 cp $here/style.css $output/style.css
     21 cp $here/logo.png $output/logo.png
     22 ln -sf $output/logo.png $output/favicon.png
     23 
     24 for repo in ${@:-$repos}; do
     25     dir="$output/$(basename $repo .git)"
     26     repo=$(realpath $repo)
     27 
     28     mkdir -p $dir
     29     pushd $dir
     30 
     31     echo Building html for $repo to $dir
     32     stagit -c ".cache" $repo
     33 
     34     ln -sf log.html index.html
     35     ln -sf $output/style.css style.css
     36     ln -sf $output/logo.png logo.png
     37     ln -sf $output/logo.png favicon.png
     38 
     39     popd
     40 done
     41 
     42 chgrp www-data $output -R
     43 chmod 770 $output -R