Posted on 03-27-2017 09:38 AM
So this is a foolish question, and you may go "HUH?" when you read it, but has anyone tried to do a Composer capture of a VPP installed app? Without going into too many details, I'm looking to create a base, thick image, but package Xcode into it. With VPP, which we currently use, it's super simple. But the download and install of the SDK/Docs etc take forever, admin prompts if you're not watching, etc, we all know what happens.
I'm mid-test on this, and wonder if I'm wasting my time, but figured I'd ask anyway. Has anyone tried to capture the VPP install and add that to something like AutoDMG as an install .pkg to create a clonable, never booted image with Xcode and all it's add-ons baked in? I want it to get patched going forward via the App Store (dev-must have for timely patching they say) so I don't think the _MASReceipt trick would work like other Xcode captures.
Thanks in advance.
Posted on 03-27-2017 01:33 PM
I recently switched to VPP for Xcode in our labs. The most annoying part with that is it requires a MDM capable user to login to kick off the install, which in our environment is AD users. So it can take a while to get the install on every computer since I can't guarantee a student will sit at every computer in the period I'm hoping to push it out.
I then scope the computers with the current version to run the following script (I found the script somewhere here in JAMF and can't take credit for it at all, but I believe I added the little bit to the end to enable DevTools).
It was a recent switch, so I still have to play with what happens with today's release of 8.3.
Any suggestions of how others are doing it is greatly appreciated!
#!/bin/bash
# Accept EULA so there is no prompt
if [[ -e "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]]; then
/Applications/Xcode.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.app/Contents/Resources/LicenseInfo.plist" ]]; then
xcode_version_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/"Info CFBundleShortVersionString`
xcode_build_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseID`
xcode_license_type=`/usr/bin/defaults read "/Applications/Xcode.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
# Installing the Xcode command line tools on 10.7.x or higher
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
# Accept EULA so there is no prompt
if [[ -e "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]]; then
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -license accept
fi
# Install Mobile Device Package so there is no prompt
if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" ]]; then
/usr/sbin/installer -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" -target /
fi
if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" ]]; then
/usr/sbin/installer -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" -target /
fi
# Install Xcode System Resources Package, available in Xcode 8 and later
if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" ]]; then
/usr/sbin/installer -pkg "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" -target /
fi
# Installing the latest Xcode command line tools on 10.9.x or higher
if [[ "$osx_vers" -ge 9 ]]; then
# Create the placeholder file which is checked by the softwareupdate tool
# before allowing the installation of the Xcode command line tools.
touch "$cmd_line_tools_temp_file"
# Identify the correct update in the Software Update feed with "Command Line Tools" in the name for the OS version in question.
if [[ "$osx_vers" -gt 9 ]]; then
cmd_line_tools=$(softwareupdate -l | awk '/* Command Line Tools/ { $1=$1;print }' | grep "$osx_vers" | sed 's/^[[ ]]*//;s/[[ ]]*$//;s/*//' | cut -c 2-)
elif [[ "$osx_vers" -eq 9 ]]; then
cmd_line_tools=$(softwareupdate -l | awk '/* Command Line Tools/ { $1=$1;print }' | grep "Mavericks" | sed 's/^[[ ]]*//;s/[[ ]]*$//;s/*//' | cut -c 2-)
fi
#Install the command line tools
softwareupdate -i "$cmd_line_tools" --verbose
# Remove the temp file
if [[ -f "$cmd_line_tools_temp_file" ]]; then
rm "$cmd_line_tools_temp_file"
fi
fi
# Installing the latest Xcode command line tools on 10.7.x and 10.8.x
# on 10.7/10.8, instead of using the software update feed, the command line tools are downloaded
# instead from public download URLs, which can be found in the dvtdownloadableindex:
# https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/index-3905972D-B609-49CE-8D06-51ADC78E07BC.dvtdownloadableindex
if [[ "$osx_vers" -eq 7 ]] || [[ "$osx_vers" -eq 8 ]]; then
if [[ "$osx_vers" -eq 7 ]]; then
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg
fi
if [[ "$osx_vers" -eq 8 ]]; then
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_osx_mountain_lion_april_2014.dmg
fi
TOOLS=cltools.dmg
curl "$DMGURL" -o "$TOOLS"
TMPMOUNT=`/usr/bin/mktemp -d /tmp/clitools.XXXX`
hdiutil attach "$TOOLS" -mountpoint "$TMPMOUNT" -nobrowse
# The "-allowUntrusted" flag has been added to the installer
# command to accomodate for now-expired certificates used
# to sign the downloaded command line tools.
installer -allowUntrusted -pkg "$(find $TMPMOUNT -name '*.mpkg')" -target /
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm "$TOOLS"
fi
sleep 5
/usr/sbin/DevToolsSecurity -enable
/usr/sbin/dseditgroup -o edit -a everyone -t group _developer
exit 0 ## Success
exit 1 ## Failure