tools.func: fix mongodb version check, leading "v" never stripped

is_tool_installed parsed `mongod --version` ("db version v8.0.15") into
"v8.0" because the leading v was left in place. It never equals the target
"8.0", so setup_mongodb always took the clean-upgrade path and purged
mongodb-org on every run. On Omada that also drags omadac out as a
reverse-dependency, wiping the controller.

Strip the v like the node and go branches already do, so an unchanged
version compares equal and setup_mongodb just updates in place.
This commit is contained in:
dualfroz committed 2026-08-26 16:26:08 +02:00
1 parent 1660ce4939
commit 9276663146
1 file changed
+1 -1
+1 -1
View File
@@ -632,7 +632,7 @@ is_tool_installed() {
;;
mongodb | mongod)
if command -v mongod >/dev/null 2>&1; then
installed_version=$(mongod --version 2>/dev/null | awk '/db version/{print $3}' | cut -d. -f1,2)
installed_version=$(mongod --version 2>/dev/null | awk '/db version/{print $3}' | sed 's/^v//' | cut -d. -f1,2)
fi
;;
node | nodejs)