fix: ensure data directories exist before creating them in Unraid setup

This commit is contained in:
S
2026-03-02 09:29:22 -05:00
parent c5190020de
commit 1ac02ad10d

View File

@@ -33,19 +33,15 @@ DATA_PATH="$UNRAID_GITEA_DATA_PATH"
# DB helpers and strip_template_block are in lib/common.sh # DB helpers and strip_template_block are in lib/common.sh
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Step 1: Create data directories # Step 1: Ensure data directories exist
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
log_step 1 "Creating data directories on Unraid..." log_step 1 "Ensuring data directories on Unraid..."
if ssh_exec UNRAID "test -d '${DATA_PATH}/data'"; then if [[ "${GITEA_DB_TYPE}" != "sqlite3" ]]; then
log_info "Data directory already exists — skipping" ssh_exec UNRAID "mkdir -p '${DATA_PATH}/data' '${DATA_PATH}/config' '${DATA_PATH}/db'"
else else
ssh_exec UNRAID "mkdir -p '${DATA_PATH}/data' '${DATA_PATH}/config'" ssh_exec UNRAID "mkdir -p '${DATA_PATH}/data' '${DATA_PATH}/config'"
# Create DB data directory for external databases
if [[ "${GITEA_DB_TYPE}" != "sqlite3" ]]; then
ssh_exec UNRAID "mkdir -p '${DATA_PATH}/db'"
fi
log_success "Data directories created"
fi fi
log_success "Data directories ensured"
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Step 2: Create macvlan Docker network (idempotent) # Step 2: Create macvlan Docker network (idempotent)
@@ -128,7 +124,7 @@ fi
# Step 5: Start Gitea container # Step 5: Start Gitea container
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
log_step 5 "Starting Gitea container..." log_step 5 "Starting Gitea container..."
CONTAINER_STATUS=$(ssh_exec UNRAID "docker ps --filter name=gitea --format '{{.Status}}'" 2>/dev/null || true) CONTAINER_STATUS=$(ssh_exec UNRAID "docker ps --filter 'name=^/gitea$' --format '{{.Status}}'" 2>/dev/null || true)
if [[ "$CONTAINER_STATUS" == *"Up"* ]]; then if [[ "$CONTAINER_STATUS" == *"Up"* ]]; then
log_info "Gitea container already running — skipping" log_info "Gitea container already running — skipping"
else else