fix(databasus): use get_os_info/get_system_arch, curl, pin mongo version

- Use get_os_info id for OS detection instead of manual arch if/elif
- Use get_system_arch uname for architecture
- Replace wget -q with curl -fsSL
- Pin mongodb-database-tools to 100.14.1 (no GitHub releases available,
  mongo-tools repo only has r4.x tags)
- Remove broken GitHub API version lookup
This commit is contained in:
CanbiZ (MickLesk)
2026-02-24 09:20:05 +01:00
parent e6dd3c1457
commit 9e4dcff12c
2 changed files with 14 additions and 13 deletions
+2 -3
View File
@@ -42,10 +42,9 @@ function update_script() {
ensure_dependencies mariadb-client
if ! command -v mongodump &>/dev/null; then
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")
[[ "$(get_os_info id)" == "ubuntu" ]] && MONGO_DIST="ubuntu2204" || MONGO_DIST="debian12"
tmp_file=$(mktemp)
wget -q "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-${MONGO_VERSION}.deb" -O "$tmp_file"
curl -fsSL -o "$tmp_file" "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-100.14.1.deb"
$STD dpkg -i "$tmp_file" || $STD apt-get install -f -y --no-install-recommends
rm -f "$tmp_file"
fi