Skip to content

Instantly share code, notes, and snippets.

@davidandreoletti
Created October 20, 2015 07:22
Show Gist options
  • Select an option

  • Save davidandreoletti/1b9afafd322463854d37 to your computer and use it in GitHub Desktop.

Select an option

Save davidandreoletti/1b9afafd322463854d37 to your computer and use it in GitHub Desktop.

Revisions

  1. @mzyy94 mzyy94 created this gist Oct 1, 2015.
    26 changes: 26 additions & 0 deletions create_install_iso.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/bin/sh

    INSTALLERIMG="/Applications/Install OS X El Capitan.app/Contents/SharedSupport/InstallESD.dmg"
    OUTDIR="/Users/$(whoami)/Desktop"
    FILENAME="Install OS X El Capitan"

    TMPIMG="/tmp/ElCapitan.sparseimage"
    SOURCEDISK="/Volumes/InstallESD"
    TARGETDISK="/Volumes/BaseSystem"

    set -x
    sudo -s
    hdiutil attach "${INSTALLERIMG}" -noverify -nobrowse -mountpoint "${SOURCEDISK}"
    hdiutil convert "${SOURCEDISK}/BaseSystem.dmg" -format UDSP -o "${TMPIMG}"
    hdiutil resize -size 8g "${TMPIMG}"
    hdiutil attach "${TMPIMG}" -noverify -nobrowse -mountpoint "${TARGETDISK}"
    rm "${TARGETDISK}/System/Installation/Packages"
    cp -rp "${SOURCEDISK}/Packages" "${TARGETDISK}/System/Installation/"
    cp -rp ${SOURCEDISK}/BaseSystem* "${TARGETDISK}/"
    cp -rp /System/Library/Kernels "${TARGETDISK}/System/Library/"
    hdiutil detach "${SOURCEDISK}"
    hdiutil detach "${TARGETDISK}"
    hdiutil resize -size min "${TMPIMG}"
    hdiutil convert "${TMPIMG}" -format UDTO -o "${OUTDIR}/${FILENAME}.cdr"
    mv "${OUTDIR}/${FILENAME}.cdr" "${OUTDIR}/${FILENAME}.iso"
    rm "${TMPIMG}"