From 6d7699c2bb2c61f6a21076d5430d0389b677f7a5 Mon Sep 17 00:00:00 2001 From: Linux User Date: Sun, 3 Jan 2021 21:07:21 +0100 Subject: [PATCH] separate sites --- gitolite-stagit/bin/build-stagit-index | 31 +++++++++++++++++--------- gitolite-stagit/bin/build-stagit-repo | 6 ++--- gitolite-stagit/bin/entrypoint | 6 ++--- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/gitolite-stagit/bin/build-stagit-index b/gitolite-stagit/bin/build-stagit-index index cb81ac3..6b3770b 100644 --- a/gitolite-stagit/bin/build-stagit-index +++ b/gitolite-stagit/bin/build-stagit-index @@ -2,15 +2,26 @@ set -e -STAGIT_DIR="${STAGIT_DIR:-/var/lib/git/stagit}" +STAGIT_BASE="${STAGIT_BASE:-/var/lib/git/stagit}" GL_REPO_BASE="${GL_REPO_BASE:-/var/lib/git/repositories}" -gitolite list-phy-repos | \ - gitolite access % stagit R any | \ - awk \ - -F'\t' \ - -v d="${GL_REPO_BASE}" \ - '{if ($3 !~ "DENIED") print d"/"$1".git"}' | \ - xargs -r /usr/local/bin/stagit-index | \ - sed 's|\(\)|\1\2|' > \ - "${STAGIT_DIR}/index.html" +mk_index () { + gitolite list-phy-repos | \ + gitolite access % stagit R any | \ + awk \ + -F'\t' \ + -v d="${GL_REPO_BASE}" \ + '{if ($3 !~ "DENIED") print d"/"$1".git"}' | \ + xargs -r /usr/local/bin/stagit-index | \ + sed 's|\(\)|\1\2|' > \ + "${1}/index.html" +} + +if [ -n "${SITES}" ]; then + _i=1 + for site in ${SITES}; do + mk_index "${STAGIT_BASE}-${site}" + done +else + mk_index "${STAGIT_BASE}" +fi diff --git a/gitolite-stagit/bin/build-stagit-repo b/gitolite-stagit/bin/build-stagit-repo index 42e8a8f..ebd9f59 100644 --- a/gitolite-stagit/bin/build-stagit-repo +++ b/gitolite-stagit/bin/build-stagit-repo @@ -13,9 +13,9 @@ GL_REPO_BASE="${GL_REPO_BASE:-/var/lib/git/repositories}" run_stagit () { repo_dir="${GL_REPO_BASE}/${1}.git" if [ -n "${2}" ]; then - out_dir="${STAGIT_BASE}-${2}/${1}.git" + out_dir="${STAGIT_BASE}-${2}/${1}" else - out_dir="${STAGIT_BASE}/${1}/git" + out_dir="${STAGIT_BASE}/${1}" fi mkdir -p "${out_dir}" && \ cd "${out_dir}" && \ @@ -66,5 +66,5 @@ if gitolite access "${1}" stagit R any; then fi else - rm -rf "${STAGIT_BASE}*/${1}.git" + rm -rf "${STAGIT_BASE}"*"/${1}.git" fi diff --git a/gitolite-stagit/bin/entrypoint b/gitolite-stagit/bin/entrypoint index b92f1c7..8f4fa2e 100644 --- a/gitolite-stagit/bin/entrypoint +++ b/gitolite-stagit/bin/entrypoint @@ -2,7 +2,7 @@ set -e -env | awk -F"=" '{ print $1"=\""$2"\"" }' > /etc/env +su-exec git env | awk -F"=" '{ print $1"=\""$2"\"" }' > /etc/env for algorithm in rsa dsa ecdsa ed25519; do keyfile="/etc/ssh/keys/ssh_host_${algorithm}_key" @@ -22,7 +22,7 @@ mkdir -p \ chown -R git:git \ "${BASE_DIR}/.gitolite" \ "${BASE_DIR}/.ssh" \ - "${BASE_DIR}/stagit" \ + "${BASE_DIR}/stagit"* \ "${BASE_DIR}/repositories" if [ ! -f "${BASE_DIR}/.ssh/authorized_keys" ]; then @@ -42,8 +42,6 @@ else fi echo "building static site" -su-exec git set-urls -su-exec git set-owners su-exec git build-stagit-repos su-exec git build-stagit-index