From 38a3c0888a6d8ed0e401c83026af30199057873b Mon Sep 17 00:00:00 2001 From: "Liam(Cryptic)" Date: Mon, 1 Mar 2021 13:48:05 -0800 Subject: [PATCH] Fix no-baseband devices (#7) * patch * Fix devices without a baseband --- futurerestore/futurerestore.cpp | 13 ++++++++----- futurerestore/main.cpp | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index 160f7e39..f2c41fd4 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -1533,9 +1533,8 @@ void futurerestore::downloadLatestVeridian(){ void futurerestore::downloadLatestFirmwareComponents(){ info("Downloading the latest firmware components...\n"); - mkdir(FIRMWARES_TMP_PATH, 0755); + __mkdir(FIRMWARES_TMP_PATH, 0755); char zip_name[PATH_MAX]; - char *tmp = FIRMWARES_TMP_PATH; sprintf(zip_name, "%s/%s", FUTURERESTORE_TMP_PATH, "Firmwares.ipsw"); unlink(zip_name); downloadLatestRose(); @@ -1543,10 +1542,14 @@ void futurerestore::downloadLatestFirmwareComponents(){ downloadLatestSavage(); downloadLatestVeridian(); zip_directory(FIRMWARES_TMP_PATH, zip_name); + rmdir(FIRMWARES_TMP_PATH); //remove the dir if its empty so zip won't fail struct stat st{0}; - retassure(!stat(zip_name, &st), "could not zip Firmwares to ipsw\n"); - char *firmware_zip = zip_name; - _client->ipsw2 = strdup(firmware_zip); + if(!stat(FIRMWARES_TMP_PATH, &st)) + { + retassure(!stat(zip_name, &st), "could not zip Firmwares to ipsw\n"); + char *firmware_zip = zip_name; + _client->ipsw2 = strdup(firmware_zip); + } info("Finished downloading the latest firmware components!\n"); } diff --git a/futurerestore/main.cpp b/futurerestore/main.cpp index f26ae967..96906a88 100644 --- a/futurerestore/main.cpp +++ b/futurerestore/main.cpp @@ -255,9 +255,8 @@ int main_r(int argc, const char * argv[]) { versVals.basebandMode = kBasebandModeWithoutBaseband; if (!client.is32bit() && !(isSepManifestSigned = isManifestSignedForDevice(client.sepManifestPath(), &devVals, &versVals))){ - reterror("SEP firmware doesn't signed\n"); + reterror("SEP firmware is NOT being signed!\n"); } - client.downloadLatestFirmwareComponents(); if (flags & FLAG_NO_BASEBAND){ printf("\nWARNING: user specified is not to flash a baseband. This can make the restore fail if the device needs a baseband!\n"); printf("if you added this flag by mistake, you can press CTRL-C now to cancel\n"); @@ -284,10 +283,11 @@ int main_r(int argc, const char * argv[]) { printf("[WARNING] using tsschecker's fallback to get BasebandGoldCertID. This might result in invalid baseband signing status information\n"); } if (!(isBasebandSigned = isManifestSignedForDevice(client.basebandManifestPath(), &devVals, &versVals))) { - reterror("baseband firmware doesn't signed\n"); + reterror("baseband firmware is NOT being signed!\n"); } } } + client.downloadLatestFirmwareComponents(); client.putDeviceIntoRecovery(); if (flags & FLAG_WAIT){ client.waitForNonce();