databasus: make fetch_and_deploy_from_url accept empty dir

Pass an explicit empty second argument when downloading MongoDB tools and update fetch_and_deploy_from_url to default the directory parameter to an empty string. This avoids unset/ambiguous directory handling at the call site and ensures the function has a defined directory variable even when none is provided.
This commit is contained in:
CanbiZ (MickLesk)
2026-03-06 14:11:57 +01:00
parent 176fffff0b
commit eb848fd70f
2 changed files with 2 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ done
# Install MongoDB Database Tools via direct .deb (no APT repo for Debian 13)
[[ "$(get_os_info id)" == "ubuntu" ]] && MONGO_DIST="ubuntu2204" || MONGO_DIST="debian12"
MONGO_VERSION=$(get_latest_gh_tag "mongodb/mongo-tools" "100." || echo "100.14.1")
fetch_and_deploy_from_url "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-x86_64-${MONGO_VERSION}.deb"
fetch_and_deploy_from_url "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-x86_64-${MONGO_VERSION}.deb" ""
mkdir -p /usr/local/mongodb-database-tools/bin
[[ -f /usr/bin/mongodump ]] && ln -sf /usr/bin/mongodump /usr/local/mongodb-database-tools/bin/mongodump
[[ -f /usr/bin/mongorestore ]] && ln -sf /usr/bin/mongorestore /usr/local/mongodb-database-tools/bin/mongorestore

View File

@@ -7999,7 +7999,7 @@ EOF
# ------------------------------------------------------------------------------
function fetch_and_deploy_from_url() {
local url="$1"
local directory="$2"
local directory="${2:-}"
if [[ -z "$url" ]]; then
msg_error "URL parameter is required"