System Image Utility Failing Error 2 Yosemite
I'm trying to create an net install image of the OS X Yosemite installer. It worked with 10.0, now on 10.0.1 I'm getting an error "System Image Utility Failing Error 2". I've tried it a few different ways but I get the same result every time. Has anyone been able to create a 10.0.1 image?
After doing all that I described in my previous post three things happened:
1. I need to proof read better mi writing (I am fluent in english but of course is not my native language).
2. The NetInstall image I created did work!, but it failed at 99.99% verifying leaving a useless installation. I was able to bring back some computers by reinstalling only the system, but most of them had to be erased and reimaged again.
And number 3:
I found another solution that worked fine this time. !!!
(well, it had a hiccup but not a show stopper)
What is needed:
- A known working NetInstall image.
Steps:
1. Copy the NetInstall.nbi folder to another location.
2. Using Disk Utility convert the image file NetInstall.dmg (inside the NetInstall.nbi) to a read/write image, preferably to a sparse image.
3. Mount the new image and locate the folder 'Packages' inside it (it is invisible in the Finder).
4. Remove System.dmg
5. Copy your source image on the same place and make sure it is named System.dmg and is of type read-only / compressed. (If the new image is bigger than the one before, it will be useful that the NetInstall.dmg be a sparse image.)
6. If the source image was not previously scanned for ASR, do it now.
7. Unmount the NetInstall disk
8. Using Disk Utility convert your new NetInstall.dmg to read-only / compressed.
9. Rename your NetInstall.nbi to YourNewNetInstall.nbi
10. Edit the file NBImageInfo.plist (inside the YourNewNetInstall.nbi) and locate the line with the old name of the .nbi and change it to the new one. Locate the "Index" and change it too (maybe simply add 1.) Also, change the line that mentions the System version and change it to the one that the new NetInstall contains (up to only the first decimal.)
11. Move back YourNewNetInstall.nbi to the NetBootSP0 folder where it came from.
12. In Server activate your new NetInstall source (you can change the index there too) and update the computers list it will be served to.
Ready!
Using this I could reinstall the computers without a problem this time.
Ok, I said there were a hiccup:
After finishing, the computers restarted to their recovery partition and a simple restart brought them back to it. Using Disk Utility and verifying the disk was enough to restart them properly.
Hope this helps.
Greetings from Mexico!
Alex Ramos
Similar Messages
-
System Image Utility Failing Error 2
I've built my 10.9.4 gold image on a Macbook Pro, created the image with SIU and deployed successfully to the other Macbooks. When I went to deploy to the iMacs we have I get the error OSX Could not be installed on your computer. Did some research and found I needed to install the Combo update if I wanted to deploy to multiple hardware, so installed OSXUpdCombo10.9.4 into the gold machine. Now I can no longer import that with System Image Utility.
System Image log looks like:
"/Library/NetBoot/NetBootSP0/IMG-OXL-1094-All.nbi/System.dmg"
created: /Library/NetBoot/NetBootSP0/IMG-OXL-1094-All.nbi/NetInstall.dmg
ditto: can't get real path for source '/tmp/mnt_bs.aLkzKL2z/System/Library/CoreServices/PlatformSupport.plist'
Execution of 'createRestoreFromSources.sh' failed. Cleaning up.
"disk5" unmounted.
"disk5" ejected.
Failed to create image from restore source.
The operation couldn’t be completed. (System Image Utility error 2.)
Looks like this can happen if the version of Mavericks on the server and client don't match. So I've installed the combo updater on the server for good measure. Still getting the same error.
Server reports it is running 10.9.4 (13E28),client says the same.
Any idea where to look next?Went back through my notes, I read that you should run the 10.6 combo updater before trying to image, and somehow decided that meant 10.9 :/
Thanks for the info, that makes sense. I've had to make separate images for each model this round, but I'll add that info to my notes and do it right next time
Jase -
System image utility fails "Unknown error has occurred"
Hi,
I can create disk images from 10.8.3 clients but when i'm putting them through system utility on the 10.8 server it fails after hours of running.
The log is set to debug and shows the image creates upto 83% then jumps to 100% and later shows unknown errors and failed to create image from restore souce.
I've created several disk images and saved them to different locations on the server as the source and final image.
Below i've put in the debug log. Someone please help!!
Workflow Started (2012-01-02 13:56:58 +0000)
OS X Server 10.8.3 (12D78), System Image Utility 10.8.3 (624)
Starting action: Define Image Source (1.4)
Finished running action: Define Image Source
Starting action: Create Image (1.7.2)
Starting image creation process...
Create NetRestore Image
Initiating NetRestore from installed volume.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk3s3"
++ potentialRecoveryDevice=disk3s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Volumes/Macintosh HD/Library/NetBoot/NetBootSP0/NetRestore of Macintosh 10-8_2.nbi"
++ destPath='/Volumes/Macintosh HD/Library/NetBoot/NetBootSP0/NetRestore of Macintosh 10-8_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD 1"
++ sourceVol='/Volumes/Macintosh HD 1'
postInstallHelperKey="1"
++ postInstallHelperKey=1
. "${1}/createCommon.sh"
+ . /tmp/niutemp.YPRmigsL/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2012 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Set up the users group information
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add some additional stuff if the user is an admin
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/admin" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the admin group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserveradm" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserveradm group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserverusr" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserverusr group."
return 1
fi
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
opt="-v"
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
#suppress the Apple ID request
DisableAppleIDRequestForUser "${targetVol}" "${userUnixName[$index]}"
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
local mountLoc=`mount | grep "${theMount}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the mount (if it's actually mounted) and dispose the mountPoint directory
if [ "${mountLoc}" != "" ]; then
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
fi
/bin/rmdir "${theMount}" || return 1
return 0
# Turn off the Apple ID request that happens on first boot after installing the OS
DisableAppleIDRequestForUser()
local targetUserLib="${1}/Users/${2}/Library"
# Only do this if the file doesn't exist
if [ ! -e "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Disabling Apple ID request for user '${2}'"
fi
/usr/libexec/PlistBuddy -c "Add :DidSeeCloudSetup bool 1" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :LastSeenCloudProductVersion string 10.8" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
fi
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
opt="-v"
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
opt="-v"
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -e "$srcVol/private/var/vm/sleepimage" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing sleepimage on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/sleepimage"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*" > /dev/null 2>&1
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*" > /dev/null 2>&1
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
opt="-v"
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${srcDir}" || return 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing the kext cache to the boot image"
fi
# make sure this doesn't exist
if [ -e "${destDir}/i386" ]; then
/bin/rm -rf "${destDir}/i386"
fi
# Install kextcaches to the nbi folder
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating a kernelcache for the boot shell"
fi
/bin/mkdir -p $opt "${destDir}/i386/x86_64" || return 1
/usr/sbin/kextcache -arch x86_64 -L -N -S -z -K "${srcDir}/mach_kernel" -c "${destDir}/i386/x86_64/kernelcache" "${srcDir}/System/Library/Extensions" || return 1I am seeing a very similar output trying to make a netrestore image of a 10.8.4 Macbook Air on a 10.8.4 Mac Mini running OSX Server. Gets to 84% and then shows the -1 progress and then just hangs until I cancel it (I haven't tried leaving it over night but left it that way for hours).
Did you ever figure out what was going on or have a workaround to create an image?
Thanks! -
System Image Utility fails to create boot image
I am not able to successfully build a boot image with the System Image Utility. The build starts and runs for about 1 minute and then I get 100's of ditto messages saying "No space left on device". There's plenty of space left on the device. Eventually I get a GUI message stating the there was an error creating the image. The image is of course unusable. This only happens on a Boot image. I have no problem making an install image from the same source. Is it just me??
Xserve G5 Dual Mac OS X (10.4.5)I had simililar problems with much headscratching as the result.
I found that whenever I tried to create a boot image with System Image Utility (SIU) using an image file of my existing system as the source SIU would fail with the annoying "No space left on device" message everytime. I did a little investigating and found that SIU always created a 400 MB disk image file to copy to. So the error message was correct as my source was way over 4 GB.
I checked the manual and found the embarrasingly simple solution. It's not mentioned directly, rather it is stated that when you want to create an boot image from an existing system you should boot the machine containing the desired system on disk from an alternate source and the run SIU on that machine. The "trick" is that you're running SIU with the existing system mounted as a disk.
So I went back to my Xserve, mounted the image so it appeared on the desktop. Ran SIU and chose the mounted volume as the source instead of the image file, and hey presto!
MacBook Pro, Xserve, eMac, iMac... any Mac I can get my hands on Mac OS X (10.4.6) -
System image utility (server 4) failing
iMac (21.5-inch, Late 2012) with Yosemite 10.10.1 won't image with System Image Utility
I'm using a procedure I've done successfully for a long time with Mavericks. Any suggestions, of course, are welcome.
Create NetRestore Image
Initiating NetRestore from installed volume.
Volume Macintosh HD on disk0s2 unmounted
MESSAGE:Preparing imaging engine…
MESSAGE:Reading whole disk (Apple_HFS : 0)…
MESSAGE: (CRC32 $947173A0: whole disk (Apple_HFS : 0))
MESSAGE:Adding resources…
MESSAGE:Elapsed Time: 16m 37.842s
MESSAGE:File size: 55062652965 bytes, Checksum: CRC32 $94912255
MESSAGE:Sectors processed: 1458433608, 185811721 compressed
MESSAGE:Speed: 90.9Mbytes/sec
MESSAGE:Savings: 92.6%
created: /Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/System.dmg
Volume Macintosh HD on disk0s2 mounted
Volume Recovery HD on disk0s3 mounted
Volume Recovery HD on disk0s3 unmounted
Block checksum: ....10....20....30....40....50....60....70....80....90....100
successfully scanned image "/Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/System.dmg"
created: /Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/NetInstall.dmg
mv: /tmp/mnt.wHfAkTH3/Packages/System.dmg: No space left on device
Execution of 'createRestoreFromSources.sh' failed. Cleaning up.
"disk2" unmounted.
"disk2" ejected.
Failed to create image from restore source.
The operation couldn’t be completed. (System Image Utility error 2.)
Image creation process finished...
Stopping image creation.iMac (21.5-inch, Late 2012) with Yosemite 10.10.1 won't image with System Image Utility
I'm using a procedure I've done successfully for a long time with Mavericks. Any suggestions, of course, are welcome.
Create NetRestore Image
Initiating NetRestore from installed volume.
Volume Macintosh HD on disk0s2 unmounted
MESSAGE:Preparing imaging engine…
MESSAGE:Reading whole disk (Apple_HFS : 0)…
MESSAGE: (CRC32 $947173A0: whole disk (Apple_HFS : 0))
MESSAGE:Adding resources…
MESSAGE:Elapsed Time: 16m 37.842s
MESSAGE:File size: 55062652965 bytes, Checksum: CRC32 $94912255
MESSAGE:Sectors processed: 1458433608, 185811721 compressed
MESSAGE:Speed: 90.9Mbytes/sec
MESSAGE:Savings: 92.6%
created: /Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/System.dmg
Volume Macintosh HD on disk0s2 mounted
Volume Recovery HD on disk0s3 mounted
Volume Recovery HD on disk0s3 unmounted
Block checksum: ....10....20....30....40....50....60....70....80....90....100
successfully scanned image "/Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/System.dmg"
created: /Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/NetInstall.dmg
mv: /tmp/mnt.wHfAkTH3/Packages/System.dmg: No space left on device
Execution of 'createRestoreFromSources.sh' failed. Cleaning up.
"disk2" unmounted.
"disk2" ejected.
Failed to create image from restore source.
The operation couldn’t be completed. (System Image Utility error 2.)
Image creation process finished...
Stopping image creation. -
System Image Utility always fails, why?
Hi everyone,
on my clean and fresh install of 10.7.4 Server the System Image Utility always fails to create an image. I want to create a NetInstall image and have put the OS X Lion Installer in /Applications. I can select it in SIU and choose to create a NetInstall image. It asks for the admin pw and always presents an error at the very end: Image creation failed. An unknown error has occured.
If I select to create a NetBoot image instead it fails directly after clicking on the Create button with this slightly different message: Image creation failed. An error has occured. At least it’s no unknown error…
Any ideas what might be causing this? I have succesfully created NetInstall images with 10.6 Server and 10.8 Server, but 10.7 Server somehow won’t play nice.
Thanks
BjörnHi Brian,
I first deleted the Installer and redownloaded it from the App Store, just to make sure there was no problem with it. Even though I now have the 10.7.4 Installer (had 10.7.0 before) nothing has changed. I then went on to set the log level as suggested. I now get different errors based on the chosen log level.
Log level set to debug:
Image creation failed.
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
Log level set to verbose:
Image creation failed.
An unknown error has occurred.
I did not see anything helpful in the logs unfortunately. The only noticeable thing mentioned was: Failed to create image from installer media.
Any additional ideas? I will attach both logs here, just in case.
VERBOSE LOG:
Starting image creation.
Workflow Started (2012-09-08 14:08:00 +0200)
Mac OS X Server 10.7.4 (11E53), System Image Utility 10.7.3 (543)
Starting action: Define Image Source (1.3)
Finished running action: Define Image Source
Starting action: Create Image (1.6.2)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Installer media.
Creating working path at /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Creating disk image (Size: 4062 MB)
Finalizing disk image.
created: /Users/vm/Desktop/NetInstall of Install Mac OS X Lion/NetInstall.dmg
Attaching disk image
Copying /Volumes/Mac OS X Install ESD
Preparing the kernel and boot loader for the boot image
/Users/vm/Desktop/NetInstall of Install Mac OS X Lion/i386
/Users/vm/Desktop/NetInstall of Install Mac OS X Lion/i386/x86_64
Copying /Volumes/Mac OS X Install ESD/boot.efi
Copying /Volumes/Mac OS X Install ESD/System/Library/CoreServices/PlatformSupport.plist
Performing post install cleanup
Detaching disk image
"disk4" unmounted.
"disk4" ejected.
Correcting permissions. 501:20 /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Script is done.
Failed to create image from installer media.
An unknown error has occurred.
NetInstall creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.
DEBUG LOG:
Starting image creation.
Workflow Started (2012-09-08 13:59:22 +0200)
Mac OS X Server 10.7.4 (11E53), System Image Utility 10.7.3 (543)
Starting action: Define Image Source (1.3)
Finished running action: Define Image Source
Starting action: Create Image (1.6.2)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Installer media.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
destVolFSType="HFS+"
++ destVolFSType=HFS+
installSource="/Volumes/Mac OS X Install ESD"
++ installSource='/Volumes/Mac OS X Install ESD'
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
destPath="/Users/vm/Desktop/NetInstall of Install Mac OS X Lion"
++ destPath='/Users/vm/Desktop/NetInstall of Install Mac OS X Lion'
dmgVolName="NetInstall"
++ dmgVolName=NetInstall
. "${1}/createCommon.sh"
+ . /tmp/niutemp.Yv8Z6Mqx/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2011 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Add PrimaryGroupID
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80
else
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
fi
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the image and dispose the mountPoint directory
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
/bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for t /bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexmountPoint=`mktemp -d "/tmp/mnt.XXXXXXXX"`
errExit()
echo "Execution of '`basename ${0}`' failed. Cleaning up."
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
/bin/rm -r "${destPath}"
exit 1
# Set up for script debugging
debug_opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
# Prepare the destination
CreateOrValidatePath "$destPath" || errExit
# update progress information
echo "${progressPrefix}_creatingImage_"
if [ -e "${installSource}/BaseSystem.dmg" ]; then
size=$2
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating disk image (Size: $size MB)"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "${dmgVolName}" -uid 0 -gid 80 -mode 1775 -layout "SPUD" -fs "$destVolFSType" -stretch 500g -ov -puppetstrings || errExit
echo "${progressPrefix}_copyingSource_"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Attaching disk image"
fi
/usr/bin/hdiutil attach "${destPath}/${dmgTarget}.dmg" -owners on -nobrowse -noautoopen -mountpoint "${mountPoint}" -quiet || errExit
# Copy source Volume base system to
/usr/bin/ditto $debug_opt "${installSource}" "${mountPoint}" || errExit
else
echo "This does not appear to be a Mac OS X Install DVD."
errExit
fi
# If adding any additional packages or scripts
if [ -e "${1}/OSInstall.collection" ]; then
/usr/bin/ditto $debug_opt "${1}/OSInstall.collection" "${mountPoint}/Packages/OSInstall.collection" || errExit
/usr/sbin/chown root:wheel "${mountPoint}/Packages/OSInstall.collection"
# If adding any additional packages
if [ -e "${1}/additionalPackages.txt" ]; then
CopyPackagesWithDestinationsFromFile "${1}/additionalPackages.txt" || errExit
fi
# If adding any scripts
if [ -e "${1}/additionalScripts.txt" ]; then
InstallScriptsFromFile "${1}" "${1}/additionalScripts.txt" "${mountPoint}/Packages" || errExit
fi
fi
# If it exists, install the partition data onto the install image
ProcessAutoPartition "${1}" || errExit
# If it exists, install minstallconfig.xml (AutoInstall data) onto the install image
ProcessMinInstall "${1}" || errExit
# update progress information
echo "${progressPrefix}_buildingBooter_"
# Copy kernel and boot loader
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and boot loader for the boot image"
fi
# make sure this doesn't exist
if [ -e "${destPath}/i386" ]; then
/bin/rm -rf "${destPath}/i386"
fi
/bin/mkdir -p $debug_opt "${destPath}/i386/x86_64" || errExit
# copy these directly off the install media
/usr/bin/ditto $debug_opt "${installSource}/boot.efi" "${destPath}/i386/booter" || errExit
/usr/bin/chflags nohidden "${destPath}/i386/booter"
# Grab the relevant portion of the com.apple.Boot.plist
kernelFlags=`/usr/libexec/PlistBuddy -c "print :'Kernel Flags'" "${installSource}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"`
/usr/libexec/PlistBuddy -c "add :'Kernel Flags' string ${kernelFlags}" "${destPath}/i386/com.apple.Boot.plist" > /dev/null 2>&1
/usr/bin/ditto $debug_opt "${installSource}/System/Library/CoreServices/PlatformSupport.plist" "${destPath}/i386/PlatformSupport.plist" || errExit
# extract the kernel & kernelcache for the boot shell
/usr/bin/lipo -extract i386 "${mountPoint}/kernelcache" -output "${destPath}/i386/kernelcache" || errExit
/usr/bin/lipo -extract x86_64 "${mountPoint}/kernelcache" -output "${destPath}/i386/x86_64/kernelcache" || errExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
errExit
Vol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for tPERCENT:0.000000
PERCENT:4.332841
PERCENT:8.985722
PERCENT:12.358444
PERCENT:14.524864
PERCENT:16.617430
PERCENT:19.522402
PERCENT:21.614967
PERCENT:23.535204
PERCENT:26.070902
PERCENT:29.271296
PERCENT:33.111767
PERCENT:38.847858
PERCENT:42.343674
PERCENT:44.707043
PERCENT:46.578041
PERCENT:49.138355
PERCENT:51.772526
PERCENT:55.563763
PERCENT:58.567207
PERCENT:62.210735
PERCENT:64.795670
PERCENT:69.719353
PERCENT:74.741508
PERCENT:77.055641
PERCENT:79.591331
PERCENT:83.013290
PERCENT:85.548988
PERCENT:88.010834
PERCENT:91.728210
PERCENT:97.710487
PERCENT:100.000000
PERCENT:-1.000000
Finalizing disk image.
created: /Users/vm/Desktop/NetInstall of Install Mac OS X Lion/NetInstall.dmg
/bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > Creating working path at /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Creating disk image (Size: 4062 MB)
/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libex
# update progress information
echo "${progressPrefix}_creatingImage_"
if [ -e "${installSource}/BaseSystem.dmg" ]; then
size=$2
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating disk image (Size: $size MB)"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "${dmgVolName}" -uid 0 -gid 80 -mode 1775 -layout "SPUD" -fs "$destVolFSType" -stretch 500g -ov -puppetstrings || errExit
echo "${progressPrefix}_copyingSource_"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Attaching disk image"
fi
/usr/bin/hdiutil attach "${destPath}/${dmgTarget}.dmg" -owners on -nobrowse -noautoopen -mountpoint "${mountPoint}" -quiet || errExit
# Copy source Volume base system to
/usr/bin/ditto $debug_opt "${installSource}" "${mountPoint}" || errExit
else
echo "This does not appear to be a Mac OS X Install DVD."
errExit
fi
# If adding any additional packages or scripts
if [ -e "${1}/OSInstall.collection" ]; then
/usr/bin/ditto $debug_opt "${1}/OSInstall.collection" "${mountPoint}/Packages/OSInstall.collection" || errExit
/usr/sbin/chown root:wheel "${mountPoint}/Packages/OSInstall.collection"
# If adding any additional packages
if [ -e "${1}/additionalPackages.txt" ]; then
CopyPackagesWithDestinationsFromFile "${1}/additionalPackages.txt" || errExit
fi
# If adding any scripts
if [ -e "${1}/additionalScripts.txt" ]; then
InstallScriptsFromFile "${1}" "${1}/additionalScripts.txt" "${mountPoint}/Packages" || errExit
fi
fi
# If it exists, install the partition data onto the install image
ProcessAutoPartition "${1}" || errExit
# If it exists, install minstallconfig.xml (AutoInstall data) onto the install image
ProcessMinInstall "${1}" || errExit
# update progress information
echo "${progressPrefix}_buildingBooter_"
# Copy kernel and boot loader
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and boot loader for the boot image"
fi
# make sure this doesn't exist
if [ -e "${destPath}/i386" ]; then
/bin/rm -rf "${destPath}/i386"
fi
/bin/mkdir -p $debug_opt "${destPath}/i386/x86_64" || errExit
# copy these directly off the install media
/usr/bin/ditto $debug_opt "${installSource}/boot.efi" "${destPath}/i386/booter" || errExit
/usr/bin/chflags nohidden "${destPath}/i386/booter"
# Grab the relevant portion of the com.apple.Boot.plist
kernelFlags=`/usr/libexec/PlistBuddy -c "print :'Kernel Flags'" "${installSource}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"`
/usr/libexec/PlistBuddy -c "add :'Kernel Flags' string ${kernelFlags}" "${destPath}/i386/com.apple.Boot.plist" > /dev/null 2>&1
/usr/bin/ditto $debug_opt "${installSource}/System/Library/CoreServices/PlatformSupport.plist" "${destPath}/i386/PlatformSupport.plist" || errExit
# extract the kernel & kernelcache for the boot shell
/usr/bin/lipo -extract i386 "${mountPoint}/kernelcache" -output "${destPath}/i386/kernelcache" || errExit
/usr/bin/lipo -extract x86_64 "${mountPoint}/kernelcache" -output "${destPath}/i386/x86_64/kernelcache" || errExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
rrExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
tDestination "${1}" "$destPath" || errExit
errExit
Vol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
Stopping image creation.
Terminating script!
Image creation failed. -
System Image Utility 10.4.11 Gather Image Fails
Hello,
I am having some issues with an XServe with 10.4.11 using System Image Utility to try and gather an image from a 10.4.11 computer. Can anyone help?2011-01-05 13:29:16 -0500 Mounting image to gather information
2011-01-05 13:29:19 -0500 /dev/disk5 Applepartitionscheme
/dev/disk5s1 Applepartitionmap
/dev/disk5s2 Apple_Driver43
/dev/disk5s3 AppleDriver43CD
/dev/disk5s5 AppleDriverATAPI
/dev/disk5s6 AppleDriverATAPI
/dev/disk5s7 Apple_Patches
/dev/disk5s9 Apple_HFS /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/NetInstallMacOSXCom.nbi/mnt
2011-01-05 13:29:19 -0500 Mounted image to gather information
2011-01-05 13:29:31 -0500 "disk5" unmounted.
"disk5" ejected.
2011-01-05 13:29:31 -0500 Unmounting image...
2011-01-05 13:29:31 -0500 Image editing cancelled
2011-01-05 13:29:31 -0500 Click New Install or New Boot button in the toolbar to create another image
2011-01-05 13:32:14 -0500 Initiating user authentication
2011-01-05 13:32:27 -0500 Starting image creation
created:
2011-01-05 13:50:45 -0500 /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2k11/PPCS2K11.nbi/NIUReserve dSystem.dmg
2011-01-05 13:50:47 -0500 /dev/disk5 /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2k11/PPCS2K11.nbi/mnt_blk
created:
2011-01-05 14:09:06 -0500 /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2k11/PPCS2K11.nbi/PPCS2k11.d mg
2011-01-05 14:10:06 -0500 Copying /Volumes/PPCS2K11
2011-01-05 16:23:40 -0500 installer: Package name is SIUExtras
installer: Installing onto volume mounted at /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2k11/PPCS2K11.nbi/mnt.
installer: The install was successful.
2011-01-05 16:24:18 -0500 /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2k11/PPCS2K11.nbi/mnt/System /Library/Extensions/ACard62xxM.kext/Contents/MacOS/ACard62xxM doesn't contain code for the architecture specified; skipping the kext that contains it
/Volumes/Upper-/System/Library/Extensions/AppleStorageDrivers.kext/Contents/Plug Ins/AppleHollywood.kext/Contents/MacOS/AppleHollywood doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleMemore xCDROMDriver.kext/Contents/MacOS/AppleMemorexCDROMDriver doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/CanonEOS1D. kext/Contents/MacOS/CanonEOS1D doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/initioFWBri dge.kext/Contents/MacOS/initioFWBridge doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/IOFireWireS erialBusProtocolSansPhysicalUnit.kext/Contents/MacOS/IOFireWireSerialBusProtocol SansPhysicalUnit doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/LSI-FW-500. kext/Contents/MacOS/LSI-FW-500 doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/MKE-LF-D211 A.kext/Contents/MacOS/MKE-LF-D211A doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/MKE-SR-8171 .kext/Contents/MacOS/MKE-SR-8171 doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/OxfordSemic onductor.kext/Contents/MacOS/OxfordSemiconductor doesn't contain code for the architecture specified; skipping the kext that contains it
/S/System/Library/Extensions/iPodDriver.kext/Contents/PlugIns/iPodSBCDriver.kext /Contents/MacOS/iPodSBCDriver doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/System.kext/PlugIns/BSDKernel.kext/BSDKernel doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/System.kext/PlugIns/IOKit.kext/IOKit doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/System.kext/PlugIns/Libkern.kext/Libkern doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/System.kext/PlugIns/Mach.kext/Mach doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/System.kext/PlugIns/System6.0.kext/kernel.6.0 doesn't contain code for the architecture specified; skipping the kext that contains it
/System/Library/Extensions/System.kext/PlugIns/Unsupported.ke
2011-01-05 16:24:29 -0500 xt/Unsupported doesn't contain code for the architecture specified; skipping the kext that contains it
2011-01-05 16:24:42 -0500 chown: /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2K11.nbi/mach.macosx.mkext: No such file or directory
cp:
2011-01-05 16:24:42 -0500 /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2K11.nbi/mnt/mach_kernel: No such file or directory
2011-01-05 16:24:42 -0500 cp: /Volumes/Upper-Left/Library/NetBoot/NetBootSP1/PPCS2K11.nbi/mnt/mach_kernel: No such file or directory
2011-01-05 16:24:44 -0500 hdid: attach failed - No such file or directory
2011-01-06 09:14:55 -0500 Unmounting image...
2011-01-06 09:14:55 -0500 Error creating Image. This image is not usable -
System Image Utility "volume on diskxsx failed to mount"
I've been trying to create a NetRestore image using System Image Utility (SIU) for the past couple of days, but no matter what I do it fails. I was oringally using OSX 10.8.4, but have now upgraded to 10.8.5.
After reading through the logs, I can see SIU fails whilst it's trying to mount the volume. Has anyone else had this issue, and if so, were you able to fix it?
I also noticed the "Create image of /Volume/Macintosh HD/" function stops at 48% instead of 100%. Is that normal?
Below is a copy of the log that SIU produced.
Starting image creation.
Workflow Started (2013-09-24 08:41:36 +0100)
OS X Server 10.8.5 (12F37), System Image Utility 10.8.3 (624)
Starting action: Define Image Source (1.4)
Finished running action: Define Image Source
Starting action: Create Image (1.7.2)
Starting image creation process...
Create NetRestore Image
Initiating NetRestore from installed volume.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk4s3"
++ potentialRecoveryDevice=disk4s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi"
++ destPath='/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
postInstallHelperKey="1"
++ postInstallHelperKey=1
. "${1}/createCommon.sh"
+ . /tmp/niutemp.rDvE48RI/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2012 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Set up the users group information
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add some additional stuff if the user is an admin
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/admin" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the admin group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserveradm" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserveradm group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserverusr" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserverusr group."
return 1
fi
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
opt="-v"
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
#suppress the Apple ID request
DisableAppleIDRequestForUser "${targetVol}" "${userUnixName[$index]}"
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
local mountLoc=`mount | grep "${theMount}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the mount (if it's actually mounted) and dispose the mountPoint directory
if [ "${mountLoc}" != "" ]; then
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
fi
/bin/rmdir "${theMount}" || return 1
return 0
# Turn off the Apple ID request that happens on first boot after installing the OS
DisableAppleIDRequestForUser()
local targetUserLib="${1}/Users/${2}/Library"
# Only do this if the file doesn't exist
if [ ! -e "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Disabling Apple ID request for user '${2}'"
fi
/usr/libexec/PlistBuddy -c "Add :DidSeeCloudSetup bool 1" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :LastSeenCloudProductVersion string 10.8" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
fi
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
opt="-v"
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
opt="-v"
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -e "$srcVol/private/var/vm/sleepimage" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing sleepimage on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/sleepimage"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*" > /dev/null 2>&1
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*" > /dev/null 2>&1
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
opt="-v"
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${srcDir}" || return 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing the kext cache to the boot image"
fi
# make sure this doesn't exist
if [ -e "${destDir}/i386" ]; then
/bin/rm -rf "${destDir}/i386"
fi
# Install kextcaches to the nbi folder
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating a kernelcache for the boot shell"
fi
/bin/mkdir -p $opt "${destDir}/i386/x86_64" || return 1
/usr/sbin/kextcache -arch x86_64 -L -N -S -z -K "${srcDir}/mach_kernel" -c "${destDir}/i386/x86_64/kernelcache" "${srcDir}/System/Library/Extensions" || return 1
# Create the i386 and x86_64 boot loaders on the boot image
PrepareBootLoader()
local srcVol="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing boot loader"
opt="-v"
fi
# Copy the boot.efi to the booter shell
if [ -e "${mountPoint}/System/Library/CoreServices/boot.efi" ]; then
/usr/bin/ditto $opt "${mountPoint}/System/Library/CoreServices/boot.efi" "${destDir}/i386/booter" || return 1
else
/usr/bin/ditto $opt "${srcVol}/System/Library/CoreServices/boot.efi" "${destDir}/i386/booter" || return 1
fi
# Unlock the file so we can change its owner later
chflags nouchg "${destDir}/i386/booter"
# Copy the PlatformSupport.plist file
if [ -e "${mountPoint}/System/Library/CoreServices/PlatformSupport.plist" ]; then
/usr/bin/ditto $opt "${mountPoint}/System/Library/CoreServices/PlatformSupport.plist" "${destDir}/i386/PlatformSupport.plist" || return 1
else
/usr/bin/ditto $opt "${srcVol}/System/Library/CoreServices/PlatformSupport.plist" "${destDir}/i386/PlatformSupport.plist" || return 1
fi
# If it exists, install the partitioning application and data onto the install image
ProcessAutoPartition()
local tempDir="$1"
local opt=""
local targetDir=""
if [ -e "$tempDir/PartitionInfo.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
# Determine if this is an install source, or a restore source
if [ -d "${mountPoint}/Packages" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to install image"
fi
targetDir="${mountPoint}/Packages"
elif [ -d "${mountPoint}/System/Installation/Packages" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to restore image"
fi
targetDir="${mountPoint}/System/Installation/Packages"
else
echo "There doesn't appear to be either an install or restore source mounted at ${mountPoint}"
return 1
fi
# Create the Extras directory if it doesn't exist
if [ ! -d "${targetDir}/Extras" ]; then
/bin/mkdir "${targetDir}/Extras"
fi
targetDir="${targetDir}/Extras"
/usr/bin/ditto $opt "$tempDir/PartitionInfo.plist" "${targetDir}/PartitionInfo.plist" || return 1
/usr/bin/ditto $opt "$tempDir/AutoPartition.app" "${targetDir}/AutoPartition.app" || return 1
fi
return 0
# If it exists, install the minstallconfig.xml onto the install image
ProcessMinInstall()
local tempDir="$1"
local opt=""
local targetDir="${mountPoint}/Packages/Extras"
if [ -e "$tempDir/minstallconfig.xml" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing minstallconfig.xml to install image"
opt="-v"
fi
/usr/bin/ditto $opt "$tempDir/minstallconfig.xml" "${targetDir}/minstallconfig.xml" || return 1
/usr/sbin/chown root:wheel "${targetDir}/minstallconfig.xml"
/bin/chmod 644 "${targetDir}/minstallconfig.xml"
fi
return 0
# untar the OSInstall.mpkg so it can be modified
untarOSInstallMpkg()
local tempDir="$1"
local opt=""
# we might have already done this, so check for it first
if [ ! -d "${tempDir}/OSInstall_pkg" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "uncompressing OSInstall.mpkg"
opt="-v"
fi
/bin/mkdir "${tempDir}/OSInstall_pkg"
cd "${tempDir}/OSInstall_pkg"
/usr/bin/xar $opt -xf "${mountPoint}/System/Installation/Packages/OSInstall.mpkg"
# make Distribution writeable
/bin/chmod 777 "${tempDir}/OSInstall_pkg"
/bin/chmod 666 "${tempDir}/OSInstall_pkg/Distribution"
fi
# Make a tempdir to mount the image on
mountPoint=`mktemp -d "/tmp/mnt.XXXXXXXX"`
mktemp -d "/tmp/mnt.XXXXXXXX"
++ mktemp -d /tmp/mnt.XXXXXXXX
+ mountPoint=/tmp/mnt.7E4iD6mQ
sourceMount=""
+ sourceMount=
crfsErrExit()
echo "Execution of '`basename \"${0}\"`' failed. Cleaning up."
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
# detach the mounted source, if necessary
if [ "${sourceMount}" != "" ] ; then
DetachAndRemoveMount "${sourceMount}"
fi
# Remove the items we created
/bin/rm -r "$destPath/i386" > /dev/null 2>&1
/bin/rm "$destPath/$dmgTarget.dmg" > /dev/null 2>&1
/bin/rm "$destPath/System.dmg" > /dev/null 2>&1
# Finally, remove the directory IF empty
/bin/rmdir "$destPath"
exit 1
InstallNetBootClientHelper()
local tempDir="${1}"
local destDir="${mountPoint}/Packages/Extras"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${destDir}/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${destDir}/bindingNames.plist"
/bin/chmod 644 "${destDir}/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${destDir}/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${destDir}/sharingNames.plist"
/bin/chmod 644 "${destDir}/sharingNames.plist"
fi
# This is required, make sure it's here
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${destDir}/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${destDir}/NetBootClientHelper"
/bin/chmod 555 "${destDir}/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${destDir}/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${destDir}/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${destDir}/com.apple.NetBootClientHelper.plist"
/usr/bin/ditto $opt "${tempDir}/installClientHelper.sh" "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh" || return 1
/usr/sbin/chown root:wheel "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
/bin/chmod 555 "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
return 0
InstallBaseSystemToShell()
local baseSystemDMG="${1}"
local shellMount="${2}"
local tempDir=`/usr/bin/dirname "${1}"`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
echo "Copying Base System bits to the boot shell image"
fi
baseMount=`mktemp -d "/tmp/mnt_bs.XXXXXXXX"`
/usr/bin/hdiutil attach "${baseSystemDMG}" -noverify -owners on -nobrowse -noautoopen -mountpoint "${baseMount}" -quiet || return 1
# Copy the boot.efi and SystemVersion.plist out to the shell dmg
/usr/bin/ditto $opt "${baseMount}/System/Library/CoreServices/boot.efi" "${shellMount}/boot.efi" || return 1
chflags nouchg "${shellMount}/boot.efi"
/bin/mkdir -p "${shellMount}/usr/standalone/i386" || return 1
/bin/ln "${shellMount}/boot.efi" "${shellMount}/usr/standalone/i386/boot.efi" || return 1
/bin/mkdir -p "${shellMount}/System/Library/CoreServices" || return 1
/bin/ln "${shellMount}/boot.efi" "${shellMount}/System/Library/CoreServices/boot.efi" || return 1
/usr/bin/ditto $opt "${baseMount}/System/Library/CoreServices/SystemVersion.plist" "${shellMount}/System/Library/CoreServices/SystemVersion.plist" || return 1
# stash some things we need for later
/usr/bin/ditto $opt "${baseMount}/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache" "${tempDir}/kernelcache" || return 1
/usr/bin/ditto $opt "${baseMount}/System/Library/CoreServices/com.apple.recovery.boot/PlatformSuppo rt.plist" "${tempDir}/PlatformSupport.plist" || return 1
# Clean up
/usr/bin/hdiutil detach "${baseMount}" || retry_hdiutil_detach "${baseMount}" || return 1
/bin/rmdir "${baseMount}"
theDmg=`basename "${baseSystemDMG}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Copying ${theDmg} to the boot shell."
fi
/usr/bin/ditto $debug_opt "${baseSystemDMG}" "${shellMount}/${theDmg}"
return 0
# Set up for script debugging
debug_opt=""
+ debug_opt=
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ debug_opt=-v
# Prepare the destination
CreateOrValidatePath "${destPath}" || crfsErrExit
+ CreateOrValidatePath '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
+ local 'targetDir=/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
+ '[' '!' -d '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating working path at /Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
Creating working path at /Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi
+ /bin/mkdir -p '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
# Source in our image building commands
. "${1}/buildCommands.sh"
+ . /tmp/niutemp.rDvE48RI/buildCommands.sh
'/System/Library/CoreServices/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/asrFromVolume.sh' "/tmp/niutemp.rDvE48RI" "/Volumes/Macintosh HD" "System" || exit 1
++ '/System/Library/CoreServices/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/asrFromVolume.sh' /tmp/niutemp.rDvE48RI '/Volumes/Macintosh HD' System
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk4s3"
++ potentialRecoveryDevice=disk4s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi"
++ destPath='/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
postInstallHelperKey="1"
++ postInstallHelperKey=1
# variables we will need
created_dest="NO"
+ created_dest=NO
afvErrExit()
echo "Execution of '`basename \"${0}\"`' failed. Cleaning up."
# detach the disk and remove the mount folder
if [ "${created_dest}" == "YES" ]; then
/bin/rm -r "${destPath}"
fi
exit 1
retrieveBaseSystemDMG()
local tempDir="${1}"
local opt=""
if [ "${potentialRecoveryDevice}" != "" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Retrieving BaseSystem bits from Recovery HD"
opt="-v"
fi
recoveryMount=`mktemp -d "/tmp/mnt_rp.XXXXXXXX"`
/usr/sbin/diskutil mount readOnly -mountPoint "${recoveryMount}" "${potentialRecoveryDevice}" || return 1
# Now make sure this is what was expected
if [ -e "${recoveryMount}/com.apple.recovery.boot/BaseSystem.dmg" ]; then
/usr/bin/ditto $opt "${recoveryMount}/com.apple.recovery.boot/BaseSystem.dmg" "${tempDir}/BaseSystem.dmg" || return 1
/usr/bin/ditto $opt "${recoveryMount}/com.apple.recovery.boot/BaseSystem.chunklist" "${tempDir}/BaseSystem.chunklist"
fi
/usr/sbin/diskutil unmount "${potentialRecoveryDevice}" || return 1
/bin/rmdir "${recoveryMount}"
fi
return 0
# Insure the working path (dmg destination) exists
if [ ! -d "${destPath}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${destPath}"
fi
/bin/mkdir -p "${destPath}" || afvErrExit
created_dest="YES"
fi
+ '[' '!' -d '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi' ']'
# If the volume source is the boot drive we have an asr:// type source
if [ "${2}" == "/" ]; then
# Create an empty image to skip the ASR volume creation
/usr/bin/touch "${destPath}/${3}.dmg"
# Set aside the needed BaseSystem.dmg
retrieveBaseSystemDMG "${1}" || afvErrExit
fi
+ '[' '/Volumes/Macintosh HD' == / ']'
# Look for an existing System.dmg
if [ ! -e "${destPath}/${3}.dmg" ]; then
# Didn't find one, so create it from volume source
${1}/makeNetRestoreFromItem.sh "${1}" "${2}" "${3}" || afvErrExit
fi
+ '[' '!' -e '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi/System.dmg' ']'
+ /tmp/niutemp.rDvE48RI/makeNetRestoreFromItem.sh /tmp/niutemp.rDvE48RI '/Volumes/Macintosh HD' System
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk4s3"
++ potentialRecoveryDevice=disk4s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi"
++ destPath='/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
postInstallHelperKey="1"
++ postInstallHelperKey=1
. "${1}/createCommon.sh"
+ . /tmp/niutemp.rDvE48RI/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2012 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Set up the users group information
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add some additional stuff if the user is an admin
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/admin" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the admin group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserveradm" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserveradm group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserverusr" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserverusr group."
return 1
fi
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
opt="-v"
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
#suppress the Apple ID request
DisableAppleIDRequestForUser "${targetVol}" "${userUnixName[$index]}"
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
local mountLoc=`mount | grep "${theMount}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the mount (if it's actually mounted) and dispose the mountPoint directory
if [ "${mountLoc}" != "" ]; then
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
fi
/bin/rmdir "${theMount}" || return 1
return 0
# Turn off the Apple ID request that happens on first boot after installing the OS
DisableAppleIDRequestForUser()
local targetUserLib="${1}/Users/${2}/Library"
# Only do this if the file doesn't exist
if [ ! -e "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Disabling Apple ID request for user '${2}'"
fi
/usr/libexec/PlistBuddy -c "Add :DidSeeCloudSetup bool 1" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :LastSeenCloudProductVersion string 10.8" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
fi
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
opt="-v"
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
opt="-v"
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -e "$srcVol/private/var/vm/sleepimage" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing sleepimage on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/sleepimage"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*" > /dev/null 2>&1
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*" > /dev/null 2>&1
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
opt="-v"
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${srcDir}" || return 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing the kext cache to the boot image"
fi
# make sure this doesn't exist
if [ -e "${destDir}/i386" ]; then
/bin/rm -rf "${destDir}/i386"
fi
# Install kextcaches to the nbi folderAfter running your command, and using the mounted image as my source for creating the NetRestore image, SIU was able to complete the first two steps, but failed on the rest. It was able to complete "Creating Image From Source", and "Preparing Image For Restore", but it fails on "Creating Bootable System".
I've copied and pasted the end of the error log. Any idea what caused the Bootable System from successfully being created?
PERCENT:-1.000000
Finalizing disk image.
created: /Users/morgan/Desktop/30sept.nbi/System.dmg
# Set aside the needed BaseSystem.dmg
retrieveBaseSystemDMG "${1}" || mnrfiErrExit
+ retrieveBaseSystemDMG /tmp/niutemp.3PZq4yzF
+ local tempDir=/tmp/niutemp.3PZq4yzF
+ local opt=
+ '[' disk2s3 '!=' '' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ opt=-v
+ echo 'Retrieving BaseSystem bits from Recovery HD'
Retrieving BaseSystem bits from Recovery HD
mktemp -d "/tmp/mnt_rp.XXXXXXXX"
++ mktemp -d /tmp/mnt_rp.XXXXXXXX
+ recoveryMount=/tmp/mnt_rp.75pVTRHs
+ /usr/sbin/diskutil mount readOnly -mountPoint /tmp/mnt_rp.75pVTRHs disk2s3
Volume Recovery HD on disk2s3 mounted
+ '[' -e /tmp/mnt_rp.75pVTRHs/com.apple.recovery.boot/BaseSystem.dmg ']'
+ /usr/sbin/diskutil unmount disk2s3
Volume Recovery HD on disk2s3 unmounted
+ /bin/rmdir /tmp/mnt_rp.75pVTRHs
+ return 0
# update progress information
echo "${progressPrefix}_preparingASR_"
+ echo _progress_preparingASR_
# "Scan the image for restore"
asr_opt=""
+ asr_opt=
if [ "${skipReorderingKey}" == 1 ] ; then
asr_opt="--nostream"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore without multicast reordering"
fi
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore"
fi
fi
+ '[' 0 == 1 ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Preparing image for restore'
Preparing image for restore
/usr/sbin/asr imagescan --source "${destPath}/${dmgContainer}.dmg" $asr_opt || mnrfiErrExit
+ /usr/sbin/asr imagescan --source /Users/morgan/Desktop/30sept.nbi/System.dmg
Checksumming partition of size 63 blocks...done
Block checksum: ....10....20....30....40....50....60....70....80....90....100
Reordering: ....10....20....30....40....50....60....70....80....90....100asr: successfully scanned image "/Users/morgan/Desktop/30sept.nbi/System.dmg"
# update progress information
echo "${progressPrefix}_creatingInstallSystem_"
+ echo _progress_creatingInstallSystem_
restoreSource="${sourceVol}"
+ restoreSource='/Volumes/Macintosh HD'
# If this is a restore from install media, mount that as our source
if [ "${restoreSource}" == "(installMedia)" ] ; then
sourceMount=`mktemp -d "/tmp/mnt_src.XXXXXXXX"`
/usr/bin/hdiutil attach "${destPath}/System.dmg" -noverify -owners on -nobrowse -noautoopen -mountpoint "${sourceMount}" -quiet || crfsErrExit
restoreSource="${sourceMount}"
fi
+ '[' '/Volumes/Macintosh HD' == '(installMedia)' ']'
# If we don't have a BaseSystem.dmg available to us fail now.
if [ ! -e "${1}/BaseSystem.dmg" ]; then
echo "There is no BaseSystem.dmg (Recovery HD) associated with the source ${restoreSource}."
crfsErrExit
fi
+ '[' '!' -e /tmp/niutemp.3PZq4yzF/BaseSystem.dmg ']'
+ echo 'There is no BaseSystem.dmg (Recovery HD) associated with the source /Volumes/Macintosh HD.'
There is no BaseSystem.dmg (Recovery HD) associated with the source /Volumes/Macintosh HD.
+ crfsErrExit
basename "${0}"
++ basename '/System/Library/CoreServices/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/createRestoreFromSources.sh'
+ echo 'Execution of '\''createRestoreFromSources.sh'\'' failed. Cleaning up.'
Execution of 'createRestoreFromSources.sh' failed. Cleaning up.
+ DetachAndRemoveMount /tmp/mnt.nfN5nVgM
+ local theMount=/tmp/mnt.nfN5nVgM
mount | grep "${theMount}"
++ mount
++ grep /tmp/mnt.nfN5nVgM
+ local mountLoc=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Detaching disk image'
Detaching disk image
+ '[' DEBUG == DEBUG ']'
+ /usr/sbin/lsof +fg /tmp/mnt.nfN5nVgM
+ '[' '' '!=' '' ']'
+ /bin/rmdir /tmp/mnt.nfN5nVgM
+ return 0
+ '[' '' '!=' '' ']'
+ /bin/rm -r /Users/morgan/Desktop/30sept.nbi/i386
+ /bin/rm /Users/morgan/Desktop/30sept.nbi/NetInstall.dmg
+ /bin/rm /Users/morgan/Desktop/30sept.nbi/System.dmg
+ /bin/rmdir /Users/morgan/Desktop/30sept.nbi
+ exit 1
Script is done.
Bridge exited with status 256
Failed to create image from restore source.
An unknown error has occurred.
An unknown error has occurred.
Image creation process finished...
Stopping image creation.
Image creation failed.
Thanks. -
System Image Utility 10.6.3 - fails when creating NetBoot image from DVD
System Image Utility 10.6.3, trying to create a NetBoot image from a bundled installer disc that came with a 27" Late 2009 iMac (iMac11,1). Image creation fails consistently, since the image that System Image Utility creates is only 901M.
Anyone see this before?
Don
--------- System Image Utility log ----------
Workflow Started (2010-06-16 14:03:02 -0700)
Starting action: Define Image Source
Finished running action: Define Image Source
Starting action: Create Image
Starting image creation process...
Create NetBoot Image
Initiating NetBoot from Install Media.
Creating working path at /Library/NetBoot/NetBootSP0/NetBoot of Mac OS X Install DVD
Creating disk image (Size: 901 MB)
Finalizing disk image.
created: /Library/NetBoot/NetBootSP0/NetBoot of Mac OS X Install DVD/NetBoot.dmg
Attaching disk image
Installing to destination volume
2010-06-16 14:03:38.126 installer[2365:6f03] Looking for system packages
2010-06-16 14:03:38.129 installer[2365:6f03] no system packages found
2010-06-16 14:03:38.130 installer[2365:6f03] No or Invalid system receipts found on /private/tmp/mnt.LjFArn
2010-06-16 14:03:38.130 installer[2365:6f03] Attempting fallback using: /System/Library/PrivateFrameworks/SystemMigration.framework/Resources/FallbackS ystemFiles.plist
2010-06-16 14:03:38.175 installer[2365:6f03] Finding system files...
2010-06-16 14:03:38.619 installer[2365:6f03] Writing system path cache.
2010-06-16 14:03:38.623 installer[2365:6f03] Error writing cache to /private/tmp/mnt.LjFArn/Library/Caches/com.apple.FindSystemFiles.plist
2010-06-16 14:03:38.625 installer[2365:6f03] Failed to enumerate /tmp/mnt.LjFArn/Library/Caches, cannot prune (
"com.apple.userpictureCache"
installer: Package name is Mac OS X
installer: Installing at base path /private/tmp/mnt.LjFArn
installer: The install failed (There is not enough space on this disk to install the selected items. Deselect at least 6.46 GB and try again.)
Script is done.
NetBoot creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.Brian Nesse wrote:
Hi Don, here's my guess...
The 901 number is additional space added in the scripts. This indicates that the source image size was 0.
Since you are making a NetBoot from Install media, under the covers the installer process is being run to create a NetBoot volume. The media shipped with the 27" iMac is most likely CPU specific and thus the installation fails because you are trying to create the image (i.e. install the system) on an unsupported CPU.
In order to produce a NetBoot from the install media, you'll have to create it on the 27" iMac.
Hi Brian,
Thanks for the response. This makes perfect sense. I'll give this a try and shout back!
Thanks,
Don -
System Image Utility: NetInstall creation failed
Hi all,
I'm trying to create a NetRestore image. I'm doing this in 10.6.8 Server. I have a .dmg file which is a clone of the "template" hard drive I set up. When I create the NetRestore image, it tells me there's no room left on the device. I'm doing it on a machine with over 350GB of disk space left, so I'm not sure how much space it thinks it needs. below is the output. The dmg file is 49.1GB and contains a disk with a capacity of 159.7GB (110.6GB used). Below is the output. Any ideas? Thanks much!
Jeff
=====================
Starting image creation.
Workflow Started (2014-05-22 08:18:43 -0400)
Mac OS X Server 10.6.8 (10K549), System Image Utility 10.6.7 (448)
Starting action: Define Image Source (1.2)
Finished running action: Define Image Source
Starting action: Create Image (1.5.4)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Restore Media.
created: /Volumes/Storage/Library/NetBoot/NetBootSP0/20140515-1068-k2user/System.dmg
Checksumming partition of size 63 blocks...done
Block checksum: ....10....20....30....40....50....60....70....80....90....100
File checksum: ....10....20....30....40....50....60....70....80....90....100
Reordering: ....10....20....30....40....50....60....70....80....90....100asr: successfully scanned image "/Volumes/Storage/Library/NetBoot/NetBootSP0/20140515-1068-k2user/System.dmg"
created: /Volumes/Storage/Library/NetBoot/NetBootSP0/20140515-1068-k2user/NetInstall.dmg
installer: Package name is SIUExtras
installer: Installing at base path /private/tmp/mnt.yp2Bxx
installer: The install was successful.
mv: /tmp/mnt.yp2Bxx/System/Installation/Packages/System.dmg: No space left on device
Script is done.
NetInstall creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.
Assistant - Selected source:"NetBoot of Mac HD".
=====================I'm getting the same/similar building a 10.10 NetRestore image. How does one get compression to be nice and reliable?
Or is there something else I'm missing? I installed 10.10 and 10.10 server/tools the same day, so should be in sync, right? I'm using a procedure I've done successfully for a long time with Mavericks. Any suggestions, of course, are welcome.
Create NetRestore Image
Initiating NetRestore from installed volume.
Volume Macintosh HD on disk0s2 unmounted
MESSAGE:Preparing imaging engine…
MESSAGE:Reading whole disk (Apple_HFS : 0)…
MESSAGE: (CRC32 $947173A0: whole disk (Apple_HFS : 0))
MESSAGE:Adding resources…
MESSAGE:Elapsed Time: 16m 37.842s
MESSAGE:File size: 55062652965 bytes, Checksum: CRC32 $94912255
MESSAGE:Sectors processed: 1458433608, 185811721 compressed
MESSAGE:Speed: 90.9Mbytes/sec
MESSAGE:Savings: 92.6%
created: /Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/System.dmg
Volume Macintosh HD on disk0s2 mounted
Volume Recovery HD on disk0s3 mounted
Volume Recovery HD on disk0s3 unmounted
Block checksum: ....10....20....30....40....50....60....70....80....90....100
successfully scanned image "/Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/System.dmg"
created: /Users/steve/Desktop/CC2014_oct_Yos_111314.nbi/NetInstall.dmg
mv: /tmp/mnt.wHfAkTH3/Packages/System.dmg: No space left on device
Execution of 'createRestoreFromSources.sh' failed. Cleaning up.
"disk2" unmounted.
"disk2" ejected.
Failed to create image from restore source.
The operation couldn’t be completed. (System Image Utility error 2.)
Image creation process finished...
Stopping image creation. -
10.5.8 System Image Utility Error Codes (1305:10b)
I have been building images for a lab setting for a few years now, and have never had a problem until now. I just built the image computer how I would like it. I hook it up to my sever and boot it into target disk mode. The server reads it fine. However, when I go to create a netinstall image with system image utility I get the following errors (see below). I tried to verify permissions and the disk. I also repaired the permissions because it found a few problems. I'm stilling getting the errors below and I have had no luck figuring out what they mean or how to get the image to work. Any help would be a lifesaver. Thanks in advance.
PERCENT:84.303322
2010-02-03 18:50:46.160 copy-helper[1305:10b] bomCopierFileCopyError:/Volumes/Macintosh HD 2/Users/default/Library/Application Support/SyncServices/Local/clientdata/0063006f006d002e006100700070006c0065002e0 0410064006400720065007300730042006f006f006b, error 45
2010-02-03 18:50:46.182 copy-helper[1305:10b] Error 45 (Operation not supported) encountered copying "/Volumes/Macintosh HD 1/Volumes/Macintosh HD 2/Users/default/Library/Application Support/SyncServices/Local/clientdata/0063006f006d002e006100700070006c0065002e0 0410064006400720065007300730042006f006f006b" (canceling)
PERCENT:84.305969
PERCENT:84.305969
PERCENT:84.305969
could not access /Volumes/Macintosh HD 2/Users/default/Library/Application Support/SyncServices/Local/clientdata/0063006f006d002e006100700070006c0065002e0 0410064006400720065007300730042006f006f006b - Operation not supported
PERCENT:-1.000000
hdiutil: create failed - Operation not supported
Script is done.Tried both of those, repairing the disk finds nothing wrong. Repairing the permissions said it fixed items, but still got the same error codes. I'm about to remove the files and see what happens.
-
Error creating a netboot image with System Image Utility
Hi all !
I am trying to create a NetBoot image from my Panther CD, to boot an old iBook.
I am using System Image Utility version 10.4.11.
I can create a NetInstall image, but when I create a NetBoot image SIU give me an error.
I looked in the logs and I can see the error is generated by the script Applications/Server/System Image Utility.app/Contents/Resources/.preinstall
This command is the culprit:
/usr/sbin/installer -verbose -lang 'eng' -pkg '/Volumes/Mac OS X Install Disc 1/System/Installation/Packages/OSInstall.mpkg' -target /Library/NetBoot/NetBootSP0/PantBoot3.nbi/mnt -_multiDiscPath /tmp/siuInstallExtras
The error is (as seen in the logs):
This package requires authentication to install.
If I take the command and run it in the terminal using sudo it goes thru, but gives another error:
installer: Cannot install on volume /Library/NetBoot/NetBootSP0/PantBoot3.nbi/mnt because it is disabled.
installer: Mac OS X cannot start up from this volume.
Is this thing supposed to work ?? It seems to me SIU is buggy.
Any help would be much appreciated.
Regards
MikeI'm not digging the new SIU at all yet. Maybe I'll get used to it in time. I couldn't get it to accept a Tiger 10.4.6 Install disc the other day to build a NetInstall. Don't know if I was doing something wrong or if it was instinctively rejecting it because I was doing something unsupported.
I miss NetRestore. I think Mike wants use to use Automator... but I want NetRestore's automated Multicast ASR and Windows image restore. It would take a lot of work to match Mike's shrink-wrapped solution.
Speaking of NetRestore, its creator Mike Bombich advises against use CCC for mass deployment. This may include what you're doing. It's really a backup tool, but unfortunately a lot of people got into the habit of using it for creating deployment images and these often have problems. It's the best tool for create images that you will deploy onto multiple Macs. -
I noticed when useing the System Image Utility to create a NetInstall set that the Percent listed in the log files goes from 87.2938 to -1. The process does continue working and eventually does complete, but the NetInstall set doesn't work. Has anyone else noticed this when using the System Image Utility? This is also when using it in custom mode and not quick easy mode.
I noticed when useing the System Image Utility to create a NetInstall set that the Percent listed in the log files goes from 87.2938 to -1. The process does continue working and eventually does complete, but the NetInstall set doesn't work. Has anyone else noticed this when using the System Image Utility? This is also when using it in custom mode and not quick easy mode.
-
System Image Utility - Takes FOREVER
13 hours ago, I asked System Image Utility 10.5 to create a NetInstall image of a 75GB Leopard partition. It's only 40% done. It's definately working on it (ie the percentages increase) but this seems ridiculous.
Source System: iMac 20" Intel Core Duo 2. In Target Disk Mode connected to a MacBook Pro running leopard client with Server Tools downloaded from Apple's site.
Both systems, Leopard retail.
Image is being saved to an attached USB drive (attached to the Macbook Pro).
Any ideas why this is so slow?
Thanks
WoodyLooking at my System log, it appears the image creation took 4 hours 13 minutes (I started it as I left work). More interesting errors:
Nov 1 18:19:45 host-46-132 System Image Utility[7963]: Assistant - Selected source:"NetBoot of Macintosh HD 1".
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: Assistant - Selected source:"NetBoot of Macintosh HD 1".
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Enable or Disable Tracks” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Export Movies” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Hint Movies” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “New Audio Capture” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “New Video Capture” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Pause Capture” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Play Movies” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Start Capture” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Stop Capture” could not be loaded because QuickTime Pro is required.
Nov 1 18:20:32 host-46-132 System Image Utility[7973]: The action “Show Growl Notification” could not be loaded because the file “/Library/PreferencePanes/Growl.prefPane” was not found.
Nov 1 18:20:33 host-46-132 System Image Utility[7973]: Could not find image named 'splitterHandle'.
Nov 1 18:21:55 host-46-132 System Image Utility[7973]: Workflow Started
Nov 1 18:21:55 host-46-132 System Image Utility[7973]: Starting action: Define Image Source
Nov 1 18:21:55 host-46-132 System Image Utility[7973]: Finished running action: Define Image Source
Nov 1 18:21:55 host-46-132 System Image Utility[7973]: Starting action: Create Image
Nov 1 18:22:00 host-46-132 KernelEventAgent[52]: tid 00000000 received unknown event (256)
Nov 1 18:22:00 host-46-132 authexec[7985]: executing /Applications/Server/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/bridge
Nov 1 18:22:00 host-46-132 bridge[7985]: Bridge is launching external task.
Nov 1 18:22:00 host-46-132 [0x0-0x2d52d5].com.apple.server.SystemImageUtility[7973]: 2007-11-01 18:22:00.668 bridge[7985:913] Bridge is launching external task.
Nov 1 18:22:01 host-46-132 hdiejectd[7993]: running
Nov 1 18:22:02 host-46-132 com.apple.KernelEventAgent[52]: KernelEventAgent: sysctl_queryfs: No such file or directory
Nov 1 18:22:02 host-46-132 kernel[0]: hfs: Initializing the journal (joffset 0x76000 sz 0x800000)...
Nov 1 18:22:19 host-46-132 diskarbitrationd[59]: DiskManagementTool [7982]:50079 not responding.
Nov 1 18:22:28 host-46-132 com.apple.launchd[399] (0x10f130.Locum[8005]): Exited: Terminated
Nov 1 18:22:35 host-46-132 diskarbitrationd[59]: DiskManagementTool [7982]:50783 not responding.
Nov 1 18:22:35 host-46-132 hdiejectd[8006]: running
Nov 1 18:22:35 host-46-132 KernelEventAgent[52]: tid 00000000 received unknown event (256)
Nov 1 18:22:36 host-46-132 kernel[0]: hfs: disabling journaling for mount @ 0x98df000
Nov 1 21:40:40 host-46-132 kernel[0]: hfs: Initializing the journal (joffset 0x75 sz 0x800000)...
Nov 1 21:40:42 host-46-132 notifyd[12]: EV_DELETE failed for file watcher 65
Nov 1 21:40:43 host-46-132 kextd[10]: couldn't respond to filesystem change notification!
Nov 1 21:40:44: --- last message repeated 1 time ---
Nov 1 21:40:44 host-46-132 hdiejectd[8278]: running
Nov 1 21:57:53 host-46-132 hdiejectd[8313]: running
Nov 1 21:57:53 host-46-132 KernelEventAgent[52]: tid 00000000 received unknown event (12)
Nov 1 22:23:49 host-46-132 hdiejectd[8359]: running
Nov 1 22:23:52 host-46-132 com.apple.launchd[1] (com.apple.hdiejectd): Throttling respawn: Will start in 7 seconds
Nov 1 22:24:03 host-46-132 hdiejectd[8373]: running
Nov 1 22:24:07 host-46-132 fseventsd[56]: log dir: /Users/ben/Documents/Generic 10.5 (beta)/mnt/.fseventsd getting new uuid: 275BD72D-8EED-4DC8-8A05-D7035EA72B5D
Nov 1 22:32:44 host-46-132 bridge[7985]: Bridge finished
Nov 1 22:32:44 host-46-132 [0x0-0x2d52d5].com.apple.server.SystemImageUtility[7973]: 2007-11-01 22:32:44.644 bridge[7985:913] Bridge finished
Nov 1 22:32:45 host-46-132 System Image Utility[7973]: Failed to create image from script createNetRestore.sh.
Nov 1 22:32:46 host-46-132 KernelEventAgent[52]: tid 00000000 received unknown event (256)
Nov 1 22:33:23 host-46-132 fseventsd[56]: Events arrived for /Users/ben/Documents/Generic 10.5 (beta)/mnt after an unmount request! Re-initializing. -
System Image Utility - universal_boot option only on Intel machines
I'm using System Image Utility on 1.8 GHz PowerPC G5 running Mac OS X Server version 10.5.2. When I try to create a NetBoot image with the standard settings (no customization) and a Mac OS X 10.5 Install DVD, I get the following message:
updatedyld_sharedcache failed: universal_boot option can only be used on intel machines
The rest of the log is below; any help you can provide would be appreciated. Thanks!
Log:
Starting image creation.
Workflow Started (2008-05-16 16:05:27 -0500)
Starting action: Define Image Source
Finished running action: Define Image Source
Starting action: Add User Account
Finished running action: Add User Account
Starting action: Create Image
Starting image creation process...
Create NetBoot Image
created: /Users/[username]/Documents/NetBoot of Mac OS X Install DVD/NetBoot.dmg
installer: Package name is Mac OS X
installer: Installing at base path /tmp/mnt
installer: The install was successful.
updatedyld_sharedcache failed: universal_boot option can only be used on Intel machines
hdiutil: couldn't eject "disk3" - error 49168
"disk3" unmounted.
Script is done.
NetBoot creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.Here's the contents of the Debug log; I couldn't find where the problem was, but maybe someone can help. (I'm also not sure how to keep the discussion board from translating some of the code to markup). Thanks!
Starting image creation.
Workflow Started (2008-05-19 16:42:42 -0500)
Starting action: Define Image Source
Finished running action: Define Image Source
Starting action: Add User Account
Finished running action: Add User Account
Starting action: Create Image
Starting image creation process...
Create NetBoot Image
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint="/tmp/mnt"
++ mountPoint=/tmp/mnt
ownershipInfoKey="1000:20"
++ ownershipInfoKey=1000:20
dmgTarget="NetBoot"
++ dmgTarget=NetBoot
sourceVol="/Volumes/Mac OS X Install DVD"
++ sourceVol='/Volumes/Mac OS X Install DVD'
export CM_BUILD="CM_BUILD"
++ export CM_BUILD=CM_BUILD
++ CM_BUILD=CM_BUILD
userLanguage[0]="English"
++ userLanguage[0]=English
userIsAdmin[0]="1"
++ userIsAdmin[0]=1
userImagePath[0]="/Library/User Pictures/Nature/Cactus.tif"
++ userImagePath[0]='/Library/User Pictures/Nature/Cactus.tif'
export _com_apple_kextd_skiplocks="1"
++ export _com_apple_kextd_skiplocks=1
++ _com_apple_kextd_skiplocks=1
userPassHash[0]="000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F870000000 000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000"
++ userPassHash[0
]=000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F870000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000
userFullName[0]="[user full name]"
++ userFullName[0]='[user full name]'
destPath="/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD"
++ destPath='/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
userUnixName[0]="[user short name]"
++ userUnixName[0]=[user short name]
. "$1/createCommon.sh"
+ . /tmp/niutemp.mdOQAzsJ/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright 2007 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 long name
# $2 short name
# $3 isAdminUser key
# $4 password hash
# $5 user picture path
# $6 Language string
local databasePath="/Local/Target/Users/${2}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bi
n/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -create $databasePath || exit 1
# Add long name
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${1}" || exit 1
# Add PrimaryGroupID
if [ "${3}" == 1 ]; then
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80 || exit 1
else
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20 || exit 1
fi
# Add UniqueID
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i} || exit 1
# Add Home Directory entry
/usr/bin/dscl -f "${mountP
oint}/var/db/dslocal/nodes/Default" localonly -append $databasePath dsAttrTypeNative:home /Users/${2} || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath authentication_authority ";ShadowHash;" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${5}" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath passwd "*" || exit 1
# Add shell
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash" || exit 1
# lookup generated uid
genUID=`/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${2} GeneratedUID` || exit 1
genUID=${genUID:14:36}
# make sure the shadow/hash directory exists
if [ ! -e "${mountPoint}/var/db/shadow/hash" ] ; then
/bin/mkdir -p "${mountPoint}/var/db/shadow/hash" || exit 1
/bin/chmod -R 700 "${mountPoint}/var/
db/shadow" || exit 1
fi
# to copy our password hash in there...
echo "${4}" > "${mountPoint}/var/db/shadow/hash/$genUID"
/bin/chmod 600 "${mountPoint}/var/db/shadow/hash/$genUID" || exit 1
# Create Home directory
if [ -e "/System/Library/User Template/${6}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${6}.lproj/" "${mountPoint}/Users/${2}" || exit 1
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${mountPoint}/Users/${2}" || exit 1
fi
/usr/sbin/chown -R $i:$i "${mountPoint}/Users/${2}" || exit 1
# If they exist, apply any Append.bom changes
ApplyAppendBom()
local tempDir="$1"
local srcVol="$2"
local opt=""
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$tempDir/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from System Image Utility"
fi
/usr/bin/ditto $opt -bom "$tempDir/Append.bom" "$srcVol" "${mountPoint}" || exit
1
fi
if [ -e "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from $srcVol"
fi
/usr/bin/ditto $opt -bom "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" "$srcVol" "${mountPoint}" || exit 1
fi
# Copies a list of packages (full paths contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${leafName}" || exit 1
fi
done < "
local opt=""
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${SUB_PATH}${leafName}" || exit 1
fi
done < "${theFile}"
# Create the dyld shared cache files
CreateDyldCaches()
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating dyld shared cache files"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-debug"
fi
fi
/usr/bin/update_dyld_shared_cache -root "${mountPoint}" -universal_boot -force $opt
# Validate or create the destination directory and mo
unt point
CreateOrValidateDestination()
local destDir="$1"
if [ ! -d "$destDir" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at $destDir"
fi
/bin/mkdir -p "$destDir" || exit 1
fi
# Create mount point
if [ ! -d "${mountPoint}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating mountpoint for in $destDir"
fi
/bin/mkdir -p "${mountPoint}" || exit 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
local count="${#userFullName[*]}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${userFullN
ame[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassHash[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
done
fi
# Create an installer package in /System/Installation/Packages/ wrapping the supplied script
InstallerPackageFromScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script $scriptName"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/$scriptName.pkg/Contents/Resources"
/bin/mkdir $opt "${tempDir}/emptyDir" || exit 1
cd "${tempDir}/emptyDir"
# Create Archive.pax.gz
/bin/pax -w -x cpio -f "$tempDir/$scriptName.pkg/Contents/Archive.pax" .
/usr/bin/gzip "$tempDir/$scriptName.pkg
/Contents/Archive.pax"
# Create the Archive.bom file
/usr/bin/mkbom "$tempDir/emptyDir/" "$tempDir/$scriptName.pkg/Contents/Archive.bom"
# Create the Info.plist
/bin/cat > "$tempDir/$scriptName.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.$scriptName</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "$tempDir/$scriptName.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "$tempDir/$scriptName
.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "$tempDir/$scriptName.pkg/Contents/Resources/postflight"
# copy the package to the Packages directory
/usr/bin/ditto $opt "$tempDir/$scriptName.pkg" "${mountPoint}/System/Installation/Packages/$scriptName.pkg" || exit 1
# clean up
/bin/rm -r "$tempDir/emptyDir"
/bin/rm -r "$tempDir/$scriptName.pkg"
# If restoreDSBindings.sh exists, tar up the DS data and install it all onto the install image
InstallLocalDSBindings()
local tempDir="$1"
local niuTempDir="var/tmp/niu"
local scriptDir=${niuTempDir}/postinstall
local opt=""
if [ -e "$tempDir/restoreDSBindings.sh" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service bindings from this computer"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# make the directory if needed
/bin/mkdir -p $opt "${mountPoint}/${scriptDir}" || exit 1
# tar up the Directory
Service settings
/usr/bin/tar $opt -cf "${mountPoint}/${niuTempDir}/DSBindings.tar" /Library/Preferences/DirectoryService/ || exit 1
/usr/bin/ditto $opt "$tempDir/restoreDSBindings.sh" "${mountPoint}/${scriptDir}/restoreDSBindings.sh" || exit 1
# Set the permissions just in case
/usr/sbin/chown root:wheel "${mountPoint}/${scriptDir}/restoreDSBindings.sh"
/bin/chmod 755 "${mountPoint}/${scriptDir}/restoreDSBindings.sh"
# make an installer package out of the script
InstallerPackageFromScript "$tempDir" "$tempDir/restoreDSBindings.sh"
fi
# If it exists, install the PowerManagement.plist onto the install image
InstallPowerManagementPlist()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/com.apple.PowerManagement.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing progress announcer to install image"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/com.app
le.PowerManagement.plist" "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
/bin/chmod 644 "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
fi
# If it exists, install the InstallerStatusNotifications.bundle and progress emitter onto the install image
InstallProgressPieces()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/InstallerStatusNotifications.bundle" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing progress announcer to install image"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/InstallerStatusNotifications.bundle" "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle" || exit 1
/usr/sbin/chown -R root:wheel "${mountPoint}/System/Lib
rary/CoreServices/InstallerStatusNotifications.bundle"
/bin/chmod 755 "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle"
fi
if [ -e "$tempDir/com.apple.ProgressEmitter.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing status emitter to image"
fi
/usr/bin/ditto $opt "$tempDir/progress_emitter" "${mountPoint}/usr/sbin/progress_emitter" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/usr/sbin/progress_emitter"
/bin/chmod 555 "${mountPoint}/usr/sbin/progress_emitter"
/usr/bin/ditto $opt "$tempDir/com.apple.ProgressEmitter.plist" "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
/bin/chmod 644 "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
fi
# Converts a list of scripts (full paths contained in the file at $1) into pa
ckages in .../System/Installation/Packages/
InstallScriptsFromFile()
local tempDir="$1"
local theFile="$2"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
InstallerPackageFromScript "$tempDir" "${FILE}"
fi
done < "
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
if [ "${scriptsDebugKey}" == "VERBO
SE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
fi
/usr/bin/hdiutil detach "${mountPoint}" || exit 1
# remove the mount folder
/bin/rmdir "${mountPoint}" || exit 1
# copy the NBImageInfo.plist file
/usr/bin/ditto $opt "$tempDir/NBImageInfo.plist" "$destDir/NBImageInfo.plist" || exit 1
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# rename the folder to .nbi
if [ ! -e "$destDir.nbi" ]; then
/bin/mv $opt "$destDir" "$destDir.nbi" || exit 1
else
local parentDir=`dirname "${destDir}"`
local targetName=`basename "${destDir}"`
for ((i=2; i<1000; i++)); do
if [ ! -e "${parentDir}/${targetName}_$i.nbi" ]; then
/bin/mv $opt "$destDir" "${parentDir}/${targetName}_$i.nbi" || exit 1
break
fi
done
fi
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${
scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; t
hen
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local destDir="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
for ARCH in i386 ppc; do
# Prepare the kernel
/bin/mkdir $opt "$destDir/${ARCH}" || exit 1
/usr/bin/lipo -extract "${ARCH}" "${mountPoint}/mach_kernel" -output "$destDir/${ARCH}/mach.macosx" || exit 1
# Build kext cache
/usr/sbin/kextcache -a ${ARCH} -s -l -n -z -m "$destDir/${ARCH}/mach.macosx.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
done
# Create the PPC and I386 boot loaders on the boot image
PrepareBootLoader()
local srcVol="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}
" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing boot loader"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
if [ -e "${mountPoint}/usr/standalone/ppc/bootx.bootinfo" ]; then
/usr/bin/ditto $opt "${mountPoint}/usr/standalone/ppc/bootx.bootinfo" "$destDir/ppc/booter" || exit 1
/usr/bin/ditto $opt "${mountPoint}/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
else
/usr/bin/ditto $opt "$srcVol/usr/standalone/ppc/bootx.bootinfo" "$destDir/ppc/booter" || exit 1
/usr/bin/ditto $opt "$srcVol/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
fi
# If it exists, install the partitioning application and data onto the install image
ProcessAutoPartition()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/PartitionInfo.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to install image"
if [ "${scriptsDebugKey}" ==
"DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/PartitionInfo.plist" "${mountPoint}/System/Installation/PartitionInfo.plist" || exit 1
/usr/bin/ditto $opt "$tempDir/AutoPartition.app" "${mountPoint}/System/Installation/AutoPartition.app" || exit 1
# Tell the installer to run the Partitioning application
/bin/echo "#!/bin/sh
/System/Installation/AutoPartition.app/Contents/MacOS/AutoPartition" > "${mountPoint}/private/etc/rc.cdrom.postWS"
# Due to the way rc.install sources the script, it needs to be executable
/usr/sbin/chown root:wheel "${mountPoint}/private/etc/rc.cdrom.postWS"
/bin/chmod 755 "${mountPoint}/private/etc/rc.cdrom.postWS"
fi
# If it exists, install the minstallconfig.xml onto the install image
ProcessMinInstall()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/minstallconfig.xml" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing minstallconfig.xml to install image"
if
[ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/minstallconfig.xml" "${mountPoint}/etc/minstallconfig.xml" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/minstallconfig.xml"
/bin/chmod 644 "${mountPoint}/etc/minstallconfig.xml"
fi
# untar the OSInstall.mpkg so it can be modified
untarOSInstallMpkg()
local tempDir="$1"
local opt=""
# we might have already done this, so check for it first
if [ ! -d "${tempDir}/OSInstall_pkg" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "uncompressing OSInstall.mpkg"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/bin/mkdir "${tempDir}/OSInstall_pkg"
cd "${tempDir}/OSInstall_pkg"
/usr/bin/xar $opt -xf "${mountPoint}/System/Installation/Packages/OSInstall.mpkg"
# make Distribution writeable
/bin/chmod 777 "${tempDir}/OSInstall_pkg"
/bin/chmod 666 "${tempDir}/OSInstall_pkg/Distribution"
fi
handler (
echo "Terminated. Cleaning up. Unmounting $destPath"
/usr/bin/hdiutil detach "${mountPoint}"
/bin/rmdir "${mountPoint}"
/bin/rm -r "$destPath"
exit
trap "handler" TERM INT
+ trap handler TERM INT
# Set up for script debugging
debug_opt=""
+ debug_opt=
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
debug_opt="-v"
fi
+ '[' DEBUG == DEBUG ']'
+ debug_opt=-v
# Prepare the destination
CreateOrValidateDestination "$destPath"
+ CreateOrValidateDestination '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ '[' '!' -d '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating working path at /Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
Creating working path at /Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD
+ /bin/mkdir -p '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ '[' '!' -d /tmp/mnt ']'
# update progress i
nformation
echo "${progressPrefix}_creatingImage_"
+ echo
# Create the appropriate disk image type
imageExtension="sparseimage"
+ imageExtension=sparseimage
if [ "${imageIsUDIFKey}" == 1 ]; then
tempsize=""
# if installing from DVD, get the max install size, otherwise use the volume size
if [ -e "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" ]; then
/usr/sbin/installer -plist -verbose -pkginfo -pkg "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" > "$1/OSInstall.plist"
tempsize=`/usr/bin/defaults read "$1/OSInstall" Size`
tempsize=$((tempsize/1024))
else
tempsize=`df -m "$sourceVol" | tail -n 1 | awk '{print $3}'`
fi
# Add one percent for safety, 500MB for the dyld caches and 400MB to eliminate the "disk is almost full" message
size=$(($tempsize+$(($tempsize/100))+900))
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating disk image (Size: $size MB)"
fi
# Create and atta
ch disk image
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "$dmgTarget" -uid 0 -gid 80 -mode 1775 -layout "UNIVERSAL CD" -fs HFS+ -stretch 500g -ov || exit 1
imageExtension="dmg"
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating sparse disk image"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -type SPARSE -size 500g -volname "$dmgTarget" -uid 0 -gid 80 -mode 1775 -layout "UNIVERSAL CD" -fs HFS+ -ov || exit 1
fi
+ '[' 1 == 1 ']'
+ tempsize=
+ '[' -e '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg' ']'
+ /usr/sbin/installer -plist -verbose -pkginfo -pkg '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg'
/usr/bin/defaults read "$1/OSInstall" Size
++ /usr/bin/defaults read /tmp/niutemp.mdOQAzsJ/OSInstall Size
+ tempsize=11937692
+ tempsize=11657
+ size=12673
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating disk image (Size: 12673 MB)'
Creating disk image (Size: 12673 MB)
+ /usr/bin/hdiutil create '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/NetBoot' -megabytes 12673 -volname NetBoot -uid 0 -gid 80 -mode 1775 -layout 'UNIVERSAL CD' -fs HFS+ -stretch 500g -ov
created: /Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/NetBoot.dmg
+ imageExtension=dmg
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Attaching disk image"
fi
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Attaching disk image'
Attaching disk image
/usr/bin/hdiutil attach "$destPath/$dmgTarget.$imageExtension" -owners on -nobrowse -mountpoint "${mountPoint}" -quiet || exit 1
+ /usr/bin/hdiutil attach '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/NetBoot.dmg' -owners on -nobrowse -mountpoint /tmp/mnt -quiet
# Copy source Volume base system to
if [ -e "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" ]; then
# update progress information
echo "${progressPrefix}_installingSystem_"
if [ -e "$1/MacOSXInstaller.choiceChanges" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing to destination volume with choice selection."
fi
/usr/sbin/installer -applyChoiceChangesXML "$1/MacOSXInstaller.choiceChanges" -pkg "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" -target "${mountPoint}"
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing to destination volume"
fi
/usr/sbin/installer -pkg "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" -target "${mountPoint}"
fi
# bless the boot folder
/usr/sbin/bless -folder "${mountPoint}/System/Library/CoreServices" -quiet --bootinfo --bootefi
# "kext"
if [ -e "${mountPoint}/System/Library/StartupItems/NetBootSharingNames"
]; then
/bin/chmod 0755 "${mountPoint}/System/Library/StartupItems"
/usr/sbin/chown -R root:wheel "${mountPoint}/System/Library/StartupItems/NetBootSharingNames"
/bin/chmod 0755 "${mountPoint}/System/Library/StartupItems/NetBootSharingNames"
/bin/chmod 0755 "${mountPoint}/System/Library/StartupItems/NetBootSharingNames/NetBootSharingNa mes"
/bin/chmod 0644 "${mountPoint}/System/Library/StartupItems/NetBootSharingNames/StartupParameter s.plist"
fi
if [ ! -d "${mountPoint}/Library/Preferences/DirectoryService" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating DirectoryService directory"
fi
/bin/mkdir $debug_opt "${mountPoint}/Library/Preferences/DirectoryService"
/bin/chmod 0775 "${mountPoint}/Library/Preferences/DirectoryService"
fi
/usr/sbin/kextcache -a i386 -a ppc -l -z -m "${mountPoint}/System/Library/Extensions.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
else
# update progress information
echo "${progressPre
fix}_copyingSource_"
PreCleanSource "$sourceVol"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying source volume"
fi
/usr/bin/ditto $debug_opt "$sourceVol" "${mountPoint}"
fi
+ '[' -e '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg' ']'
+ echo
+ '[' -e /tmp/niutemp.mdOQAzsJ/MacOSXInstaller.choiceChanges ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Installing to destination volume'
Installing to destination volume
+ /usr/sbin/installer -pkg '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg' -target /tmp/mnt
installer: Package name is Mac OS X
installer: Installing at base path /tmp/mnt
installer: The install was successful.
+ /usr/sbin/bless -folder /tmp/mnt/System/Library/CoreServices -quiet --bootinfo --bootefi
+ '[' -e /tmp/mnt/System/Library/StartupItems/NetBootSharingNames ']'
+ '[' '!' -d /tmp/mnt/Library/Preferences/DirectoryService ']'
+ /usr/sbin/kextcache -a i386 -a ppc -l -z -m /tmp/mnt/System/Library/Extensions.mkext /tmp/mnt/System/Library/Extensions
# install the PowerManagement.plist onto the bootable image
InstallPowerManagementPlist "$1"
+ InstallPowerManagementPlist /tmp/niutemp.mdOQAzsJ
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local opt=
+ '[' -e /tmp/niutemp.mdOQAzsJ/com.apple.PowerManagement.plist ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Installing progress announcer to install image'
Installing progress announcer to install image
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ /usr/bin/ditto -v /tmp/niutemp.mdOQAzsJ/com.apple.PowerManagement.plist /tmp/mnt/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plis t
Copying /tmp/niutemp.mdOQAzsJ/com.apple.PowerManagement.plist
+ /usr/sbin/chown root:wheel /tmp/mnt/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plis t
+ /bin/chmod 644 /tmp/mnt/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plis t
# create the dyld caches
CreateDyldCaches
+ CreateDyldCaches
+ local opt=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating dyld shared cache files'
Creating dyld shared cache files
+ '[' DEBUG == DEBUG ']'
+ opt=-debug
+ /usr/bin/update_dyld_shared_cache -root /tmp/mnt -universal_boot -force -debug
update_dyld_shared_cache failed: universal_boot option can only be used on Intel machines
# If it exists, install the partition data onto the bootable image
ProcessAutoPartition "$1"
+ ProcessAutoPartition /tmp/niutemp.mdOQAzsJ
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local opt=
+ '[' -e /tmp/niutemp.mdOQAzsJ/PartitionInfo.plist ']'
# install the progress emitter onto the install image
InstallProgressPieces "$1"
+ InstallProgressPieces /tmp/niutemp.mdOQAzsJ
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local opt=
+ '[' -e /tmp/niutemp.mdOQAzsJ/InstallerStatusNotifications.bundle ']'
+ '[' -e /tmp/niutemp.mdOQAzsJ/com.apple.ProgressEmitter.plist ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Insta
lling status emitter to image'
Installing status emitter to image
+ /usr/bin/ditto /tmp/niutemp.mdOQAzsJ/progress_emitter /tmp/mnt/usr/sbin/progress_emitter
+ /usr/sbin/chown root:wheel /tmp/mnt/usr/sbin/progress_emitter
+ /bin/chmod 555 /tmp/mnt/usr/sbin/progress_emitter
+ /usr/bin/ditto /tmp/niutemp.mdOQAzsJ/com.apple.ProgressEmitter.plist /tmp/mnt/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist
+ /usr/sbin/chown root:wheel /tmp/mnt/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist
+ /bin/chmod 644 /tmp/mnt/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist
# update progress information
echo "${progressPrefix}_buildingBooter_"
+ echo
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache "$destPath"
+ PrepareKernelAndKextCache '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local opt=
+ '[' DEBUG == VERBO
SE -o DEBUG == DEBUG ']'
+ echo 'Preparing the kernel and kext cache for the boot image'
Preparing the kernel and kext cache for the boot image
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ for ARCH in i386 ppc
+ /bin/mkdir -v '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386'
mkdir: created directory '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386'
+ /usr/bin/lipo -extract i386 /tmp/mnt/mach_kernel -output '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386/mach.macosx'
+ /usr/sbin/kextcache -a i386 -s -l -n -z -m '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386/mach.macosx.mkext' /tmp/mnt/System/Library/Extensions
+ for ARCH in i386 ppc
+ /bin/mkdir -v '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc'
mkdir: created directory '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc'
+ /usr/bin/lipo -extract ppc /tmp/mnt/mach_kernel -output '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc/mach.macosx'
+ /usr/sbin/kextcache -a ppc -s -l -n -z -m '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc/mach.macosx.mkext' /tmp/mnt/System/Library/Extensions
# And finally, prepare the boot loader on the boot image
PrepareBootLoader "$sourceVol" "$destPath"
+ PrepareBootLoader '/Volumes/Mac OS X Install DVD' '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local 'srcVol=/Volumes/Mac OS X Install DVD'
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local opt=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Preparing boot loader'
Preparing boot loader
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ '[' -e /tmp/mnt/usr/standalone/ppc/bootx.bootinfo ']'
+ /usr/bin/ditto -v /tmp/mnt/usr/standalone/ppc/bootx.bootinfo '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc/booter'
Copying /tmp/mnt/usr/standalone/ppc/bootx.bootinfo
+ /usr/bin/ditto -v /tmp/mnt/usr/standalone/i386/boot.efi '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386/booter'
Copying /tmp/mnt/usr/standalone/i386/boot.efi
# "touch"
/usr/bin/touch "${mountPoint}/private/var/db/.AppleSetupDone"
+ /usr/bin/touch /tmp/mnt/private/var/db/.AppleSetupDone
/usr/bin/touch "${mountPoint}/Library/Receipts/.SetupRegComplete"
+ /usr/bin/touch /tmp/mnt/Library/Receipts/.SetupRegComplete
/usr/bin/touch "${mountPoint}/.metadata_never_index"
+ /usr/bin/touch /tmp/mnt/.metadata_never_index
# remove software update
if [ -e "${mountPoint}/System/Library/CoreServices/Software Update.app" ]; then
/bin/rm -rf "${mountPoint}/System/Library/CoreServices/Software Update.app"
fi
+ '[' -e '/tmp/mnt/System/Library/CoreServices/Software Update.app' ']'
+ /bin/rm -rf '/tmp/mnt/System/Library/CoreServices/Software Update.app'
if [ -e "${mountPoint}/System/Library/PreferencePanes/SoftwareUpdate.prefPane" ]; then
/bin/rm -rf "${mountPoint}/System/Library/PreferencePanes/SoftwareUpdate.prefPane"
fi
+ '[' -e /tmp/mnt/System/Library/PreferencePanes/SoftwareUpdate.prefPane ']'
+ /bin/rm -rf /tmp/mnt/System/Library/PreferencePanes/SoftwareUpdate.prefPane
# add any user accounts
CreateUserAccounts
+ CreateUserAccounts
+ local count=1
+ '[' 1 -gt 0 ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Adding 1 user account(s) to the image'
Adding 1 user account(s) to the image
+ (( index=0 ))
+ (( index<1 ))
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Adding user [user full name]'
Adding user [user full name]
+ AddLocalUser '[user full name]' [user short name] 1 0000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F8700000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000 '/Library/User Pictures/Nature/Cactus.tif' English
+ local databasePath=/Local/Target/Users/[user short name]
+ (( i=501 ))
+ (( i<600 ))
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users UniqueID $i
++ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -search /Local/Target/Users UniqueID 501
+ output=
+ '[' '' == '' ']'
+ break
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -create /Local/Target/Users/[user short name]
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] RealName '[user full name]'
+ '[' 1 == 1 ']'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] PrimaryGroupID 80
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] UniqueID 501
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] dsAttrTypeNative:home /Users/[user short name]
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] authentication_authority ';ShadowHash;'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] picture '/Library/User Pictures/Nature/Cactus.tif'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] passwd '*'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] UserShell /bin/bash
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${2} GeneratedUID
++ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -read /Local/Target/Users/[user short name] GeneratedUID
+ genUID='GeneratedUID: 2609E2EC-9C33-469B-B850-A3BF935D72FE'
+ genUID=2609E2EC-9C33-469B-B850-A3BF935D72FE
+ '[' '!' -e /tmp/mnt/var/db/shadow/hash ']'
+ /bin/mkdir -p /tmp/mnt/var/db/shadow/hash
+ /bin/chmod -R 700 /tmp/mnt/var/db/shadow
+ echo 0000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F8700000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000
+ /bin/chmod 600 /tmp/mnt/var/db/shadow/hash/2609E2EC-9C33-469B-B850-A3BF935D72FE
+ '[' -e '/System/Library/User Template/English.lproj/' ']'
+ /usr/bin/ditto '/System/Library/User Template/English.lproj/' /tmp/mnt/Users/[user short name]
+ /usr/sbin/chown -R 501:501 /tmp/mnt/Users/[user short name]
+ (( index++ ))
+ (( index<1 ))
# update progress information
echo "${progressPrefix}_finishingUp_"
+ echo
# perform the final cleanup
PostFlightDestination "$1" "$destPath"
+ PostFlightDestination /tmp/niutemp.mdOQAzsJ '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local opt=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Performing post install cleanup'
Performing post install cleanup
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ '[' -e /tmp/mnt/var/db/dslocal/indices/Default/index ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Detaching disk image'
Detaching disk image
+ /usr/bin/hdiutil detach /tmp/mnt
T?∞T?– A≈
Maybe you are looking for
-
Getting Error While Going For Print Preview in ALV Report
Hi, We doveloped a new report based on client requirment while going for print preview all the fields are shufling.Can you please guide me I am unable to solve this problem. Regards Suresh
-
How do i use parallel compression for 4 drum tracks in Logic pro 7.2.3 Please
how do i use parallel compression for 4 drum tracks in Logic pro 7.2.3 Please. my version is 7.2.3 and my son did his drums on 4 tracks. 2 OH's 1 Kick and 1 Snare. Were confused because we cant figure out how to do parallel compression on the older l
-
How to get the cursor position from screen in module pool program
Hi, I am doing the module pool program, I have one table control in one screen. I have to give functionality to the user that when the user enters first record in the table control and after filling the last field when he presses enter the cursor wil
-
Hi the below errors are in Timesten , please any one tell me why this errors reported in log file. Oct 21 13:59:06 msp2 TimesTen Data Manager 5.1.28.msp[10821]: [ID 702911 user.error] TT14000: TimesTen daemon internal error: subd: flusher thread fail
-
Create Project page Customization
Hi, I need to capture the End Customer data during the project creation screen. This cannot be added using the projects Quick Entry setup. So I am trying to customize the project creation page to capture this data. 1st option I thought: - Extend the