37 lines
2.0 KiB
Bash
Executable File
37 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Andreas Vogel, macenterprise GmbH, 22.10.2018
|
|
# Quelle: https://github.com/rtrouton/rtrouton_scripts/blob/master/rtrouton_scripts/xcode_post_install_actions/xcode_post_install_actions.sh
|
|
|
|
# Accept EULA so there is no prompt
|
|
|
|
if [[ -e "/Applications/Xcode_9.4.app/Contents/Developer/usr/bin/xcodebuild" ]]; then
|
|
"/Applications/Xcode_9.4.app/Contents/Developer/usr/bin/xcodebuild" -license accept
|
|
fi
|
|
|
|
# Just in case the xcodebuild command above fails to accept the EULA, set the license acceptance info
|
|
# in /Library/Preferences/com.apple.dt.Xcode.plist. For more details on this, see Tim Sutton's post:
|
|
# http://macops.ca/deploying-xcode-the-trick-with-accepting-license-agreements/
|
|
|
|
if [[ -e "/Applications/Xcode_9.4.app/Contents/Resources/LicenseInfo.plist" ]]; then
|
|
|
|
xcode_version_number=`/usr/bin/defaults read "/Applications/Xcode_9.4.app/Contents/"Info CFBundleShortVersionString`
|
|
xcode_build_number=`/usr/bin/defaults read "/Applications/Xcode_9.4.app/Contents/Resources/"LicenseInfo licenseID`
|
|
xcode_license_type=`/usr/bin/defaults read "/Applications/Xcode_9.4.app/Contents/Resources/"LicenseInfo licenseType`
|
|
|
|
if [[ "${xcode_license_type}" == "GM" ]]; then
|
|
/usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense "$xcode_version_number"
|
|
/usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastGMLicenseAgreedTo "$xcode_build_number"
|
|
else
|
|
/usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToBetaLicense "$xcode_version_number"
|
|
/usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastBetaLicenseAgreedTo "$xcode_build_number"
|
|
fi
|
|
|
|
fi
|
|
|
|
# alter authorisation database to allow installation of apple components without admin rights
|
|
security authorizationdb read system.install.apple-software > /tmp/xcode.plist
|
|
defaults write /tmp/xcode.plist rule -array authenticate-session-owner-or-admin
|
|
security authorizationdb write system.install.apple-software < /tmp/xcode.plist
|
|
|
|
exit 0
|