Skip to content

Instantly share code, notes, and snippets.

@MagerValp
Last active April 2, 2016 06:02
Show Gist options
  • Save MagerValp/7272658 to your computer and use it in GitHub Desktop.
Save MagerValp/7272658 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
REPO_PATH="/Volumes/Big HD/PackageRepo"
package_list="$1"
output_dmg="$2"
hdiutil attach -noverify -mountpoint /tmp/installesd /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg
hdiutil create -size 32g -type SPARSE -fs HFS+J -volname "Macintosh HD" -uid 0 -gid 80 -mode 1775 /tmp/output.sparseimage
hdiutil attach -noverify -mountpoint /tmp/os -owners on /tmp/output.sparseimage
installer -pkg /tmp/installesd/Packages/OSInstall.mpkg -target /tmp/os
while read -r pkg; do
installer -pkg "$REPO_PATH/$pkg" -target /tmp/os
done < "$package_list"
hdiutil detach /tmp/os
hdiutil detach /tmp/installesd
hdiutil convert -format UDZO /tmp/output.sparseimage -o "$output_dmg" && rm /tmp/output.sparseimage
asr imagescan --source /tmp/"$output_dmg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment