From d1cb6bfef6ac8fb08472ac5f1fac93895084371c Mon Sep 17 00:00:00 2001 From: Rick Mark Date: Tue, 21 Apr 2020 02:35:25 +0200 Subject: Support stopping at restore mode --- src/idevicerestore.c | 12 +++++++++++- src/idevicerestore.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 100d945..f1a7a56 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -76,6 +76,7 @@ static struct option longopts[] = { { "plain-progress", no_argument, NULL, 'P' }, { "restore-mode", no_argument, NULL, 'R' }, { "ticket", required_argument, NULL, 'T' }, + { "no-restore", no_argument, NULL, 'z' }, { NULL, 0, NULL, 0 } }; @@ -118,6 +119,7 @@ static void usage(int argc, char* argv[], int err) " -s, --cydia Use Cydia's signature service instead of Apple's\n" \ " -x, --exclude Exclude nor/baseband upgrade\n" \ " -t, --shsh Fetch TSS record and save to .shsh file, then exit\n" \ + " -z, --no-restore Do not restore and end after booting to the ramdisk\n" \ " -k, --keep-pers Write personalized components to files for debugging\n" \ " -p, --pwn Put device in pwned DFU mode and exit (limera1n devices only)\n" \ " -P, --plain-progress Print progress as plain step and progress\n" \ @@ -1332,6 +1334,10 @@ int idevicerestore_start(struct idevicerestore_client_t* client) // device is finally in restore mode, let's do this if (client->mode->index == MODE_RESTORE) { + if ((client->flags & FLAG_NO_RESTORE) != 0) { + info("Device is now in restore mode. Exiting as requested."); + return 0; + } client->ignore_device_add_events = 1; info("About to restore device... \n"); result = restore_device(client, build_identity, filesystem); @@ -1553,7 +1559,7 @@ int main(int argc, char* argv[]) { client->flags |= FLAG_INTERACTIVE; } - while ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyPRT:", longopts, &optindex)) > 0) { + while ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyPRT:z", longopts, &optindex)) > 0) { switch (opt) { case 'h': usage(argc, argv, 0); @@ -1638,6 +1644,10 @@ int main(int argc, char* argv[]) { client->flags |= FLAG_ALLOW_RESTORE_MODE; break; + case 'z': + client->flags |= FLAG_NO_RESTORE; + break; + case 'T': { size_t root_ticket_len = 0; unsigned char* root_ticket = NULL; diff --git a/src/idevicerestore.h b/src/idevicerestore.h index f6b1cb0..d8e3440 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -44,6 +44,7 @@ extern "C" { #define FLAG_LATEST (1 << 8) #define FLAG_INTERACTIVE (1 << 9) #define FLAG_ALLOW_RESTORE_MODE (1 << 10) +#define FLAG_NO_RESTORE (1 << 11) struct idevicerestore_client_t; -- cgit v1.1-32-gdbae