diff options
| author | 2012-11-29 17:11:27 +0100 | |
|---|---|---|
| committer | 2012-11-29 17:11:27 +0100 | |
| commit | 37401693ad6547e4ea272e8419ab8995230c3fed (patch) | |
| tree | a689af40a31d1fe3d2843e5c04629ea2f55d2503 /tools/idevicebackup2.c | |
| parent | ed47413660eb3f49e55b795513990269491ad0c7 (diff) | |
| download | libimobiledevice-37401693ad6547e4ea272e8419ab8995230c3fed.tar.gz libimobiledevice-37401693ad6547e4ea272e8419ab8995230c3fed.tar.bz2 | |
idevicebackup2: Add flag to remove items not being restored from target device
Diffstat (limited to 'tools/idevicebackup2.c')
| -rw-r--r-- | tools/idevicebackup2.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 7256ee9..eeb2718 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -85,7 +85,8 @@ enum cmd_flags { | |||
| 85 | CMD_FLAG_RESTORE_SYSTEM_FILES = (1 << 1), | 85 | CMD_FLAG_RESTORE_SYSTEM_FILES = (1 << 1), |
| 86 | CMD_FLAG_RESTORE_REBOOT = (1 << 2), | 86 | CMD_FLAG_RESTORE_REBOOT = (1 << 2), |
| 87 | CMD_FLAG_RESTORE_COPY_BACKUP = (1 << 3), | 87 | CMD_FLAG_RESTORE_COPY_BACKUP = (1 << 3), |
| 88 | CMD_FLAG_RESTORE_SETTINGS = (1 << 4) | 88 | CMD_FLAG_RESTORE_SETTINGS = (1 << 4), |
| 89 | CMD_FLAG_RESTORE_REMOVE_ITEMS = (1 << 5) | ||
| 89 | }; | 90 | }; |
| 90 | 91 | ||
| 91 | static void notify_cb(const char *notification, void *userdata) | 92 | static void notify_cb(const char *notification, void *userdata) |
| @@ -1119,6 +1120,7 @@ static void print_usage(int argc, char **argv) | |||
| 1119 | printf(" --reboot\treboot the system when done.\n"); | 1120 | printf(" --reboot\treboot the system when done.\n"); |
| 1120 | printf(" --copy\tcreate a copy of backup folder before restoring.\n"); | 1121 | printf(" --copy\tcreate a copy of backup folder before restoring.\n"); |
| 1121 | printf(" --settings\trestore device settings from the backup.\n"); | 1122 | printf(" --settings\trestore device settings from the backup.\n"); |
| 1123 | printf(" --remove\tremove items which are not being restored\n"); | ||
| 1122 | printf(" info\t\tshow details about last completed backup of device\n"); | 1124 | printf(" info\t\tshow details about last completed backup of device\n"); |
| 1123 | printf(" list\t\tlist files of last completed backup in CSV format\n"); | 1125 | printf(" list\t\tlist files of last completed backup in CSV format\n"); |
| 1124 | printf(" unback\tunpack a completed backup in DIRECTORY/_unback_/\n\n"); | 1126 | printf(" unback\tunpack a completed backup in DIRECTORY/_unback_/\n\n"); |
| @@ -1201,6 +1203,9 @@ int main(int argc, char *argv[]) | |||
| 1201 | else if (!strcmp(argv[i], "--settings")) { | 1203 | else if (!strcmp(argv[i], "--settings")) { |
| 1202 | cmd_flags |= CMD_FLAG_RESTORE_SETTINGS; | 1204 | cmd_flags |= CMD_FLAG_RESTORE_SETTINGS; |
| 1203 | } | 1205 | } |
| 1206 | else if (!strcmp(argv[i], "--remove")) { | ||
| 1207 | cmd_flags |= CMD_FLAG_RESTORE_REMOVE_ITEMS; | ||
| 1208 | } | ||
| 1204 | else if (!strcmp(argv[i], "info")) { | 1209 | else if (!strcmp(argv[i], "info")) { |
| 1205 | cmd = CMD_INFO; | 1210 | cmd = CMD_INFO; |
| 1206 | verbose = 0; | 1211 | verbose = 0; |
| @@ -1463,7 +1468,10 @@ checkpoint: | |||
| 1463 | plist_dict_insert_item(opts, "RestoreDontCopyBackup", plist_new_bool(1)); | 1468 | plist_dict_insert_item(opts, "RestoreDontCopyBackup", plist_new_bool(1)); |
| 1464 | PRINT_VERBOSE(1, "Don't copy backup: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0 ? "Yes":"No")); | 1469 | PRINT_VERBOSE(1, "Don't copy backup: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_COPY_BACKUP) == 0 ? "Yes":"No")); |
| 1465 | plist_dict_insert_item(opts, "RestorePreserveSettings", plist_new_bool((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0)); | 1470 | plist_dict_insert_item(opts, "RestorePreserveSettings", plist_new_bool((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0)); |
| 1466 | PRINT_VERBOSE(1, "Preserve settings of device: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0 ? "Yes":"No")); | 1471 | PRINT_VERBOSE(1, "Preserve settings of device: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_SETTINGS) == 0 ? "Yes":"No")); |
| 1472 | if (cmd_flags & CMD_FLAG_RESTORE_REMOVE_ITEMS) | ||
| 1473 | plist_dict_insert_item(opts, "RemoveItemsNotRestored", plist_new_bool(1)); | ||
| 1474 | PRINT_VERBOSE(1, "Remove items that are not restored: %s\n", ((cmd_flags & CMD_FLAG_RESTORE_REMOVE_ITEMS) ? "Yes":"No")); | ||
| 1467 | 1475 | ||
| 1468 | err = mobilebackup2_send_request(mobilebackup2, "Restore", udid, source_udid, opts); | 1476 | err = mobilebackup2_send_request(mobilebackup2, "Restore", udid, source_udid, opts); |
| 1469 | plist_free(opts); | 1477 | plist_free(opts); |
