Merge "Wipe metadata when we wipe userdata and cache."
This commit is contained in:
commit
f88905d231
1 changed files with 14 additions and 14 deletions
|
|
@ -1644,20 +1644,20 @@ int FastBoot::Main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wants_wipe) {
|
if (wants_wipe) {
|
||||||
fb_queue_erase("userdata");
|
std::vector<std::string> partitions = { "userdata", "cache", "metadata" };
|
||||||
if (set_fbe_marker) {
|
for (const auto& partition : partitions) {
|
||||||
fprintf(stderr, "setting FBE marker on initial userdata...\n");
|
std::string partition_type;
|
||||||
std::string initial_userdata_dir = create_fbemarker_tmpdir();
|
if (!fb_getvar(transport, std::string{"partition-type:"} + partition, &partition_type)) continue;
|
||||||
fb_perform_format(transport, "userdata", 1, "", "", initial_userdata_dir);
|
if (partition_type.empty()) continue;
|
||||||
delete_fbemarker_tmpdir(initial_userdata_dir);
|
fb_queue_erase(partition);
|
||||||
} else {
|
if (partition == "userdata" && set_fbe_marker) {
|
||||||
fb_perform_format(transport, "userdata", 1, "", "", "");
|
fprintf(stderr, "setting FBE marker on initial userdata...\n");
|
||||||
}
|
std::string initial_userdata_dir = create_fbemarker_tmpdir();
|
||||||
|
fb_perform_format(transport, partition, 1, "", "", initial_userdata_dir);
|
||||||
std::string cache_type;
|
delete_fbemarker_tmpdir(initial_userdata_dir);
|
||||||
if (fb_getvar(transport, "partition-type:cache", &cache_type) && !cache_type.empty()) {
|
} else {
|
||||||
fb_queue_erase("cache");
|
fb_perform_format(transport, partition, 1, "", "", "");
|
||||||
fb_perform_format(transport, "cache", 1, "", "", "");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wants_set_active) {
|
if (wants_set_active) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue