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,15 +2,26 @@
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 access % stagit R any | \ gitolite list-phy-repos | \
awk \ gitolite access % stagit R any | \
-F'\t' \ awk \
-v d="${GL_REPO_BASE}" \ -F'\t' \
'{if ($3 !~ "DENIED") print d"/"$1".git"}' | \ -v d="${GL_REPO_BASE}" \
xargs -r /usr/local/bin/stagit-index | \ '{if ($3 !~ "DENIED") print d"/"$1".git"}' | \
sed 's|\(<a href=".*\)/log.html\(">\)|\1\2|' > \ xargs -r /usr/local/bin/stagit-index | \
"${STAGIT_DIR}/index.html" sed 's|\(<a href=".*\)/log.html\(">\)|\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

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