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.
This commit is contained in:
parent
560e1fdad3
commit
4672934701
@ -2382,19 +2382,36 @@ function setup_mongodb() {
|
|||||||
cleanup_old_repo_files "mongodb-org-${MONGO_VERSION}"
|
cleanup_old_repo_files "mongodb-org-${MONGO_VERSION}"
|
||||||
cleanup_orphaned_sources
|
cleanup_orphaned_sources
|
||||||
|
|
||||||
|
# Map Debian codenames to MongoDB-supported suites
|
||||||
local SUITE
|
local SUITE
|
||||||
case "$DISTRO_CODENAME" in
|
case "$DISTRO_CODENAME" in
|
||||||
trixie | forky | sid)
|
trixie | forky | sid)
|
||||||
|
# Debian 13+ and testing/unstable use Bookworm (MongoDB doesn't support newer)
|
||||||
SUITE="bookworm"
|
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
|
esac
|
||||||
|
|
||||||
|
# Verify the repository is available
|
||||||
if ! verify_repo_available "$MONGO_BASE_URL" "$SUITE"; then
|
if ! verify_repo_available "$MONGO_BASE_URL" "$SUITE"; then
|
||||||
msg_error "MongoDB repository not available for ${DISTRO_ID}-${SUITE}"
|
msg_warn "MongoDB repo not available for ${DISTRO_ID}-${SUITE}, trying bookworm fallback"
|
||||||
return 1
|
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
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/apt/keyrings
|
mkdir -p /etc/apt/keyrings
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user