git-scripts

Scripts for managing (sta-)git repos
git clone git://git.christianermann.dev/git-scripts
Log | Files | Refs | LICENSE

repo-site.sh (679B)


      1 #! /bin/sh
      2 
      3 set -euf
      4 export LC_CTYPE="en_US.UTF-8"
      5 
      6 CONFIG_PATH="/home/git/config.rc"
      7 . "${CONFIG_PATH}"
      8 
      9 repo="$(pwd)"
     10 name="$(basename "$repo")"
     11 dest="${WWW_ROOT}/${name}"
     12 
     13 # Check if repo is public. This is denoted by the existence of a file
     14 # named `git-daemon-export-ok`.
     15 if [ ! -f "${repo}/git-daemon-export-ok" ]; then
     16     exit 0
     17 fi
     18 
     19 printf "Publishing: %s\n" "${name}"
     20 
     21 # Add files to specify repo metadata.
     22 printf "%s/%s\n" "${URI_BASE}" "${name}" > "${repo}/url"
     23 
     24 # Build pages for repo.
     25 mkdir -p "${dest}" && cd "${dest}" || exit 1
     26 stagit "${repo}"
     27 ln -sf log.html index.html
     28 ln -sf ../style.css style.css
     29 ln -sf ../logo.png logo.png
     30 ln -sf ../favicon.png favicon.png