Guest User

script Catalina create iso

a guest
Oct 21st, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. #!/bin/sh
  2. # macOS Catalina ISO creator
  3. #
  4. # Author: https://github.com/thelamehacker
  5. #
  6. # License: GNU General Public License v3.0
  7. # Release date: 28 September 2018
  8. # Last updated: 24 October 2018
  9. # Version: 0.2
  10. # -----------------------------------------------------------------------------
  11.  
  12. formattedPrint() {
  13. echo
  14. echo "$@"
  15. echo
  16. }
  17.  
  18. checkAdmin() {
  19.  
  20. # Checking if the user has administrative rights
  21. if groups $USER | grep -q -w admin
  22. then
  23. makeISO
  24. else
  25. formattedPrint "User '$USER' doesn't seem to be an administrator! Please run this script with administrator rights."
  26. fi
  27.  
  28. }
  29.  
  30. makeISO() {
  31. # Creating a temporary disk image of 6 GB space in /tmp/ and mounting it
  32. # File system has been set to HFS+ Journaled for maximum compatibility.
  33. # This can be set to APFS on newer systems, or you can convert your file system to APFS post installation.
  34.  
  35. formattedPrint "Creating and mounting a disk image..."
  36.  
  37. hdiutil create -o /tmp/Catalina.cdr -size 6g -layout SPUD -fs HFS+J
  38. hdiutil attach /tmp/Catalina.cdr.dmg -noverify -mountpoint /Volumes/install_build
  39.  
  40. formattedPrint "Copying downloaded files to our disk image and moving it to the Desktop..."
  41.  
  42. # This is where sudo makes us a sandwich and we need those pesky administrative rights.
  43.  
  44. sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
  45. mv /tmp/Catalina.cdr.dmg ~/Desktop/InstallSystem.dmg
  46. hdiutil detach /Volumes/Install\ macOS\ Catalina
  47.  
  48. formattedPrint "Converting the disk image to an ISO file and cleaning up..."
  49.  
  50. hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/Catalina.iso
  51. mv ~/Desktop/Catalina.iso.cdr ~/Desktop/Catalina.iso
  52. rm ~/Desktop/InstallSystem.dmg
  53.  
  54. formattedPrint "All done! You should have Catalina.iso on $USER's Desktop now."
  55. }
  56.  
  57. formattedPrint "Welcome to macOS Catalina ISO creator tool"
  58.  
  59. # Prompting user to download the installer from app store if not done already
  60.  
  61. while true; do
  62. read -p "Have you downloaded the macOS Catalina installer from app store? " yn
  63. case $yn in
  64. [Yy]* ) checkAdmin; break;;
  65. [Nn]* ) echo "Please download macOS Catalina installer from app store and re-run this script. Goodbye."; break;;
  66. * ) echo "Please answer yes or no.";;
  67. esac
  68. done
  69.  
Add Comment
Please, Sign In to add comment