From e6dd3c1457eca5fab81a7b96a5ed18a0a25f6705 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 24 Feb 2026 09:16:00 +0100 Subject: [PATCH] fix(databasus): use get_system_arch and dynamic MongoDB version - Replace manual dpkg arch detection with get_system_arch helper - Fetch latest mongodb-database-tools version from GitHub API instead of hardcoding 100.10.0 - Fallback to 100.10.0 if API call fails --- ct/databasus.sh | 13 ++++--------- install/databasus-install.sh | 14 ++++---------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/ct/databasus.sh b/ct/databasus.sh index 3f393b592..90b229fcb 100644 --- a/ct/databasus.sh +++ b/ct/databasus.sh @@ -41,16 +41,11 @@ function update_script() { msg_info "Ensuring Database Clients" ensure_dependencies mariadb-client if ! command -v mongodump &>/dev/null; then - DEBIAN_ARCH=$(dpkg --print-architecture) - if [[ "$DEBIAN_ARCH" == "amd64" ]]; then - MONGO_ARCH="x86_64" - MONGO_DIST="debian12" - elif [[ "$DEBIAN_ARCH" == "arm64" ]]; then - MONGO_ARCH="arm64" - MONGO_DIST="ubuntu2204" - fi + MONGO_ARCH=$(get_system_arch uname) + MONGO_DIST=$([[ "$(get_system_arch)" == "amd64" ]] && echo "debian12" || echo "ubuntu2204") + MONGO_VERSION=$(curl -fsSL https://api.github.com/repos/mongodb/mongo-tools/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' || echo "100.10.0") tmp_file=$(mktemp) - wget -q "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-100.10.0.deb" -O "$tmp_file" + wget -q "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-${MONGO_VERSION}.deb" -O "$tmp_file" $STD dpkg -i "$tmp_file" || $STD apt-get install -f -y --no-install-recommends rm -f "$tmp_file" fi diff --git a/install/databasus-install.sh b/install/databasus-install.sh index b1ef85a8c..ab92e2820 100644 --- a/install/databasus-install.sh +++ b/install/databasus-install.sh @@ -25,17 +25,11 @@ setup_go NODE_VERSION="24" setup_nodejs msg_info "Installing Database Clients" -$STD apt install -y -DEBIAN_ARCH=$(dpkg --print-architecture) -if [[ "$DEBIAN_ARCH" == "amd64" ]]; then - MONGO_ARCH="x86_64" - MONGO_DIST="debian12" -elif [[ "$DEBIAN_ARCH" == "arm64" ]]; then - MONGO_ARCH="arm64" - MONGO_DIST="ubuntu2204" -fi +MONGO_ARCH=$(get_system_arch uname) +MONGO_DIST=$([[ "$(get_system_arch)" == "amd64" ]] && echo "debian12" || echo "ubuntu2204") +MONGO_VERSION=$(curl -fsSL https://api.github.com/repos/mongodb/mongo-tools/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' || echo "100.10.0") tmp_file=$(mktemp) -wget -q "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-100.10.0.deb" -O "$tmp_file" +wget -q "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-${MONGO_VERSION}.deb" -O "$tmp_file" $STD dpkg -i "$tmp_file" || $STD apt-get install -f -y --no-install-recommends rm -f "$tmp_file" mkdir -p /usr/local/mariadb-{10.6,12.1}/bin /usr/local/mysql-{5.7,8.0,8.4,9}/bin /usr/local/mongodb-database-tools/bin