├── .gitignore ├── README.md ├── PackAppWin.py └── PackAppMacOS.py /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MakeInstallmacOS 2 | 3 | This tool needs to be used with downloaded FULL INSTALLER from [gibMacOS](https://github.com/corpnewt/gibMacOS) \(from [CorpNewt](https://github.com/corpnewt)\) 4 | 5 | ## Functions 6 | 7 | - Pack files to SharedSupport for converting Internet Recovery Installer to a Full Installer 8 | - Pack files to a full Install macOS Application \(Only in macOS\) 9 | 10 | ## Requirements 11 | 12 | - [Python 3.4](https://www.python.org/downloads/) or above \(Recommended **Python 3.7**\) 13 | - Downloaded macOS Installer files from [gibMacOS](https://github.com/corpnewt/gibMacOS) 14 | -------------------------------------------------------------------------------- /PackAppWin.py: -------------------------------------------------------------------------------- 1 | import os, shutil, plistlib, time, sys 2 | 3 | line = "--------------------------------------------------" 4 | 5 | def quit(): 6 | print("Goodbye! Have a good day!") 7 | os.system("pause") 8 | sys.exit() 9 | 10 | def noline(string): 11 | print(string,end="") 12 | 13 | def title(string): 14 | print(line) 15 | print("{:^50}".format(string)) 16 | print(line) 17 | 18 | def isfile(string): 19 | return os.path.isfile(string) 20 | 21 | def clear(): 22 | os.system("cls") 23 | 24 | def copyfiles(sharedsupportloc): 25 | for f in neededfiles: 26 | noline(" Copying {}... ".format(f)) 27 | 28 | shutil.copy(f, sharedsupportloc) 29 | print("Done.") 30 | 31 | def checkfiles(): 32 | clear() 33 | title("Checking Required Files...") 34 | time.sleep(0.5) 35 | for f in neededfiles: 36 | if isfile(f) == False: 37 | print("Missing Files.") 38 | os.system("pause") 39 | sys.exit() 40 | print ("Done.") 41 | time.sleep(1) 42 | 43 | neededfiles = [r"./AppleDiagnostics.chunklist", r"./AppleDiagnostics.dmg", r"./BaseSystem.chunklist", r"./BaseSystem.dmg", r"./InstallESDDmg.pkg", r"./InstallInfo.plist"] 44 | 45 | def editplist(): 46 | fp = open(r"./InstallInfo.plist","rb") 47 | installinfo = plistlib.load(fp) 48 | del installinfo["Payload Image Info"]["chunklistURL"] 49 | del installinfo["Payload Image Info"]["chunklistid"] 50 | installinfo["Payload Image Info"]["URL"] = "InstallESD.dmg" 51 | installinfo["Payload Image Info"]["id"] = "com.apple.dmg.InstallESD" 52 | plistlib.dump(installinfo, open(r"./InstallInfo.plist", "wb")) 53 | 54 | def SharedSupport(): 55 | clear() 56 | 57 | title("Packing files to SharedSupport") 58 | 59 | noline("Making Directories... ") 60 | os.mkdir("SharedSupport") 61 | print("Done.") 62 | 63 | print("Copying files... ") 64 | copyfiles(r"./SharedSupport") 65 | print("Done.") 66 | 67 | noline("Editting InstallInfor.plist... ") 68 | os.chdir(r"./SharedSupport") 69 | editplist() 70 | os.rename("InstallESDDmg.pkg", "InstallESD.dmg") 71 | print("Done") 72 | 73 | print("All Done.") 74 | time.sleep(1) 75 | 76 | mainmenu() 77 | 78 | def mainmenu(): 79 | clear() 80 | title("Main Menu") 81 | print("P: Pack files for convert the current Network Recovery Installer to a Full Installer (SharedSupport)") 82 | print("Q: Quit") 83 | option = input("Enter an option: ") 84 | if option == "Q" or option == "q": 85 | quit() 86 | elif option == "P" or option == "p": 87 | SharedSupport() 88 | else: 89 | mainmenu() 90 | 91 | def main(): 92 | os.chdir(os.path.dirname(os.path.realpath(__file__))) 93 | checkfiles() 94 | mainmenu() 95 | 96 | if __name__ == "__main__": 97 | main() 98 | 99 | os.system("pause") 100 | -------------------------------------------------------------------------------- /PackAppMacOS.py: -------------------------------------------------------------------------------- 1 | import os, shutil, plistlib, time, sys 2 | 3 | line = "--------------------------------------------------" 4 | loc = "" 5 | 6 | def noline(string): 7 | print(string,end="") 8 | 9 | def title(string): 10 | print(line) 11 | print("{:^50}".format(string)) 12 | print(line) 13 | 14 | def isfile(string): 15 | return os.path.isfile(string) 16 | 17 | def clear(): 18 | os.system("clear") 19 | 20 | neededfiles = [r"./AppleDiagnostics.chunklist", r"./AppleDiagnostics.dmg", r"./BaseSystem.chunklist", r"./BaseSystem.dmg", r"./InstallESDDmg.pkg", r"./InstallInfo.plist"] 21 | 22 | def copyfiles(sharedsupportloc): 23 | for f in neededfiles: 24 | noline(" Copying {}... ".format(f)) 25 | shutil.copy(f, sharedsupportloc) 26 | print("Done.") 27 | 28 | def editplist(): 29 | fp = open(r"./InstallInfo.plist","rb") 30 | installinfo = plistlib.load(fp) 31 | del installinfo["Payload Image Info"]["chunklistURL"] 32 | del installinfo["Payload Image Info"]["chunklistid"] 33 | installinfo["Payload Image Info"]["URL"] = "InstallESD.dmg" 34 | installinfo["Payload Image Info"]["id"] = "com.apple.dmg.InstallESD" 35 | plistlib.dump(installinfo, open(r"./InstallInfo.plist", "wb")) 36 | 37 | def packapp(): 38 | 39 | clear() 40 | ### Here we choose our macOS Version 41 | title("Choose macOS Version") 42 | print("1: High Sierra") 43 | print("2: Mojave") 44 | print("Q: Quit") 45 | print("M: Main Menu") 46 | option = input("Please enter an option: ") 47 | version = "" 48 | diskname = "" 49 | if option == "1": 50 | version = "High Sierra" 51 | diskname = "'OS X Base System'" 52 | elif option == "2": 53 | version = "Mojave" 54 | diskname = "'macOS Base System'" 55 | elif option == "Q": 56 | quit() 57 | elif option == "M": 58 | mainmenu() 59 | else: 60 | packapp() 61 | 62 | clear() 63 | sharedsupportloc = r"./Install macOS {}.app/Contents/SharedSupport".format(version) 64 | 65 | title("Packing Files to Application") 66 | 67 | # We need to grab the base of the App out 68 | # from BaseSystem.dmg 69 | 70 | noline("Mounting BaseSystem.dmg... ") 71 | os.system("hdiutil attach ./BaseSystem.dmg > /dev/null") 72 | print("Done.") 73 | 74 | noline("Copying Installer from BaseSystem.dmg... ") 75 | os.system("cp -Rf /Volumes/{}/'Install macOS {}.app' ./'Install macOS {}.app'".format(diskname, version, version)) 76 | print("Done.") 77 | 78 | noline("Unmounting BaseSystem.dmg... ") 79 | os.system("umount /Volumes/{}".format(diskname)) 80 | print("Done.") 81 | 82 | # We need to make a folder call 83 | # SharedSupport inside the App. 84 | # This is where we save our files. 85 | 86 | noline("Making Directories... ") 87 | os.makedirs(sharedsupportloc) 88 | print("Done.") 89 | 90 | print("Copying Files...") 91 | copyfiles(sharedsupportloc) 92 | print("Done.") 93 | 94 | # We need to edit the InstallInfo.plist 95 | # to make sure we matches the settings 96 | # we want. 97 | 98 | noline("Editting InstallInfo.plist... ") 99 | os.chdir(sharedsupportloc) 100 | editplist() 101 | print("Done.") 102 | 103 | # We need to rename InstallESDDmg.pkg 104 | # to InstallESD.dmg to match the settings 105 | # in InstallInfo.plist 106 | 107 | noline("Renaming InstallESD.dmg... ") 108 | os.rename("InstallESDDmg.pkg", "InstallESD.dmg") 109 | print("Done.") 110 | 111 | print("All Done") 112 | time.sleep(1) 113 | 114 | mainmenu() 115 | 116 | 117 | def SharedSupport(): 118 | clear() 119 | 120 | title("Packing files to SharedSupport") 121 | 122 | noline("Making Directories... ") 123 | os.mkdir("SharedSupport") 124 | print("Done.") 125 | 126 | print("Copying files... ") 127 | copyfiles(r"./SharedSupport") 128 | print("Done.") 129 | 130 | noline("Editting InstallInfor.plist... ") 131 | os.chdir(r"./SharedSupport") 132 | editplist() 133 | os.rename("InstallESDDmg.pkg", "InstallESD.dmg") 134 | print("Done") 135 | 136 | print("All Done.") 137 | time.sleep(1) 138 | 139 | mainmenu() 140 | 141 | def checkfiles(): 142 | clear() 143 | title("Checking Required Files...") 144 | time.sleep(0.5) 145 | for f in neededfiles: 146 | if isfile(f) == False: 147 | print("Missing Files.") 148 | sys.exit() 149 | time.sleep(1) 150 | 151 | def quit(): 152 | print("Goodbye! Have a good day!") 153 | sys.exit() 154 | 155 | def mainmenu(): 156 | clear() 157 | title("Main Menu") 158 | print("A: Pack files to an Install macOS Application") 159 | print("B: Pack files to disk image (This will take a long time!)") 160 | print("P: Pack files for convert the current Network Recovery Installer to a Full Installer (SharedSupport)") 161 | print("Q: Quit") 162 | option = input("Enter an option: ") 163 | if option == "Q" or option == "q": 164 | quit() 165 | elif option == "A" or option == "a": 166 | packapp() 167 | elif option == "P" or option == "p": 168 | SharedSupport() 169 | else: 170 | mainmenu() 171 | 172 | def main(): 173 | os.chdir(os.path.dirname(os.path.realpath(__file__))) 174 | checkfiles() 175 | mainmenu() 176 | 177 | if __name__ == "__main__": 178 | main() 179 | --------------------------------------------------------------------------------