git-selfhost

Self-hosted git server with auto-regenerating static stagit frontend
git clone git://git.deurzen.net/git-selfhost
Log | Files | Refs | README

generate.sh (585B)


      1 #!/bin/sh
      2 
      3 GITDIR="/srv/git"
      4 WEBDIR="/var/www/html"
      5 
      6 stagit-index "${GITDIR}/"*/ > "${WEBDIR}/index.html"
      7 
      8 # make files per repo
      9 for repo in "${GITDIR}/"*/; do
     10     # strip .git suffix
     11     REPO_DIR=$(basename "${repo}")
     12     REPO_NAME=$(basename "${repo}" ".git")
     13     printf "%s... " "${REPO_NAME}"
     14 
     15     mkdir -p "${WEBDIR}/${REPO_NAME}"
     16     cd "${WEBDIR}/${REPO_NAME}" || continue
     17     stagit -c ".cache" "${GITDIR}/${REPO_DIR}"
     18 
     19     ln -sf log.html index.html
     20     ln -sf ../style.css style.css
     21     ln -sf ../logo.png logo.png
     22     ln -sf ../favicon.png favicon.png
     23 
     24     echo "done"
     25 done