#!/bin/sh
# MacVisor's version on this Mac, for an inventory attribute: a Jamf Pro
# extension attribute (FORMAT=jamf, the default) or an Intune custom attribute
# for macOS (set FORMAT=plain). Prints, for example, 27.2.1, or "Not installed".

FORMAT=jamf

plist=/Applications/MacVisor.app/Contents/Info.plist
version=""
[ -f "$plist" ] && version=$(/usr/bin/defaults read "$plist" CFBundleShortVersionString 2>/dev/null)
[ -n "$version" ] || version="Not installed"

if [ "$FORMAT" = plain ]; then echo "$version"; else echo "<result>$version</result>"; fi
