From 46729347014e33ca6ff9ef8b4b5592e6bf71f699 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 22 Oct 2025 16:47:22 +0200 Subject: [PATCH] Improve MongoDB repo suite selection for Debian Enhances the setup_mongodb function to explicitly map Debian codenames to MongoDB-supported suites and adds a fallback to 'bookworm' if the repository is unavailable for the detected suite. This improves compatibility with newer Debian releases and provides clearer error handling. --- misc/tools.func | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/misc/tools.func b/misc/tools.func index 3d0357134..1562d0768 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -2382,19 +2382,36 @@ function setup_mongodb() { cleanup_old_repo_files "mongodb-org-${MONGO_VERSION}" cleanup_orphaned_sources + # Map Debian codenames to MongoDB-supported suites local SUITE case "$DISTRO_CODENAME" in trixie | forky | sid) + # Debian 13+ and testing/unstable use Bookworm (MongoDB doesn't support newer) SUITE="bookworm" ;; + bookworm) + SUITE="bookworm" + ;; + bullseye) + SUITE="bullseye" + ;; + buster) + SUITE="buster" + ;; *) - SUITE=$(get_fallback_suite "$DISTRO_ID" "$DISTRO_CODENAME" "$MONGO_BASE_URL") + # Fallback: try the codename itself + SUITE="$DISTRO_CODENAME" ;; esac + # Verify the repository is available if ! verify_repo_available "$MONGO_BASE_URL" "$SUITE"; then - msg_error "MongoDB repository not available for ${DISTRO_ID}-${SUITE}" - return 1 + msg_warn "MongoDB repo not available for ${DISTRO_ID}-${SUITE}, trying bookworm fallback" + SUITE="bookworm" + if ! verify_repo_available "$MONGO_BASE_URL" "$SUITE"; then + msg_error "MongoDB repository not available for ${DISTRO_ID}-${DISTRO_CODENAME} (tried ${DISTRO_CODENAME} and bookworm)" + return 1 + fi fi mkdir -p /etc/apt/keyrings