(self, disk, image, clover_version = None, local_file = None)
| 431 | shutil.rmtree(temp,ignore_errors=True) |
| 432 | |
| 433 | def dd_image(self, disk, image, clover_version = None, local_file = None): |
| 434 | # Let's dd the shit out of our disk |
| 435 | self.u.head("Copying Image To Drive") |
| 436 | print("") |
| 437 | print("Image: {}".format(image)) |
| 438 | print("") |
| 439 | print("Disk {}. {} - {} ({})".format( |
| 440 | disk.get("index",-1), |
| 441 | disk.get("model","Unknown"), |
| 442 | self.dl.get_size(disk.get("size",-1),strip_zeroes=True), |
| 443 | ["Unknown","No Root Dir","Removable","Local","Network","Disc","RAM Disk"][disk.get("type",0)] |
| 444 | )) |
| 445 | print("") |
| 446 | args = [ |
| 447 | os.path.join(self.s_path, self.dd_name), |
| 448 | "if={}".format(image), |
| 449 | "of=\\\\?\\Device\\Harddisk{}\\Partition2".format(disk.get("index",-1)), |
| 450 | "bs=8M", |
| 451 | "--progress" |
| 452 | ] |
| 453 | print(" ".join(args)) |
| 454 | print("") |
| 455 | print("This may take some time!") |
| 456 | print("") |
| 457 | out = self.r.run({"args":args}) |
| 458 | if len(out[1].split("Error")) > 1: |
| 459 | # We had some error text - dd, even when failing likes to give us a 0 |
| 460 | # status code. It also sends a ton of text through stderr - so we comb |
| 461 | # that for "Error" then split by that to skip the extra fluff and show only |
| 462 | # the error. |
| 463 | print("An error occurred:\n\n{}".format("Error"+out[1].split("Error")[1])) |
| 464 | print("") |
| 465 | self.u.grab("Press [enter] to return to the main menu...") |
| 466 | return |
| 467 | # Install Clover/OC to the target drive |
| 468 | if clover_version == "OpenCore": self.install_oc(disk, local_file=local_file) |
| 469 | else: self.install_clover(disk, clover_version, local_file=local_file) |
| 470 | |
| 471 | def install_oc(self, disk, local_file = None): |
| 472 | self.u.head("Installing OpenCore") |
no test coverage detected