gitpages

A collection of scripts to securely webhost and publish git repositories.
git clone https://scm.kuandu.systems/git-raw/gitpages.git
Log | Files | Refs | README | LICENSE

commit bf6b9fe025e2cdf45d376cd29f628a962c56e0e6
parent d0525d2eafcf126a6e05ac6d39a93a103a73466a
Author: Fred Großkopf <fred@kuandu.systems>
Date:   Wed, 16 Sep 2026 18:08:02 +0200

Fixes gitpages-regenerate.sh

Diffstat:
Mgitpages-regenerate.sh | 17+++++++++++------
Mtest-gitpages-regenerate.sh | 3++-
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gitpages-regenerate.sh b/gitpages-regenerate.sh @@ -42,20 +42,25 @@ main() { [ -f "$CONFIG_PATH" ] || error "Config file $CONFIG_PATH not found" # Retrieve values + WEB_ROOT=$(get_config_val "WEB_ROOT" "$CONFIG_PATH") GIT_SRC=$(get_config_val "GIT_SRC" "$CONFIG_PATH") GIT_RAW=$(get_config_val "GIT_RAW" "$CONFIG_PATH") - [ -z "$GIT_SRC" ] || [ -z "$GIT_RAW" ] && error "GIT_SRC or GIT_RAW missing in config" + if [ -z "$WEB_ROOT" ] || [ -z "$GIT_SRC" ] || [ -z "$GIT_RAW" ]; then + error "WEB_ROOT, GIT_SRC or GIT_RAW missing in config" + fi + [ -d "$WEB_ROOT" ] || error "WEB_ROOT directory $WEB_ROOT does not exist" [ -d "$GIT_SRC" ] || error "GIT_SRC directory $GIT_SRC does not exist" - [ -d "$GIT_RAW" ] || error "GIT_RAW directory $GIT_RAW does not exist" - printf 'info: 1/2 Mirroring repos %s → %s\n' "$GIT_SRC" "$GIT_RAW" - gitpages-mirror-git.sh "$GIT_SRC" "$GIT_RAW" || error "Mirroring failed" + GIT_RAW_DIR="$WEB_ROOT/$GIT_RAW" - printf 'info: 2/2 Generating HTML for all repos in %s\n' "$GIT_RAW" + printf 'info: 1/2 Mirroring repos %s → %s\n' "$GIT_SRC" "$GIT_RAW_DIR" + gitpages-mirror-git.sh "$GIT_SRC" "$GIT_RAW_DIR" || error "Mirroring failed" + + printf 'info: 2/2 Generating HTML for all repos in %s\n' "$GIT_RAW_DIR" # Iterate over each .git directory and call gitpages.sh - for repo in "$GIT_RAW"/*.git; do + for repo in "$GIT_RAW_DIR"/*.git; do [ -e "$repo" ] || continue printf ' Processing: %s\n' "$(basename "$repo")" gitpages.sh -c "$CONFIG_PATH" "$repo" || error "HTML generation failed for $repo" diff --git a/test-gitpages-regenerate.sh b/test-gitpages-regenerate.sh @@ -52,8 +52,9 @@ touch "$GIT_RAW/myrepo.git" # Create test config cat <<EOF > "$CONFIG_FILE" +WEB_ROOT=$TEST_DIR GIT_SRC=$GIT_SRC -GIT_RAW=$GIT_RAW +GIT_RAW=raw EOF echo "Running test on gitpages-regenerate.sh..."