I'm rolling out OneLogin Desktop in a couple of weeks and to successfully deploy to any pre-10.14.4 machine I need to push out Swift Runtime for CLT. I did this yesterday, but I would love to see if the policy failed on any machines. Not sure how to make a Smart Group for this since Swift for CLT isn't an "app," per se. Any suggestions?
Something that comes to mind is using
pkgutil --pkgs to see if you can find the Swift Runtime for CLT package receipt. If you can, then add a pipe to the command and grep the receipt name out. An EA would look something like
#!/bin/bash swiftReceipt=$(pkgutil --pkgs | grep com.apple.pkg.something) if [ "$swiftReceipt" = "receiptname" ]; then echo "<result>Swift CLT Installed</result>" else echo "<result>Swift CLT Not Installed</result>" fi
I got a "Not Installed" response on a machine that I know it was installed on, so I think I might have the receipt name wrong. Will keep digging, but assuming this will work once I get the names right.
Alright, I'm not sure what the Bundle ID is but I did create an Extension Attribute using that same script:
#!/bin/bash swiftReceipt=$(pkgutil --info com.apple.pkg.SwiftRuntimeForCommandLineTools) if [ "$swiftReceipt" = "No receipt for 'com.apple.pkg.SwiftRuntimeForCommandLineTools' found at '/'." ]; then echo "<result>Swift Runtime For CLT Not Installed</result>" else echo "<result> Swift Runtime For CLT Installed</result>" fi
...and scoping it to computers running only older than a 10.14.4 macOS. I'm seeing some results filter into the INSTALLED Smart Group, but not the NOT INSTALLED Smart Group. Will give it some time and update.
No luck. I checked my work against some of the laptops in the INSTALLED group by running:
pkgutil --info com.apple.pkg.SwiftRuntimeForCommandLineTools
...silently in the background. While I assumed I had a successful install earlier, it clearly did not install. Don't know how I got my Extension Attribute / Smart Group wrong.
Ok, so my final stab at this is it base a Smart Group of the exit code of an EA script.
#!/bin/bash exit=?(pkgutil --info com.apple.pkg.SwiftRuntimeForCommandLineTools) if [ $exit -eq 0 ] then echo "Success" else echo "Failure" > fi
I'm not terribly familiar with bash, and this is clearly not working. Any suggestions?