From 17c80a650f963be7842ef15d83e93286a0129f7a Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 26 Oct 2021 14:48:10 +0200 Subject: Add command line option to continue despite certain errors (e.g. baseband update failure) --- src/idevicerestore.c | 9 +++++++++ src/idevicerestore.h | 1 + src/restore.c | 4 ++++ 3 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 615aa0f..3892c73 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -86,6 +86,7 @@ static struct option longopts[] = { { "no-restore", no_argument, NULL, 'z' }, { "version", no_argument, NULL, 'v' }, { "ipsw-info", no_argument, NULL, 'I' }, + { "ignore-errors", no_argument, NULL, 1 }, { NULL, 0, NULL, 0 } }; @@ -139,6 +140,10 @@ static void usage(int argc, char* argv[], int err) " -P, --plain-progress Print progress as plain step and progress\n" \ " -R, --restore-mode Allow restoring from Restore mode\n" \ " -T, --ticket PATH Use file at PATH to send as AP ticket\n" \ + " --ignore-errors Try to continue the restore process after certain\n" \ + " errors (like a failed baseband update)\n" \ + " WARNING: This might render the device unable to boot\n" \ + " or only partially functioning. Use with caution.\n" \ "\n" \ "Homepage: <" PACKAGE_URL ">\n" \ "Bug Reports: <" PACKAGE_BUGREPORT ">\n", @@ -1713,6 +1718,10 @@ int main(int argc, char* argv[]) { ipsw_info = 1; break; + case 1: + client->flags |= FLAG_IGNORE_ERRORS; + break; + default: usage(argc, argv, 1); return EXIT_FAILURE; diff --git a/src/idevicerestore.h b/src/idevicerestore.h index a7f3609..0d90108 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -45,6 +45,7 @@ extern "C" { #define FLAG_INTERACTIVE (1 << 9) #define FLAG_ALLOW_RESTORE_MODE (1 << 10) #define FLAG_NO_RESTORE (1 << 11) +#define FLAG_IGNORE_ERRORS (1 << 12) struct idevicerestore_client_t; diff --git a/src/restore.c b/src/restore.c index 47c93dd..d26f398 100644 --- a/src/restore.c +++ b/src/restore.c @@ -3692,6 +3692,10 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit // this is the restore process loop, it reads each message in from // restored and passes that data on to it's specific handler while (!(client->flags & FLAG_QUIT)) { + if (client->flags & FLAG_IGNORE_ERRORS) { + error("WARNING: Attempting to continue after critical error, restore might fail...\n"); + err = 0; + } // finally, if any of these message handlers returned -1 then we encountered // an unrecoverable error, so we need to bail. if (err < 0) { -- cgit v1.1-32-gdbae