I'm trying to loop through policy check-ins at first boot so that all software that needs to be installed is run. In plain words, until no more policies are found, continue to run the jamf binary to do a policy check-in. The reason for this is because there may be certain policies that require a computer fall into a certain smart group (maybe its a plug-in that requires an app be installed first) before it can run the policy. But I'm not sure if this is the best way to do it since the loop statement actually needs to run the jamf binary in a subshell to determine whether no policies are found.
I'm trying to run the following at first boot:
jamfPolicyDone="No policies were found for the "recurring check-in" trigger."
#Prevent computer from sleeping
/usr/bin/caffeinate &
#Run jamf binary to check for scoped policies for computer
#Let it loop until no policies are left
until [ "$( /usr/sbin/jamf policy -verbose | grep "$jamfPolicyDone" )" = "$jamfPolicyDone" ]; do
/usr/sbin/jamf policy -verbose
sleep 5
done
#Kill caffeinate process
killall caffeinate
Anyone have any advice?