diff options
author | Nikias Bassen | 2019-06-18 18:16:40 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-06-18 18:16:40 +0200 |
commit | 35a7a8740c4109fc83ef64199d075129a6f4da6d (patch) | |
tree | f005fafc31e2a5751c3e16e1468886dde7375d36 /src/idevicerestore.c | |
parent | e0cef46e9c0fe6f4d45ac19a2ddaa74a33a5570e (diff) | |
download | idevicerestore-35a7a8740c4109fc83ef64199d075129a6f4da6d.tar.gz idevicerestore-35a7a8740c4109fc83ef64199d075129a6f4da6d.tar.bz2 |
Add warning with confirmation prompt when performing an erase restore in interactive mode
Diffstat (limited to 'src/idevicerestore.c')
-rw-r--r-- | src/idevicerestore.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index ca6f232..1918987 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -672,6 +672,30 @@ int idevicerestore_start(struct idevicerestore_client_t* client) /* print information about current build identity */ build_identity_print_information(build_identity); + if (client->flags & FLAG_ERASE && client->flags & FLAG_INTERACTIVE) { + char input[64]; + printf("################################ [ WARNING ] #################################\n" + "# You are about to perform an *ERASE* restore. ALL DATA on the target device #\n" + "# will be IRREVERSIBLY DESTROYED. If you want to update your device without #\n" + "# erasing the user data, hit CTRL+C now and restart without -e or --erase #\n" + "# command line switch. #\n" + "# If you want to continue with the ERASE, please type YES and press ENTER. #\n" + "##############################################################################\n"); + while (1) { + printf("> "); + fflush(stdout); + fflush(stdin); + input[0] = '\0'; + get_user_input(input, 63, 0); + if (*input != '\0' && !strcmp(input, "YES")) { + break; + } else { + printf("Invalid input. Please type YES or hit CTRL+C to abort.\n"); + continue; + } + } + } + idevicerestore_progress(client, RESTORE_STEP_PREPARE, 0.0); /* check if all components we need are actually there */ @@ -1944,7 +1968,7 @@ void build_identity_print_information(plist_t build_identity) { info("This restore will erase your device data.\n"); if (!strcmp(value, "Update")) - info("This restore will update your device without losing data.\n"); + info("This restore will update your device without erasing user data.\n"); free(value); |