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

30 lines
676 B
Plaintext
Raw Normal View History

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