summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup2.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2011-04-27 22:37:07 +0200
committerGravatar Martin Szulecki2011-04-27 22:37:07 +0200
commit9f59aa35933f16e893ae31551c19a57744aa9d8a (patch)
tree959d37418199b128b556578e52f4ec5c140e663e /tools/idevicebackup2.c
parent8dd59522c788332a54fa85bee2ae3d0d7fee01b0 (diff)
downloadlibimobiledevice-9f59aa35933f16e893ae31551c19a57744aa9d8a.tar.gz
libimobiledevice-9f59aa35933f16e893ae31551c19a57744aa9d8a.tar.bz2
idevicebackup2: Implement UNBACK command to unpack a backup into filesystem
Diffstat (limited to 'tools/idevicebackup2.c')
-rw-r--r--tools/idevicebackup2.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index c443826..8ad8355 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -62,6 +62,7 @@ enum cmd_mode {
62 CMD_RESTORE, 62 CMD_RESTORE,
63 CMD_INFO, 63 CMD_INFO,
64 CMD_LIST, 64 CMD_LIST,
65 CMD_UNBACK,
65 CMD_LEAVE 66 CMD_LEAVE
66}; 67};
67 68
@@ -1068,7 +1069,8 @@ static void print_usage(int argc, char **argv)
1068 printf(" backup\tcreate backup for the device\n"); 1069 printf(" backup\tcreate backup for the device\n");
1069 printf(" restore\trestore last backup to the device\n"); 1070 printf(" restore\trestore last backup to the device\n");
1070 printf(" info\t\tshow details about last completed backup of device\n"); 1071 printf(" info\t\tshow details about last completed backup of device\n");
1071 printf(" list\t\tlist files of last completed backup in CSV format\n\n"); 1072 printf(" list\t\tlist files of last completed backup in CSV format\n");
1073 printf(" unback\tUnpack a completed backup in DIRECTORY/_unback_/\n\n");
1072 printf("options:\n"); 1074 printf("options:\n");
1073 printf(" -d, --debug\t\tenable communication debugging\n"); 1075 printf(" -d, --debug\t\tenable communication debugging\n");
1074 printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); 1076 printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n");
@@ -1130,6 +1132,9 @@ int main(int argc, char *argv[])
1130 cmd = CMD_LIST; 1132 cmd = CMD_LIST;
1131 verbose = 0; 1133 verbose = 0;
1132 } 1134 }
1135 else if (!strcmp(argv[i], "unback")) {
1136 cmd = CMD_UNBACK;
1137 }
1133 else if (backup_directory == NULL) { 1138 else if (backup_directory == NULL) {
1134 backup_directory = argv[i]; 1139 backup_directory = argv[i];
1135 } 1140 }
@@ -1395,6 +1400,14 @@ checkpoint:
1395 cmd = CMD_LEAVE; 1400 cmd = CMD_LEAVE;
1396 } 1401 }
1397 break; 1402 break;
1403 case CMD_UNBACK:
1404 PRINT_VERBOSE(1, "Starting to unpack backup...\n");
1405 err = mobilebackup2_send_request(mobilebackup2, "Unback", uuid, NULL, NULL);
1406 if (err != MOBILEBACKUP2_E_SUCCESS) {
1407 printf("Error requesting unback operation from device, error code %d\n", err);
1408 cmd = CMD_LEAVE;
1409 }
1410 break;
1398 default: 1411 default:
1399 break; 1412 break;
1400 } 1413 }