Expand MongoDB setup to support Ubuntu and update repo handling
Extended the MongoDB setup function to handle both Debian and Ubuntu distributions, mapping their codenames to supported MongoDB suites. Updated the GPG key URL and output path, and adjusted the repository source file structure to match MongoDB's nested layout.
This commit is contained in:
parent
2ae62055a6
commit
c7fffd85d3
@ -2382,28 +2382,51 @@ 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
|
# Map distro codenames to MongoDB-supported suites
|
||||||
local SUITE
|
local SUITE
|
||||||
case "$DISTRO_CODENAME" in
|
if [[ "$DISTRO_ID" == "debian" ]]; then
|
||||||
trixie | forky | sid)
|
case "$DISTRO_CODENAME" in
|
||||||
# Debian 13+ and testing/unstable use Bookworm (MongoDB doesn't support newer)
|
trixie | forky | sid)
|
||||||
SUITE="bookworm"
|
# Debian 13+ and testing/unstable use Bookworm (MongoDB doesn't support newer)
|
||||||
;;
|
SUITE="bookworm"
|
||||||
bookworm)
|
;;
|
||||||
SUITE="bookworm"
|
bookworm)
|
||||||
;;
|
SUITE="bookworm"
|
||||||
bullseye)
|
;;
|
||||||
SUITE="bullseye"
|
bullseye)
|
||||||
;;
|
SUITE="bullseye"
|
||||||
buster)
|
;;
|
||||||
SUITE="buster"
|
buster)
|
||||||
;;
|
SUITE="buster"
|
||||||
*)
|
;;
|
||||||
# Fallback: try bookworm for unknown releases
|
*)
|
||||||
msg_warn "Unknown Debian release '${DISTRO_CODENAME}', using bookworm"
|
# Fallback: try bookworm for unknown Debian releases
|
||||||
SUITE="bookworm"
|
msg_warn "Unknown Debian release '${DISTRO_CODENAME}', using bookworm"
|
||||||
;;
|
SUITE="bookworm"
|
||||||
esac
|
;;
|
||||||
|
esac
|
||||||
|
elif [[ "$DISTRO_ID" == "ubuntu" ]]; then
|
||||||
|
case "$DISTRO_CODENAME" in
|
||||||
|
oracular | plucky)
|
||||||
|
# Ubuntu 24.10+ uses noble
|
||||||
|
SUITE="noble"
|
||||||
|
;;
|
||||||
|
noble)
|
||||||
|
SUITE="noble"
|
||||||
|
;;
|
||||||
|
jammy)
|
||||||
|
SUITE="jammy"
|
||||||
|
;;
|
||||||
|
focal)
|
||||||
|
SUITE="focal"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Fallback: try noble for unknown Ubuntu releases
|
||||||
|
msg_warn "Unknown Ubuntu release '${DISTRO_CODENAME}', using noble"
|
||||||
|
SUITE="noble"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify MongoDB repository is available (MongoDB has nested structure)
|
# Verify MongoDB repository is available (MongoDB has nested structure)
|
||||||
if ! curl -fsSL --max-time 10 "${MONGO_BASE_URL}/dists/${SUITE}/mongodb-org/${MONGO_VERSION}/Release" &>/dev/null; then
|
if ! curl -fsSL --max-time 10 "${MONGO_BASE_URL}/dists/${SUITE}/mongodb-org/${MONGO_VERSION}/Release" &>/dev/null; then
|
||||||
@ -2413,8 +2436,8 @@ function setup_mongodb() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/apt/keyrings
|
mkdir -p /etc/apt/keyrings
|
||||||
if ! curl -fsSL "https://pgp.mongodb.com/server-${MONGO_VERSION}.asc" |
|
if ! curl -fsSL "https://www.mongodb.org/static/pgp/server-${MONGO_VERSION}.asc" |
|
||||||
gpg --dearmor --yes -o "/etc/apt/keyrings/mongodb-${MONGO_VERSION}.gpg"; then
|
gpg --dearmor --yes -o "/etc/apt/keyrings/mongodb-server-${MONGO_VERSION}.gpg"; then
|
||||||
msg_error "Failed to download or import MongoDB GPG key"
|
msg_error "Failed to download or import MongoDB GPG key"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -2422,10 +2445,10 @@ function setup_mongodb() {
|
|||||||
cat <<EOF >/etc/apt/sources.list.d/mongodb-org-${MONGO_VERSION}.sources
|
cat <<EOF >/etc/apt/sources.list.d/mongodb-org-${MONGO_VERSION}.sources
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: ${MONGO_BASE_URL}
|
URIs: ${MONGO_BASE_URL}
|
||||||
Suites: ${SUITE}
|
Suites: ${SUITE}/mongodb-org/${MONGO_VERSION}
|
||||||
Components: mongodb-org/${MONGO_VERSION}
|
Components: ${REPO_COMPONENT}
|
||||||
Architectures: amd64 arm64
|
Architectures: amd64 arm64
|
||||||
Signed-By: /etc/apt/keyrings/mongodb-${MONGO_VERSION}.gpg
|
Signed-By: /etc/apt/keyrings/mongodb-server-${MONGO_VERSION}.gpg
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
$STD apt update || {
|
$STD apt update || {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user