diff options
| author | 2019-01-26 13:32:48 +0100 | |
|---|---|---|
| committer | 2019-01-26 13:32:48 +0100 | |
| commit | d200973897e281ba35d6c9c433e1355a49056da8 (patch) | |
| tree | b0f6bf94a899adcf278cee255d383b5870a3c5af /tools/idevicebackup2.c | |
| parent | 67e3373d2e4bd55795e62b2d51ab99aeddf2406c (diff) | |
| download | libimobiledevice-d200973897e281ba35d6c9c433e1355a49056da8.tar.gz libimobiledevice-d200973897e281ba35d6c9c433e1355a49056da8.tar.bz2 | |
idevicebackup2: Make reboot after restore the default
As seen in #726 the previous behavior results in wrong assumptions that a
restore is possible without rebooting the device, however this is not how
iOS is handling it.
I added a command line switch --no-reboot now that will let you still
restore without rebooting, if anyone wants to play around with that...
Diffstat (limited to 'tools/idevicebackup2.c')
| -rw-r--r-- | tools/idevicebackup2.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index c9eb9cb..1e6ddf7 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -82,7 +82,7 @@ enum cmd_mode { | |||
| 82 | 82 | ||
| 83 | enum cmd_flags { | 83 | enum cmd_flags { |
| 84 | CMD_FLAG_RESTORE_SYSTEM_FILES = (1 << 1), | 84 | CMD_FLAG_RESTORE_SYSTEM_FILES = (1 << 1), |
| 85 | CMD_FLAG_RESTORE_REBOOT = (1 << 2), | 85 | CMD_FLAG_RESTORE_NO_REBOOT = (1 << 2), |
| 86 | CMD_FLAG_RESTORE_COPY_BACKUP = (1 << 3), | 86 | CMD_FLAG_RESTORE_COPY_BACKUP = (1 << 3), |
| 87 | CMD_FLAG_RESTORE_SETTINGS = (1 << 4), | 87 | CMD_FLAG_RESTORE_SETTINGS = (1 << 4), |
| 88 | CMD_FLAG_RESTORE_REMOVE_ITEMS = (1 << 5), | 88 | CMD_FLAG_RESTORE_REMOVE_ITEMS = (1 << 5), |
| @@ -1404,7 +1404,7 @@ static void print_usage(int argc, char **argv) | |||
| 1404 | printf(" --full\t\tforce full backup from device.\n"); | 1404 | printf(" --full\t\tforce full backup from device.\n"); |
| 1405 | printf(" restore\trestore last backup to the device\n"); | 1405 | printf(" restore\trestore last backup to the device\n"); |
| 1406 | printf(" --system\t\trestore system files, too.\n"); | 1406 | printf(" --system\t\trestore system files, too.\n"); |
| 1407 | printf(" --reboot\t\treboot the system when done.\n"); | 1407 | printf(" --no-reboot\t\tdo NOT reboot the system when done (default: yes).\n"); |
| 1408 | printf(" --copy\t\tcreate a copy of backup folder before restoring.\n"); | 1408 | printf(" --copy\t\tcreate a copy of backup folder before restoring.\n"); |
| 1409 | printf(" --settings\t\trestore device settings from the backup.\n"); | 1409 | printf(" --settings\t\trestore device settings from the backup.\n"); |
| 1410 | printf(" --remove\t\tremove items which are not being restored\n"); | 1410 | printf(" --remove\t\tremove items which are not being restored\n"); |
| @@ -1501,7 +1501,10 @@ int main(int argc, char *argv[]) | |||
| 1501 | cmd_flags |= CMD_FLAG_RESTORE_SYSTEM_FILES; | 1501 | cmd_flags |= CMD_FLAG_RESTORE_SYSTEM_FILES; |
| 1502 | } | 1502 | } |
| 1503 | else if (!strcmp(argv[i], "--reboot")) { | 1503 | else if (!strcmp(argv[i], "--reboot")) { |
| 1504 | cmd_flags |= CMD_FLAG_RESTORE_REBOOT; | 1504 | cmd_flags &= ~CMD_FLAG_RESTORE_NO_REBOOT; |
| 1505 | } | ||
| 1506 | else if (!strcmp(argv[i], "--no-reboot")) { | ||
| 1507 | cmd_flags |= CMD_FLAG_RESTORE_NO_REBOOT; | ||
| 1505 | } | 1508 | } |
| 1506 | else if (!strcmp(argv[i], "--copy")) { | 1509 | else if (!strcmp(argv[i], "--copy")) { |
| 1507 | cmd_flags |= CMD_FLAG_RESTORE_COPY_BACKUP; | 1510 | cmd_flags |= CMD_FLAG_RESTORE_COPY_BACKUP; |
| @@ -1967,9 +1970,9 @@ checkpoint: | |||
| 1967 | opts = plist_new_dict(); | 1970 | opts = plist_new_dict(); |
| 1968 | plist_dict_set_item(opts, "RestoreSystemFiles", plist_new_bool(cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES)); | 1971 | plist_dict_set_item(opts, "RestoreSystemFiles", plist_new_bool(cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES)); |
| 1969 | PRINT_VERBOSE(1, "Restoring system files: %s\n", (cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES ? "Yes":"No")); | 1972 | PRINT_VERBOSE(1, "Restoring system files: %s\n", (cmd_flags & CMD_FLAG_RESTORE_SYSTEM_FILES ? "Yes":"No")); |
| 1970 | if ((cmd_flags & CMD_FLAG_RESTORE_REBOOT) == 0) | 1973 | if (cmd_flags & CMD_FLAG_RESTORE_NO_REBOOT) |
| 1971 | plist_dict_set_item(opts, "RestoreShouldReboot", plist_new_bool(0)); | 1974 | plist_dict_set_item(opts, "RestoreShouldReboot", plist_new_bool(0)); |
| 1972 | PRINT_VERBOSE(1, "Rebooting after restore: %s\n", (cmd_flags & CMD_FLAG_RESTORE_REBOOT ? "Yes":"No")); | 1975 | PRINT_VERBOSE(1, "Rebooting after restore: %s\n", (cmd_flags & CMD_FLAG_RESTORE_NO_REBOOT ? "No":"Yes")); |
| 1973 | if ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0) | 1976 | if ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0) |
| 1974 | plist_dict_set_item(opts, "RestoreDontCopyBackup", plist_new_bool(1)); | 1977 | plist_dict_set_item(opts, "RestoreDontCopyBackup", plist_new_bool(1)); |
| 1975 | PRINT_VERBOSE(1, "Don't copy backup: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0 ? "Yes":"No")); | 1978 | PRINT_VERBOSE(1, "Don't copy backup: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0 ? "Yes":"No")); |
| @@ -2440,7 +2443,7 @@ files_out: | |||
| 2440 | } | 2443 | } |
| 2441 | break; | 2444 | break; |
| 2442 | case CMD_RESTORE: | 2445 | case CMD_RESTORE: |
| 2443 | if (cmd_flags & CMD_FLAG_RESTORE_REBOOT) | 2446 | if ((cmd_flags & CMD_FLAG_RESTORE_NO_REBOOT) == 0) |
| 2444 | PRINT_VERBOSE(1, "The device should reboot now.\n"); | 2447 | PRINT_VERBOSE(1, "The device should reboot now.\n"); |
| 2445 | if (operation_ok) { | 2448 | if (operation_ok) { |
| 2446 | PRINT_VERBOSE(1, "Restore Successful.\n"); | 2449 | PRINT_VERBOSE(1, "Restore Successful.\n"); |
