if [ "$1" == "fix" ] then diskutil eraseVolume exFAT ILOVEJPOP /Volumes/ILOVEJPOP diskutil eraseVolume JHFS+ ILOVEJPOP /Volumes/ILOVEJPOP echo "Fixed?" exit 0 fi mkdir .tmp printf "10.13.6" > .tmp/'High Sierra' printf "10.14.6" > .tmp/'Mojave' printf "10.15.7" > .tmp/'Catalina' printf "11.7.1" > .tmp/'Big Sur' printf "12.7.5" > .tmp/'Monterey' printf "13.6.7" > .tmp/'Ventura' printf "14.5" > .tmp/'Sonoma' # This should be a function. tmp=`cat ".tmp/$1"` if ! /Applications/"Install macOS $1.app"/Contents/Resources/createinstallmedia --nointeraction --volume /Volumes/"ILOVEJPOP" then if ! softwareupdate --fetch-full-installer --full-installer-version "$tmp" then echo "Script failed, unable to fetch that installer."; rm -rf .tmp; exit 1; fi if ! /Applications/"Install macOS $1.app"/Contents/Resources/createinstallmedia --nointeraction --volume /Volumes/"ILOVEJPOP" then echo "Script failed, unable to fetch that installer."; rm -rf .tmp; exit 1; fi fi rm -rf .tmp SIZ=`diskutil resizeVolume /Volumes/"Install macOS $1/" limits | grep Minimum | grep -Eo '[0-9]+' | tail -1` echo "Variable SIZ is $SIZ." SIZ=$((SIZ + SIZ/10)) echo "Variable SIZ is $SIZ." diskutil resizeVolume /Volumes/"Install macOS $1/" "$SIZ" JHFS+ ILOVEJPOP 100M # Change to something better than 1GB later. echo "Attempting resize." if ! diskutil resizeVolume /Volumes/ILOVEJPOP R then diskutil eraseVolume exFAT /Volumes/ILOVEJPOP diskutil eraseVolume JHFS+ /Volumes/ILOVEJPOP diskutil resizeVolume /Volumes/ILOVEJPOP R echo "SCRIPT CHOKED, ATTEMPTED SELF-REPAIR. If this didn't fix it, try executing \`./, fix\`. If that fails, ask Sterling." fi #This should be cleaned up. printf '\n\nAll done, it looks like you have ~' TMP=`diskutil list /Volumes/ILOVEJPOP | tail -1 | grep -Eo [0-9]+ | head -2 | tail -1` printf "$TMP" printf 'GB of space remaining on this drive.\n' # This should be cleaned up.