Skip to content

Commit 2ae6205

Browse files
committed
Improve MongoDB repo setup for unknown Debian releases
Fallback to 'bookworm' for unknown Debian releases and update repository verification to check the correct nested path for MongoDB. Also adjust the sources.list format to match the new repository structure.
1 parent e6bd1b5 commit 2ae6205

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

misc/tools.func

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,19 +2399,17 @@ function setup_mongodb() {
23992399
SUITE="buster"
24002400
;;
24012401
*)
2402-
# Fallback: try the codename itself
2403-
SUITE="$DISTRO_CODENAME"
2402+
# Fallback: try bookworm for unknown releases
2403+
msg_warn "Unknown Debian release '${DISTRO_CODENAME}', using bookworm"
2404+
SUITE="bookworm"
24042405
;;
24052406
esac
24062407

2407-
# Verify the repository is available
2408-
if ! verify_repo_available "$MONGO_BASE_URL" "$SUITE"; then
2409-
msg_warn "MongoDB repo not available for ${DISTRO_ID}-${SUITE}, trying bookworm fallback"
2410-
SUITE="bookworm"
2411-
if ! verify_repo_available "$MONGO_BASE_URL" "$SUITE"; then
2412-
msg_error "MongoDB repository not available for ${DISTRO_ID}-${DISTRO_CODENAME} (tried ${DISTRO_CODENAME} and bookworm)"
2413-
return 1
2414-
fi
2408+
# Verify MongoDB repository is available (MongoDB has nested structure)
2409+
if ! curl -fsSL --max-time 10 "${MONGO_BASE_URL}/dists/${SUITE}/mongodb-org/${MONGO_VERSION}/Release" &>/dev/null; then
2410+
msg_error "MongoDB ${MONGO_VERSION} repository not available for ${DISTRO_ID}-${SUITE}"
2411+
msg_error "Please check: ${MONGO_BASE_URL}/dists/${SUITE}/mongodb-org/${MONGO_VERSION}/"
2412+
return 1
24152413
fi
24162414

24172415
mkdir -p /etc/apt/keyrings
@@ -2424,8 +2422,8 @@ function setup_mongodb() {
24242422
cat <<EOF >/etc/apt/sources.list.d/mongodb-org-${MONGO_VERSION}.sources
24252423
Types: deb
24262424
URIs: ${MONGO_BASE_URL}
2427-
Suites: ${SUITE}/mongodb-org/${MONGO_VERSION}
2428-
Components: main
2425+
Suites: ${SUITE}
2426+
Components: mongodb-org/${MONGO_VERSION}
24292427
Architectures: amd64 arm64
24302428
Signed-By: /etc/apt/keyrings/mongodb-${MONGO_VERSION}.gpg
24312429
EOF

0 commit comments

Comments
 (0)