dockerfiles/gitolite-pystagit/bin/build-pystagit-index

30 lines
676 B
Bash

#!/bin/sh
set -e
PYSTAGIT_BASE="${PYSTAGIT_BASE:-/var/lib/git/pystagit}"
GL_REPO_BASE="${GL_REPO_BASE:-/var/lib/git/repositories}"
mk_index () {
gitolite list-phy-repos | \
gitolite access % pystagit R any | \
awk \
-F'\t' \
-v d="${GL_REPO_BASE}" \
'{if ($3 !~ "DENIED") print d"/"$1".git"}' | \
xargs -r /usr/bin/pystagit-index > \
"${1}/index.html" && \
chmod 644 "${1}/index.html"
}
# shellcheck disable=SC1091
[ -f /etc/env ] && . /etc/env
if [ -n "${SITES}" ]; then
for site in ${SITES}; do
mk_index "${PYSTAGIT_BASE}-${site}"
done
else
mk_index "${PYSTAGIT_BASE}"
fi