Posted on 11-16-2021 07:38 AM
I'm working on building a Title Editor entry for the Barco MirrorOp app. On its site, Barco lists the latest version as 2.5.4.90. Unfortunately, the app's Get Info window (and Jamf app inventory) only shows the main version (2.5.4). I found in the app's Info.plist file that the version is split between two strings, "CFBundleShortVersionString" (2.5.4) and "CFBundleVersion" (89, 90, etc.). I've gotten the below script cobbled together so far (from another question I found here), but could use a little help figuring out how to merge the two strings together so the full version number gets reported.
#!/bin/sh
PrefPanePath="/Library/PreferencePanes/Retrospect Client.prefPane"
if [ -e "$PrefPanePath" ]; then
result=$(defaults read "${PrefPanePath}/Contents/Info.plist" CFBundleVersion)
else
result="Not Installed"
fi
echo "<result>$result</result>"
Posted on 11-16-2021 08:21 AM
You should be able to get what you want by using something like this:
#!/bin/sh
PrefPanePath="/Library/PreferencePanes/Retrospect Client.prefPane"
if [ -d "$PrefPanePath" ]; then
prefix=$(defaults read "${PrefPanePath}/Contents/Info.plist" CFBundleShortVersionString)
suffix=$(defaults read "${PrefPanePath}/Contents/Info.plist" CFBundleVersion)
echo "<result>$prefix.$suffix</result>"
else
echo "<result>Not Installed</result>"
fi
Posted on 11-16-2021 09:00 AM
Thank you! Here's the final script that I've confirmed works -- there was a copy/paste error in my original post, so this one actually targets the correct application 😅
#!/bin/sh
AppPath="/Applications/MirrorOp.app"
if [ -d "$AppPath" ]; then
prefix=$(defaults read "${AppPath}/Contents/Info.plist" CFBundleShortVersionString)
suffix=$(defaults read "${AppPath}/Contents/Info.plist" CFBundleVersion)
echo "<result>$prefix.$suffix</result>"
else
echo "<result>Not Installed</result>"
fi