-
-
Save ghorbanzade/c1b60adab05df362bde4495f73ff4c06 to your computer and use it in GitHub Desktop.
Script to Convert OSX app Image to Bootable iso
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 | |
# tested for Yosemite, ElCapitan and Sierra | |
print_usage () { | |
echo "usage: ${0} path_to_app" | |
exit -1; | |
} | |
if [ $# -ne 1 ]; then | |
echo "error: argument missing" | |
print_usage | |
fi | |
if [ ! -f "${1}/Contents/SharedSupport/InstallESD.dmg" ]; then | |
echo "error: expect command line argument to be path to osx .app directory" | |
print_usage | |
fi | |
APP_NICK="$(basename "${1}")"; | |
hdiutil attach "${1}/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint /Volumes/install_app | |
hdiutil create -o "/tmp/${APP_NICK}.cdr" -size 7316m -layout SPUD -fs HFS+J | |
hdiutil attach "/tmp/${APP_NICK}.cdr.dmg" -noverify -nobrowse -mountpoint /Volumes/install_build | |
asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase | |
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages | |
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/ | |
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist | |
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg | |
hdiutil detach /Volumes/install_app | |
hdiutil detach /Volumes/OS\ X\ Base\ System/ | |
hdiutil convert "/tmp/${APP_NICK}.cdr.dmg" -format UDTO -o "/tmp/${APP_NICK}.iso" | |
mv "/tmp/${APP_NICK}.iso.cdr" "~/Desktop/${APP_NICK}.iso" | |
rm "/tmp/${APP_NICK}.cdr.dmg" | |
DST="~/Desktop/${APP_NICK}.iso" | |
if [ -f ${DST} ]; then | |
echo "${DST}" | |
exit 0 | |
fi | |
exit -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment