From 0eaa1c53598054ec586108f2dec8b391dc0ac473 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 21 Sep 2013 01:46:56 +0200 Subject: idevicebackup2: Add argument to enforce a full backup from device --- tools/idevicebackup2.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 1aa03f5..47de171 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -87,7 +87,8 @@ enum cmd_flags { CMD_FLAG_RESTORE_REMOVE_ITEMS = (1 << 5), CMD_FLAG_ENCRYPTION_ENABLE = (1 << 6), CMD_FLAG_ENCRYPTION_DISABLE = (1 << 7), - CMD_FLAG_ENCRYPTION_CHANGEPW = (1 << 8) + CMD_FLAG_ENCRYPTION_CHANGEPW = (1 << 8), + CMD_FLAG_FORCE_FULL_BACKUP = (1 << 9) }; static int backup_domain_changed = 0; @@ -1258,6 +1259,7 @@ static void print_usage(int argc, char **argv) printf("Create or restore backup from the current or specified directory.\n\n"); printf("commands:\n"); printf(" backup\tcreate backup for the device\n"); + printf(" --full\t\tforce full backup from device.\n"); printf(" restore\trestore last backup to the device\n"); printf(" --system\t\trestore system files, too.\n"); printf(" --reboot\t\treboot the system when done.\n"); @@ -1375,6 +1377,9 @@ int main(int argc, char *argv[]) backup_password = strdup(argv[i]); continue; } + else if (!strcmp(argv[i], "--full")) { + cmd_flags |= CMD_FLAG_FORCE_FULL_BACKUP; + } else if (!strcmp(argv[i], "info")) { cmd = CMD_INFO; verbose = 0; @@ -1723,6 +1728,11 @@ checkpoint: plist_free(info_plist); info_plist = NULL; + if (cmd_flags & CMD_FLAG_FORCE_FULL_BACKUP) { + PRINT_VERBOSE(1, "Enforcing full backup from device.\n"); + opts = plist_new_dict(); + plist_dict_insert_item(opts, "ForceFullBackup", plist_new_bool(1)); + } /* request backup from device with manifest from last backup */ if (willEncrypt) { PRINT_VERBOSE(1, "Backup will be encrypted.\n"); @@ -1730,7 +1740,9 @@ checkpoint: PRINT_VERBOSE(1, "Backup will be unencrypted.\n"); } PRINT_VERBOSE(1, "Requesting backup from device...\n"); - err = mobilebackup2_send_request(mobilebackup2, "Backup", udid, source_udid, NULL); + err = mobilebackup2_send_request(mobilebackup2, "Backup", udid, source_udid, opts); + if (opts) + plist_free(opts); if (err == MOBILEBACKUP2_E_SUCCESS) { if (is_full_backup) { PRINT_VERBOSE(1, "Full backup mode.\n"); -- cgit v1.1-32-gdbae