Quad5Ny

Yosemite App to ISO Bash Script (for VirtualBox)

Jul 19th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Mount the installer image
  4. hdiutil attach /Applications/Install\ OS\ X\ Yosemite.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
  5.  
  6. # Convert the boot image to a sparse bundle
  7. hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite
  8.  
  9. # Increase the sparse bundle capacity to accommodate the packages
  10. hdiutil resize -size 8g /tmp/Yosemite.sparseimage
  11.  
  12. # Mount the sparse bundle for package addition
  13. hdiutil attach /tmp/Yosemite.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
  14.  
  15. # Remove Package link and replace with actual fileS
  16. rm /Volumes/install_build/System/Installation/Packages
  17. cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/
  18.  
  19. # Copy Base System
  20. cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/install_build/
  21. cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/install_build/
  22.  
  23. # Unmount the installer image
  24. hdiutil detach /Volumes/install_app
  25.  
  26. # Unmount the sparse bundle
  27. hdiutil detach /Volumes/install_build
  28.  
  29. # Resize the partition in the sparse bundle to remove any free space
  30. hdiutil resize -size `hdiutil resize -limits /tmp/Yosemite.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Yosemite.sparseimage
  31.  
  32. # Convert the sparse bundle to ISO/CD master
  33. hdiutil convert /tmp/Yosemite.sparseimage -format UDTO -o /tmp/Yosemite
  34.  
  35. # Remove the sparse bundle
  36. rm /tmp/Yosemite.sparseimage
  37.  
  38. # Rename the ISO and move it to the desktop
  39. mv /tmp/Yosemite.cdr ~/Desktop/Yosemite.iso
Advertisement
Add Comment
Please, Sign In to add comment