[SOLVED] How to detect which MQTT version is installed from a shell script?

For the project HestiaPi we have an update script that pulls the newer (sitemap, items, things, rules) files from Github.
To avoid breaking anybody’s installation who hasn’t moved to MQTT 2.4 yet we need a way to tell if the existing installation has moved to 2.4 or not. Co-existence of new and old binding will not be allowed but detecting it too is a plus.
The script runs locally from within the OpenHAB installation area and we have used the default installation method for Pi.
I am not worried about the scripting part but about what to check (path, file is exists or a value from within a conf file).
Thank you!

Use the REST interface:

curl -X GET --header "Accept: application/json" ""

If it returns with a 200, mqtt is installed, if it’s a 404, then not.

David beat me to a better answer. I was going to recommend using the Karaf console.

ssh -p 8101 -t openhab@localhost bundle:list | grep -i "Active.*oh2.*mqtt binding"

If it returns something then the 2 binding is installed. If not then it’s not.

You might want to configure ssh cert login for the karaf console first so you don’t have to pass in the password.

Thank you all! Yes REST to the rescue!
Just to help whoever tries to copy the above command, in the default installation where port 8080 is used this will work and return 404 or {}200:

curl -sw '%{http_code}' -X GET --header "Accept: application/json" "http://localhost:8080/rest/bindings/mqtt/config"