summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-02-10 18:56:35 +0100
committerEthan Yonker <dees_troy@teamw.in>2014-02-10 18:56:35 +0100
commit87af56369b8eaeb1edc671cdefee2cdae7b2b43c (patch)
treed1cedf8796aaca1467e0da4854255d197ad3de3a /partition.cpp
parentMerge "Additional mount function call without mount options" into android-4.4 (diff)
downloadandroid_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.tar
android_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.tar.gz
android_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.tar.bz2
android_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.tar.lz
android_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.tar.xz
android_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.tar.zst
android_bootable_recovery-87af56369b8eaeb1edc671cdefee2cdae7b2b43c.zip
Diffstat (limited to 'partition.cpp')
-rw-r--r--partition.cpp46
1 files changed, 15 insertions, 31 deletions
diff --git a/partition.cpp b/partition.cpp
index 3f19b7d61..57a7d8de5 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1584,6 +1584,9 @@ bool TWPartition::Backup_Tar(string backup_folder) {
tar.use_encryption = use_encryption;
if (Use_Userdata_Encryption)
tar.userdata_encryption = use_encryption;
+ string Password;
+ DataManager::GetValue("tw_backup_password", Password);
+ tar.setpassword(Password);
} else {
use_encryption = false;
}
@@ -1672,37 +1675,18 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System)
return false;
Full_FileName = restore_folder + "/" + Backup_FileName;
- /*if (!TWFunc::Path_Exists(Full_FileName)) {
- if (!TWFunc::Path_Exists(Full_FileName)) {
- // Backup is multiple archives
- LOGINFO("Backup is multiple archives.\n");
- sprintf(split_index, "%03i", index);
- Full_FileName = restore_folder + "/" + Backup_FileName + split_index;
- while (TWFunc::Path_Exists(Full_FileName)) {
- index++;
- gui_print("Restoring archive %i...\n", index);
- LOGINFO("Restoring '%s'...\n", Full_FileName.c_str());
- twrpTar tar;
- tar.setdir("/");
- tar.setfn(Full_FileName);
- if (tar.extractTarFork() != 0)
- return false;
- sprintf(split_index, "%03i", index);
- Full_FileName = restore_folder + "/" + Backup_FileName + split_index;
- }
- if (index == 0) {
- LOGERR("Error locating restore file: '%s'\n", Full_FileName.c_str());
- return false;
- }
- }
- } else {*/
- twrpTar tar;
- tar.setdir(Backup_Path);
- tar.setfn(Full_FileName);
- tar.backup_name = Backup_Name;
- if (tar.extractTarFork() != 0)
- return false;
- //}
+ twrpTar tar;
+ tar.setdir(Backup_Path);
+ tar.setfn(Full_FileName);
+ tar.backup_name = Backup_Name;
+#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
+ string Password;
+ DataManager::GetValue("tw_restore_password", Password);
+ if (!Password.empty())
+ tar.setpassword(Password);
+#endif
+ if (tar.extractTarFork() != 0)
+ return false;
return true;
}