(self)
| 62 | return unmounted |
| 63 | |
| 64 | def main(self): |
| 65 | while True: |
| 66 | self.u.head() |
| 67 | print("") |
| 68 | print("Q. Quit") |
| 69 | print("") |
| 70 | fold = self.u.grab("Please drag and drop the output folder from gibMacOS here: ") |
| 71 | print("") |
| 72 | if fold.lower() == "q": |
| 73 | self.u.custom_quit() |
| 74 | f_path = self.u.check_path(fold) |
| 75 | if not f_path: |
| 76 | print("That path does not exist!\n") |
| 77 | self.u.grab("Press [enter] to return...") |
| 78 | continue |
| 79 | # Let's check if it's a folder. If not, make the next directory up the target |
| 80 | if not os.path.isdir(f_path): |
| 81 | f_path = os.path.dirname(os.path.realpath(f_path)) |
| 82 | # Walk the contents of f_path and ensure we have all the needed files |
| 83 | lower_contents = [y.lower() for y in os.listdir(f_path)] |
| 84 | # Check if we got an InstallAssistant.pkg - and if so, just open that |
| 85 | if "installassistant.pkg" in lower_contents: |
| 86 | self.u.head("InstallAssistant.pkg Found") |
| 87 | print("") |
| 88 | print("Located InstallAssistant.pkg in the passed folder.\n") |
| 89 | print("As of macOS Big Sur (11.x), Apple changed how they distribute the OS files in") |
| 90 | print("the software update catalog.\n") |
| 91 | print("Double clicking the InstallAssistant.pkg will open it in Installer, which will") |
| 92 | print("copy the Install macOS [version].app to your /Applications folder.\n") |
| 93 | print("Opening InstallAssistant.pkg...") |
| 94 | self.r.run({"args":["open",os.path.join(f_path,"InstallAssistant.pkg")]}) |
| 95 | print("") |
| 96 | self.u.grab("Press [enter] to return...") |
| 97 | continue |
| 98 | missing_list = [x for x in self.target_files if not x.lower() in lower_contents] |
| 99 | if len(missing_list): |
| 100 | self.u.head("Missing Required Files") |
| 101 | print("") |
| 102 | print("That folder is missing the following required files:") |
| 103 | print(", ".join(missing_list)) |
| 104 | print("") |
| 105 | self.u.grab("Press [enter] to return...") |
| 106 | # Time to build the installer! |
| 107 | cwd = os.getcwd() |
| 108 | os.chdir(f_path) |
| 109 | base_mounts = [] |
| 110 | try: |
| 111 | self.u.head("Building Installer") |
| 112 | print("") |
| 113 | print("Taking ownership of downloaded files...") |
| 114 | for x in self.target_files: |
| 115 | print(" - {}...".format(x)) |
| 116 | self.r.run({"args":["chmod","a+x",x]}) |
| 117 | print("Mounting BaseSystem.dmg...") |
| 118 | base_mounts = self.mount_dmg("BaseSystem.dmg") |
| 119 | if not len(base_mounts): |
| 120 | raise Exception("Mount Failed!", "No mount points were returned from BaseSystem.dmg") |
| 121 | base_mount = base_mounts[0] # Let's assume the first |
no test coverage detected