Posted on 10-12-2015 04:56 PM
At initial launch, AC 1.7.4 launches a dialog box requesting the user to accept a license agreement. After acceptance, the dialog box is never seen again. I am trying to script the installation of this application and I have not yet figured out how to suppress this dialog box. I have used both fseventer and Composer to try to isolate the file and I have performed a "defaults read ~/Library/Containers/com.apple.configurator/Data/Library/Preferences/com.apple.configurator.plist" but I am not finding any clues.
I would appreciate any guidance or clues. Thanks!
03-08-2023 12:56 PM - edited 03-15-2023 01:29 PM
You can try running the following command from a policy to write directly to the plist:
#!/bin/zsh
# Created by Vasean Everett
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Suppress "Agree to license" window for Apple Configurator 2
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Define Variables
# Get the current logged in user
loggedInUser=$(ls -l /dev/console | cut -d " " -f 4)
# Get the ID of the current logged in user
uid=$(id -u "$loggedInUser")
application=$(ls /Applications | grep "Apple Configurator")
licenseVersion=$(defaults read /Applications/"$application"/Contents/Info.plist ACULicenseVersion)
plist="/Users/$loggedInUser/Library/Containers/com.apple.configurator.ui/Data/Library/Preferences/com.apple.configurator.ui.plist"
domain="LastAcceptedConfiguratorLicenseVersion"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Define functions
# Run a command as the current logged in user
runAsUser() {
if [ "$loggedInUser" != "loginwindow" ]; then
launchctl asuser "$uid" sudo -u "$loggedInUser" "$@"
else
echo "no user logged in"
fi
}
# Check exit code of last command
checkResult() {
if [[ $? -eq 0 ]]
then
printf "Agreement suppressed\n"
else
printf "An error occurred\n"
fi
}
# Write to Configurator plist
agreeToLicense() {
printf "Suppressing license agreement…\n"
runAsUser defaults write "${plist}" "${domain}" "${licenseVersion}"
checkResult
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# main
agreeToLicense
exit 0