Skip to content

Instantly share code, notes, and snippets.

@MXP2095onetechguy
Forked from c0d3d-net/mavericks-iso.sh
Last active December 31, 2021 15:00
Show Gist options
  • Select an option

  • Save MXP2095onetechguy/cfe9c91f15a59932a0774af84eb0777c to your computer and use it in GitHub Desktop.

Select an option

Save MXP2095onetechguy/cfe9c91f15a59932a0774af84eb0777c to your computer and use it in GitHub Desktop.
Create a bootable ISO from the OS X Mavericks app
#!/bin/sh
# Better Mavericks ISO
# Tool that generates mavericks iso file
#
# Improved version of https://gist.github.com/MXP2095onetechguy/cfe9c91f15a59932a0774af84eb0777c
# MXPSQL wrote this fork on the last day of 2021
# Use temp to do it
# Create a bootable ISO from the OS X Mavericks app
# http://thezinx.com/misc/trend/create-bootable-dmg-iso-mavericks-app/
# Hi
echo "Better Mavericks ISO Generator"
# Init arguments
APPLoc="./Mavericks.app/Contents/SharedSupport/InstallESD.dmg" #
TmpVolume=/Volumes/`tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo ''`_install_app # volume mount location
TmpBuild=/Volumes/`tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo ''`_install_build # sparse bundle package adition location
TmpSIMg_NOEXT=`mktemp -u` # sparse image location
TmpCdr_NOEXT=`mktemp -u` # cdr image location
FinalISO=`echo ~/Desktop/Mavericks.iso` # location of the final build
# Parse args
for i in "$@"; do
case $i in
--TempBuild=*)
TmpBuild="${i#*=}"
shift
;;
--TempVol=*)
TmpVolume="${i#*=}"
shift
;;
--TempSparseImage=*)
TmpSImg_NOEXT="${i#*=}"
shift
;;
--TempCDR=*)
TmpCdr_NOEXT="${i#*=}"
shift
;;
-o=*|--output=*|--final-build=*)
FinalISO="${i#*=}"
shift
;;
-h|--help)
echo "Open this script and take a look at the variables"
exit 0;
;;
-*|--*)
;;
*)
;;
esac
done
# Initialize other variables, examples are dependent variables
TmpSImg=`echo $TmpSImg_NOEXT`.sparseimage # $TmpSImg_NOEXT, but with file extension
TmpCdr=`echo $TmpCdr_NOEXT`.cdr # $TmpCdr_NOEXT, but with file extension
# Mavericks app check
if [ ! -f /Applications/Install\ OS\ X\ `echo $APPLoc` ]; then
echo "Download the OS X Mavericks App and then rerun this script."
open "https://itunes.apple.com/us/app/os-x-mavericks/id675248567"
exit 1
fi
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ `echo $APPLoc` -noverify -nobrowse -mountpoint $TmpVolume
# Convert the boot image to a sparse bundle
hdiutil convert $TmpVolume/BaseSystem.dmg -format UDSP -o $TmpSImg_NOEXT
# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g $TmpSimg
# Mount the sparse bundle for package addition
hdiutil attach $TmpSimg -noverify -nobrowse -mountpoint $TmpBuild
# Remove Package link and replace with actual files
rm -v $TmpBuild/System/Installation/Packages
cp -rpv $TmpVolume/Packages $TmpBuild/System/Installation/
# Unmount the installer image
hdiutil detach $TmpVolume
# Unmount the sparse bundle
hdiutil detach $TmpBuild
# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits $TmpSimg | tail -n 1 | awk '{ print $1 }'`b $TmpSimg
# Convert the sparse bundle to ISO/CD master
hdiutil convert $TmpSimg -format UDTO -o $TmpCdr_NOEXT
# Remove the sparse bundle
rm $TmpSimg
# Rename the ISO and move it to the desktop
mv -v $TmpCdr $FinalISO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment