separate sites

main
Linux User 2021-01-03 21:07:21 +01:00
parent 5fe69c4e58
commit 6d7699c2bb
3 changed files with 26 additions and 17 deletions

View File

@ -2,10 +2,11 @@
set -e 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}" GL_REPO_BASE="${GL_REPO_BASE:-/var/lib/git/repositories}"
gitolite list-phy-repos | \ mk_index () {
gitolite list-phy-repos | \
gitolite access % stagit R any | \ gitolite access % stagit R any | \
awk \ awk \
-F'\t' \ -F'\t' \
@ -13,4 +14,14 @@ gitolite list-phy-repos | \
'{if ($3 !~ "DENIED") print d"/"$1".git"}' | \ '{if ($3 !~ "DENIED") print d"/"$1".git"}' | \
xargs -r /usr/local/bin/stagit-index | \ xargs -r /usr/local/bin/stagit-index | \
sed 's|\(<a href=".*\)/log.html\(">\)|\1\2|' > \ sed 's|\(<a href=".*\)/log.html\(">\)|\1\2|' > \
"${STAGIT_DIR}/index.html" "${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

View File

@ -13,9 +13,9 @@ GL_REPO_BASE="${GL_REPO_BASE:-/var/lib/git/repositories}"
run_stagit () { run_stagit () {
repo_dir="${GL_REPO_BASE}/${1}.git" repo_dir="${GL_REPO_BASE}/${1}.git"
if [ -n "${2}" ]; then if [ -n "${2}" ]; then
out_dir="${STAGIT_BASE}-${2}/${1}.git" out_dir="${STAGIT_BASE}-${2}/${1}"
else else
out_dir="${STAGIT_BASE}/${1}/git" out_dir="${STAGIT_BASE}/${1}"
fi fi
mkdir -p "${out_dir}" && \ mkdir -p "${out_dir}" && \
cd "${out_dir}" && \ cd "${out_dir}" && \
@ -66,5 +66,5 @@ if gitolite access "${1}" stagit R any; then
fi fi
else else
rm -rf "${STAGIT_BASE}*/${1}.git" rm -rf "${STAGIT_BASE}"*"/${1}.git"
fi fi

View File

@ -2,7 +2,7 @@
set -e 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 for algorithm in rsa dsa ecdsa ed25519; do
keyfile="/etc/ssh/keys/ssh_host_${algorithm}_key" keyfile="/etc/ssh/keys/ssh_host_${algorithm}_key"
@ -22,7 +22,7 @@ mkdir -p \
chown -R git:git \ chown -R git:git \
"${BASE_DIR}/.gitolite" \ "${BASE_DIR}/.gitolite" \
"${BASE_DIR}/.ssh" \ "${BASE_DIR}/.ssh" \
"${BASE_DIR}/stagit" \ "${BASE_DIR}/stagit"* \
"${BASE_DIR}/repositories" "${BASE_DIR}/repositories"
if [ ! -f "${BASE_DIR}/.ssh/authorized_keys" ]; then if [ ! -f "${BASE_DIR}/.ssh/authorized_keys" ]; then
@ -42,8 +42,6 @@ else
fi fi
echo "building static site" 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-repos
su-exec git build-stagit-index su-exec git build-stagit-index