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

Similar Messages

  • System Image Utility - Issues with making bootable images

    During the image creation process for a Netboot, the System Image Utility reports an error. I've included the log file (everything before the removal of the bad image below).
    ------------Begin Log File --------------
    2006-06-02 13:19:25 -0400 Initiating user authentication
    2006-06-02 13:19:28 -0400 Image creation in progress
    2006-06-02 13:19:28 -0400 Starting image creation
    newfs_hfs:
    2006-06-02 14:10:30 -0400 b=400: bitmap clump size is too small
    --------------End Log File--------------------
    I have no issue creating images from restore disk sets (that shipped with machines) or retail masters of various OS's. This issue seems to be related to the particular drives I am trying to create images from.
    The drives that give me this error are hardwarily OK and the software works great. I can boot from these drives and have no issues with the machines imaged from them after the fact. I just want to Netboot off of these so I don't have to lug a million drives around...
    Any clue?

    i know that was the case in Leopard and Snow Leopard but i just mounted a leopard image to create a new netrestore on my lion server.  i was not able to boot any of my images created on Leopard or SL when running Lion Server.  I assume i need to recreate the images on Lion.  Right now my Lion server is using a leopard image as the source to create a netrestore i can push on the Lion server.

  • Can I create a system image with System Image Utility and then transfer the image folder to another server?

    I am currently in the process of creating several images to restore for classroom purposes. I am wondering if it is possible to use the System Image Utility on a computer which has Server Admin Tools installed, then transfer that image folder directly to the "NetBoot" folder on our current Apple Netboot Server. Has anyone tried this and/or succeeded? I'd like to get some feedback before attempting it myself on our college's netboot server. Thanks!

    We've run into a few problems concerning this process. When we create the image on a seperate machine from the server using SIU and then place it in the NetBoot folder, not every .nbi folder created works properly. We're running into errors that say "Could not find any scan information. The source needs to be imagescanned before it can be restored". This does not happen with every image, but it does happen with computers which have a lot of programs installed on them. Is there a way to imagescan the .nbi folder and/or resolve this issue without going through the process of making a completely new NetRestore image?

  • System image utility : creating Leopard & SL Netinstall images to share on Lion

    Hi!
    I have recently upgraded to Lion server from SL server, our server had 1 main purpose: host Leopard & SL Netinstall images as well as some netboot diagnostic drives.
    It seems however that with a fresh install of Lion Server that trying to create a netinstall image from anything other then Lion doesnt work, even whipping out the old 10.6.3 install DVD mounts on the system but image utility shows no valid source.
    i remember going from tiger sever to leopard that i could no longer make tiger images, and had to run from a tiger system to create them, but when i was running SL, i was able to share leopard images without issue.
    So, is there anyway i can (without having to reinstall SL server ) i can create fresh netinstall images of 10.5 & 10.6OS's for my shiny new Lion server to share?
    now unfortunatley the leopard & SL images i had previously are gone (a HDD crash giving me reason to upgrade) (yeah yeah i know, backups.. ) but i thought i would just reimage the files again as that is this servers only purpose.
    Thank you kindly in advance, any help appreciated.
    Richard

    i know that was the case in Leopard and Snow Leopard but i just mounted a leopard image to create a new netrestore on my lion server.  i was not able to boot any of my images created on Leopard or SL when running Lion Server.  I assume i need to recreate the images on Lion.  Right now my Lion server is using a leopard image as the source to create a netrestore i can push on the Lion server.

  • System Image Utility seems stuck in "Create Image" step.

    I'm building a NetRestore image with Snow Leopard 10.6.8 as base OS, but added 3rd party software packages. When I hit the "Run" button, it checkmarked all the steps before "Create Image." So I just left it to run the last step, but it's been running now for three days.
    I didn't add THAT many packages. I checked the Force Quit window today, but SIU is not shown in red saying that it stopped responding. Creating this image shouldn't be taking this long.
    SIU is running in XServe 3,1 with OS 10.6.8, and 24GB RAM.
    Any suggestions?

    I do not believe that's
    The server they have is in english yes.....
    I can not believe!!!
    i will try monday and tell you some thing.
    Brian can you say one more thing
    how do I create a script to insert in the post-install script They have in System Image Utility. "package and post-install script ."
    The file need to be in " .sh "??
    i can put the welcome message appear to select the portuguese language but i need to login in single user and put the;
    /sbin/fsck -fy
    /sbin/mount -uw /
    touch /var/db/.RunLanguageChooserToo
    Shutdown -h now
    And works.
    if i can put this in the installation process i thing it will will work.?
    Thanks again for your help

  • System image utility set to create NetRestore Image, creates Netboot Disk instead

    Hi, I'm trying to create some OS X 10.10.1 netrestore images and no matter what I do with selecting options SIU makes the image a netboot image instead of a netrestore image. Has anyone any suggestions?
    As a workaround I've created my image and used the .dmg with an old working netrestore image.

    Hi Patrick,
    If you are having issues creating a NetRestore image in System Image Utility, you may find the following articles helpful (apologies if you have already seen them):
    OS X Server: System Image Utility requires Recovery HD partition to create a NetRestore image - Apple Support
    OS X Server: Creating a single NetBoot, NetInstall or NetRestore image for multiple Mac computers - Apple Support
    Regards,
    - Brenden

  • 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
    Woody

    Looking 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 & Netboot

    I am using System Image Utility to create a disk image in 10.4.7 Server, I have been doing it since 10:30, it is now nearly 11:30 and the disk image is not yet compelete, although the disk image shows up in the Server Admin application as a viable option to select. The main bulk of the disk image has been done:
    NBImageInfo.plist
    booter
    Macintosh HD.dmg
    mnt_blk
    NIUReservedSystem.dmg
    mach.macosx
    mnt
    i386
    mach.macosx
    As you can see everything should be working, but the disk image for some reason is not done yet... and yet no sizes, or data has changed on any bits of the file for over 40 minutes now. The size doesn't change, but the time last changed or edited has changed to the time I now see on the computer clock...
    Any idea of what is going on?
    Also, after I have applied NetBoot in the server, should I be able netboot the surrounding network node without any issues?
    When I attempt it, and netboot is on in the server end, and on the client I press N to netboot, nothing happens, except that it attempts to netboot but can't find the server... why would this happen? I have full administrative rights to the network....

    As this is really an OS X Server and Imaging question, you'll probably have better luck in that forum:
    http://discussions.apple.com/forum.jspa?forumID=717

  • System Image Utility - Create User - Activate Remote Management

    When creating an image with system image utility, based on a DVD image instead of a cloned image, I cannot create a user and activate Remote Management.
    I have created an installer package with Apple Remote Desktop that is supposed to do both, however it doesn't work. I do not get an error, but no user is created.
    I have tried a post-install script however the dscl command is not recognized even if I put the path /usr/bin/dscl.
    I even tried to use a popular package out there called "createUser" but that fails as well.
    Has anyone had any luck with this when trying to make a moduler image with System Image Utility?
    Message was edited by: NeedSomeAnswer

    After configuring all the appropriate settings, I
    push the "Create" button and it appears to start
    working, prompts me for a location to save the actual
    image itself, creates a folder with the default name
    and then nothing happens.
    ok here's the deal: i created a folder in my OSX server home directory labelled "images" and keep our multiple images there. although you CAN have your images on other drives or on the network, that would take a LOOOOOOOONG time to do the data transfer to the invisible netboot folder on your server. my advice: keep local copies of all images. save a ton of time for yourself, eh?
    then, when it's time to use the system image suntility to load up an image, i go to that same location each time, call it up and have the app set to the prefs i want or need. i'm on 10.4.7 server and have had no problem using the software.
    so try using images locally and then, if that doesn't work, upgrade to 10.4.7

  • Help with Package Maker and System Image Utility

    Hi all....
    Im trying to use package maker and System Image utility to create a netinstall image.  I dont know if im creating the package wrong, or if it has something to do with siu... but when I install the image from the server only the OS installs... not the packages.  The packages just get copied to the HD.
    Right now im just working on trying to get office to install with the OS...
    Any advice would be greatly appreciated...
    Thanks...

    Just realized that you said the following:
    The packages just get copied to the HD.
    It sounds like you've made a installer package that's installing the installer packages.
    If you simply double click the package you've created and install it, does it do the same thing? If so, then that's what you've done.

  • System image utility, netinstallation size question

    Just got an Xserver for the office, and we've had success imaging a few mac mini computers. My question is, does the system imaging utility compress the netinstall image? We have several labs
    (20+ Mac's) in several configurations i.e new and old Mac Pro's/G5/G4, new and old iMac's/eMac's. Our range of Mac's are broad, and i'd like to create image's for each department that needs them. Mass Communications, Visual Arts, and Performing Arts. All will have different software needs. Should i create a base image, and then push out applications with ARD? The image that i recently made of an iMac has MS office 2008, Logic Studio, and Adobe CS3 it was nearly 70GB's. I was banking on maybe 8 - 10GB's, or at least some kind of compression. Yes, i've read about NetRestore, but like others, i'd rather stick with Apple Software.
    Most of the main labs on campus has newer Mac's, and honestly i could care less about the eMac's and G4's; they're on the list to retire anyway. My main concern is the ability to create and deploy a custom image for the latest Mac Pro's and iMac's.
    Thanks,
    Patrick

    I gather you are making NetInstall from volume images. Looking at one of mine, I see that asr image is 3.47 GB, while the mounted image is 7.55 GB. So, yes, in this scenario the image is compressed.
    70 GB seems rather large... especially if it's compressed. I suppose it's possible that the items you note could add that much bulk, but that seems like a lot... Office is only about 846 MB on my system. You might want to check your source volume for large, unexpected, items like caches, databases, etc. and see where that bulk is coming from.

  • 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 1

    I 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 (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örn

    Hi 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 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)  

Maybe you are looking for

  • HT1338 Access app store on OS 10.5.5

    How can I access the Mac App store from OSX 10.5.8 (cannot upgrade further on this computer) to re-download purchased software?

  • Send ACC_GL_POSTING01 idocs to another system?

    Hi all, i need to send G/L account postings  transaction <b>F-02</b> from one R/3 ro another as soon as the documents is posted or manually distribute through a program. suppose a FI document is posted in source R/3 in <b>company code '<u>18</u>0'  a

  • Query for Finished Product in Production

    Dear All I require a query for  Finished Product in Production.  Product       Opening Balance                 Receipt                  Issued Quantity                  Closing Balance Can anyone help me on this?? Thanks, Pratap

  • Only 1 of 99 pics sync up to my iPhone 4S...why?

    Only 1 of 99 pictures in a particular event are syncing over to my iPhone 4S...why?

  • IMSL C library causes JVM crash through JNI in GC with JDK 1.6

    Hi Java friends, We use the IMSL C library (made by Visual Numerics) via JNI which picks up a C++ so on Linux. Under JDK 1.5 it works fine. Under 1.6 it crashes in the GC. I put together a very simple testcase that just calls the IMSL error options f