From 9f59aa35933f16e893ae31551c19a57744aa9d8a Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 27 Apr 2011 22:37:07 +0200 Subject: idevicebackup2: Implement UNBACK command to unpack a backup into filesystem --- tools/idevicebackup2.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 { CMD_RESTORE, CMD_INFO, CMD_LIST, + CMD_UNBACK, CMD_LEAVE }; @@ -1068,7 +1069,8 @@ static void print_usage(int argc, char **argv) printf(" backup\tcreate backup for the device\n"); printf(" restore\trestore last backup to the device\n"); printf(" info\t\tshow details about last completed backup of device\n"); - printf(" list\t\tlist files of last completed backup in CSV format\n\n"); + printf(" list\t\tlist files of last completed backup in CSV format\n"); + printf(" unback\tUnpack a completed backup in DIRECTORY/_unback_/\n\n"); printf("options:\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); @@ -1130,6 +1132,9 @@ int main(int argc, char *argv[]) cmd = CMD_LIST; verbose = 0; } + else if (!strcmp(argv[i], "unback")) { + cmd = CMD_UNBACK; + } else if (backup_directory == NULL) { backup_directory = argv[i]; } @@ -1395,6 +1400,14 @@ checkpoint: cmd = CMD_LEAVE; } break; + case CMD_UNBACK: + PRINT_VERBOSE(1, "Starting to unpack backup...\n"); + err = mobilebackup2_send_request(mobilebackup2, "Unback", uuid, NULL, NULL); + if (err != MOBILEBACKUP2_E_SUCCESS) { + printf("Error requesting unback operation from device, error code %d\n", err); + cmd = CMD_LEAVE; + } + break; default: break; } -- cgit v1.1-32-gdbae