diff options
| author | 2013-09-21 01:46:56 +0200 | |
|---|---|---|
| committer | 2013-09-21 01:46:56 +0200 | |
| commit | 0eaa1c53598054ec586108f2dec8b391dc0ac473 (patch) | |
| tree | efb13eb5a366b31d1fe76b11e411df51ffc73928 /tools | |
| parent | ed1721776aa1be92f8e4ce51f2fec679b5a91100 (diff) | |
| download | libimobiledevice-0eaa1c53598054ec586108f2dec8b391dc0ac473.tar.gz libimobiledevice-0eaa1c53598054ec586108f2dec8b391dc0ac473.tar.bz2 | |
idevicebackup2: Add argument to enforce a full backup from device
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/idevicebackup2.c | 16 |
1 files changed, 14 insertions, 2 deletions
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 { | |||
| 87 | CMD_FLAG_RESTORE_REMOVE_ITEMS = (1 << 5), | 87 | CMD_FLAG_RESTORE_REMOVE_ITEMS = (1 << 5), |
| 88 | CMD_FLAG_ENCRYPTION_ENABLE = (1 << 6), | 88 | CMD_FLAG_ENCRYPTION_ENABLE = (1 << 6), |
| 89 | CMD_FLAG_ENCRYPTION_DISABLE = (1 << 7), | 89 | CMD_FLAG_ENCRYPTION_DISABLE = (1 << 7), |
| 90 | CMD_FLAG_ENCRYPTION_CHANGEPW = (1 << 8) | 90 | CMD_FLAG_ENCRYPTION_CHANGEPW = (1 << 8), |
| 91 | CMD_FLAG_FORCE_FULL_BACKUP = (1 << 9) | ||
| 91 | }; | 92 | }; |
| 92 | 93 | ||
| 93 | static int backup_domain_changed = 0; | 94 | static int backup_domain_changed = 0; |
| @@ -1258,6 +1259,7 @@ static void print_usage(int argc, char **argv) | |||
| 1258 | printf("Create or restore backup from the current or specified directory.\n\n"); | 1259 | printf("Create or restore backup from the current or specified directory.\n\n"); |
| 1259 | printf("commands:\n"); | 1260 | printf("commands:\n"); |
| 1260 | printf(" backup\tcreate backup for the device\n"); | 1261 | printf(" backup\tcreate backup for the device\n"); |
| 1262 | printf(" --full\t\tforce full backup from device.\n"); | ||
| 1261 | printf(" restore\trestore last backup to the device\n"); | 1263 | printf(" restore\trestore last backup to the device\n"); |
| 1262 | printf(" --system\t\trestore system files, too.\n"); | 1264 | printf(" --system\t\trestore system files, too.\n"); |
| 1263 | printf(" --reboot\t\treboot the system when done.\n"); | 1265 | printf(" --reboot\t\treboot the system when done.\n"); |
| @@ -1375,6 +1377,9 @@ int main(int argc, char *argv[]) | |||
| 1375 | backup_password = strdup(argv[i]); | 1377 | backup_password = strdup(argv[i]); |
| 1376 | continue; | 1378 | continue; |
| 1377 | } | 1379 | } |
| 1380 | else if (!strcmp(argv[i], "--full")) { | ||
| 1381 | cmd_flags |= CMD_FLAG_FORCE_FULL_BACKUP; | ||
| 1382 | } | ||
| 1378 | else if (!strcmp(argv[i], "info")) { | 1383 | else if (!strcmp(argv[i], "info")) { |
| 1379 | cmd = CMD_INFO; | 1384 | cmd = CMD_INFO; |
| 1380 | verbose = 0; | 1385 | verbose = 0; |
| @@ -1723,6 +1728,11 @@ checkpoint: | |||
| 1723 | plist_free(info_plist); | 1728 | plist_free(info_plist); |
| 1724 | info_plist = NULL; | 1729 | info_plist = NULL; |
| 1725 | 1730 | ||
| 1731 | if (cmd_flags & CMD_FLAG_FORCE_FULL_BACKUP) { | ||
| 1732 | PRINT_VERBOSE(1, "Enforcing full backup from device.\n"); | ||
| 1733 | opts = plist_new_dict(); | ||
| 1734 | plist_dict_insert_item(opts, "ForceFullBackup", plist_new_bool(1)); | ||
| 1735 | } | ||
| 1726 | /* request backup from device with manifest from last backup */ | 1736 | /* request backup from device with manifest from last backup */ |
| 1727 | if (willEncrypt) { | 1737 | if (willEncrypt) { |
| 1728 | PRINT_VERBOSE(1, "Backup will be encrypted.\n"); | 1738 | PRINT_VERBOSE(1, "Backup will be encrypted.\n"); |
| @@ -1730,7 +1740,9 @@ checkpoint: | |||
| 1730 | PRINT_VERBOSE(1, "Backup will be unencrypted.\n"); | 1740 | PRINT_VERBOSE(1, "Backup will be unencrypted.\n"); |
| 1731 | } | 1741 | } |
| 1732 | PRINT_VERBOSE(1, "Requesting backup from device...\n"); | 1742 | PRINT_VERBOSE(1, "Requesting backup from device...\n"); |
| 1733 | err = mobilebackup2_send_request(mobilebackup2, "Backup", udid, source_udid, NULL); | 1743 | err = mobilebackup2_send_request(mobilebackup2, "Backup", udid, source_udid, opts); |
| 1744 | if (opts) | ||
| 1745 | plist_free(opts); | ||
| 1734 | if (err == MOBILEBACKUP2_E_SUCCESS) { | 1746 | if (err == MOBILEBACKUP2_E_SUCCESS) { |
| 1735 | if (is_full_backup) { | 1747 | if (is_full_backup) { |
| 1736 | PRINT_VERBOSE(1, "Full backup mode.\n"); | 1748 | PRINT_VERBOSE(1, "Full backup mode.\n"); |
