Created
June 24, 2020 08:04
-
-
Save jbanety/dffc99ae0566f8ada231c8104ac56cc0 to your computer and use it in GitHub Desktop.
Create a Sierra bootable USB Stick without createinstallmedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
VOLUME_NAME=CLEF | |
DMG_PATH=/Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg | |
hdiutil attach ${DMG_PATH} -noverify -nobrowse -mountpoint /Volumes/install_app | |
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Sierra | |
hdiutil resize -size 8g /tmp/Sierra.sparseimage | |
hdiutil attach /tmp/Sierra.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build | |
rm /Volumes/install_build/System/Installation/Packages | |
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/ | |
cp /Volumes/install_app/BaseSystem.chunklist /Volumes/install_build | |
cp /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/Sierra.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Sierra.sparseimage | |
hdiutil convert /tmp/Sierra.sparseimage -format UDZO -o /tmp/Sierra | |
rm /tmp/Sierra.sparseimage | |
mv /tmp/Sierra.dmg ~/Desktop | |
sudo asr restore --source ~/Desktop/Sierra.dmg --target /Volumes/${VOLUME_NAME} --noprompt --noverify --erase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment