#!/bin/zsh export tmp='/Volumes/disk01/tmp' # hdiutil attach InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o $tmp/Installer hdiutil resize -size 8g $tmp/Installer.sparseimage hdiutil attach $tmp/Installer.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build rm -r /Volumes/install_build/System/Installation/Packages cp -av /Volumes/install_app/Packages /Volumes/install_build/System/Installation/ cp -av /Volumes/install_app/BaseSystem.chunklist /Volumes/install_build cp -av /Volumes/install_app/BaseSystem.dmg /Volumes/install_build hdiutil detach /Volumes/install_app hdiutil detach /Volumes/install_build hdiutil resize -size `hdiutil resize -limits $tmp/Installer.sparseimage | tail -n 1 | awk '{print $ 1}' `b $tmp/Installer.sparseimage hdiutil convert $tmp/Installer.sparseimage -format UDZO -o $tmp/Installer mv $tmp/Installer.dmg /Volumes/disk01/macos