commit 1e508a7c37525ffea349cd5ee8320eaaa9c1e968 parent 4d241afb1dae27b45d2127f3d4e992ca250dc277 Author: Chris Bracken <chris@bracken.jp> Date: Wed, 11 Aug 2021 16:41:24 +0000 Add rebuild_all.sh Adds a utility script to use stagit to rebuild the index and pages for all public repos. Diffstat:
A | rebuild_all.sh | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 40 insertions(+), 0 deletions(-)
diff --git a/rebuild_all.sh b/rebuild_all.sh @@ -0,0 +1,40 @@ +#!/bin/sh -e + +# HTML root directory into which stagit will write. +www_root="/jails/git_bracken_jp/usr/local/www/stagit" + +# The directory under which all repos are located. +# Repos under this directory will be added to the repo index page. +repos_root="/home/git" + +# Generate the index page. +# Any repo containing a stagit-no-index file will be skipped. +echo "[stagit] Building repo index" +find "${repos_root}" -maxdepth 1 \ + -type d \ + -name "*.git" \ + -exec test -e "{}/git-daemon-export-ok" \; \ + -print \ + | sort -f \ + | sed -e 's/"/"\\""/g' -e 's/.*/"&"/' \ + | xargs stagit-index \ + > "${www_root}/index.html" + +echo "[stagit] Building all stagit repos" +repos="$(find "${repos_root}" -maxdepth 1 \ + -type d \ + -name "*.git" \ + -exec test -e "{}/git-daemon-export-ok" \; \ + -print)" +for repo_dir in ${repos}; do + repo_name="$(basename "${repo_dir}" ".git")" + out_dir="${www_root}/${repo_name}" + + echo "[stagit] ... ${repo_name}" + mkdir -p "${out_dir}" + rm -f "${repo_dir}/.htmlcache" + rm -rf "${out_dir}/commit" + rm -rf "${out_dir}/file" + cd "${out_dir}" + stagit -c "${repo_dir}/.htmlcache" "${repo_dir}" +done