Posted on 02-06-2013 01:28 PM
Just spent some time trying to figure this out and thought I would add it to the general KB for y'all. If you are using the Bradford Persistent Agent and noticed that their packaging doesn't always match their actual version, here's the script to the get the actual version number, directly from the Menu Bar Item of the app.
#!/bin/sh
# By Chris Tangora
# Reads the Bradford Persistent Agent's menubar item's file to find the proper version number.
if [[ -e /Library/Application Support/Bradford Networks/Persistent Agent/CSA.app/Contents/Resources/bncsaui.xrs ]]; then
BPAv=$( zipgrep Version /Library/Application Support/Bradford Networks/Persistent Agent/CSA.app/Contents/Resources/bncsaui.xrs | sed -e 's|.*Version: ||' -e 's|<br.*||' )
echo "<result>$BPAv</result>"
else
echo "<result>Not Installed</result>"
fi
exit 0
Hope this can help someone else as well.
Posted on 02-07-2013 04:42 AM
@ctangora - thanks for the extension attribute !
Posted on 02-07-2013 05:03 AM
Glad to hear others are using this too... Thanks ctangora.
Posted on 11-12-2014 09:25 AM
Much obliged to you kind sir!!!
Many compliments on your profile pic of Allan from "The Hangover". That, is, rockin' and I owe you a Beer at the next Jamf National Conference!
Posted on 10-01-2015 11:26 AM
We're moving onto a newer version which has changed code in the Bradford Agent. I've updated the Ext Attribute. See Below...
if [[ -e "/Library/Application Support/Bradford Networks/Persistent Agent/CSA.app/Contents/Info.plist" ]]; then BPAv=$(/usr/bin/defaults read "/Library/Application Support/Bradford Networks/Persistent Agent/CSA.app/Contents/Info.plist" | grep CFBundleGetInfoString | awk {'print $3'} | sed -e 's/[";]//g')
elif [[ -e "/Library/Application Support/Bradford Networks/Persistent Agent/CSA.app/Contents/Resources/bncsaui.xrs" ]]; then BPAv=$( zipgrep Version /Library/Application Support/Bradford Networks/Persistent Agent/CSA.app/Contents/Resources/bncsaui.xrs | sed -e 's|.Version: ||' -e 's|<br.||' )
else
BPAv="Not Installed"
fi
echo "<result>$BPAv</result>"
exit 0