From dabfd49bd4e5bd89eb3b4975deca4242534b4fd7 Mon Sep 17 00:00:00 2001 From: Hashcode Date: Thu, 29 Aug 2013 22:45:30 -0700 Subject: implement "usermrf" fstab flag to force rm -rf * deletion on specific partitions Change-Id: I58f4a8cedf31e6b6efd88f96a43ed525603ae311 --- partition.cpp | 4 +++- partitionmanager.cpp | 2 ++ partitions.hpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/partition.cpp b/partition.cpp index 5359503bc..8b2e09798 100644 --- a/partition.cpp +++ b/partition.cpp @@ -404,6 +404,8 @@ bool TWPartition::Process_Flags(string Flags, bool Display_Error) { Is_Storage = true; } else if (strcmp(ptr, "canbewiped") == 0) { Can_Be_Wiped = true; + } else if (strcmp(ptr, "usermrf") == 0) { + Use_Rm_Rf = true; } else if (ptr_len > 7 && strncmp(ptr, "backup=", 7) == 0) { ptr += 7; if (*ptr == '1' || *ptr == 'y' || *ptr == 'Y') @@ -994,7 +996,7 @@ bool TWPartition::Wipe(string New_File_System) { DataManager::GetValue(TW_RM_RF_VAR, check); - if (check) + if (check || Use_Rm_Rf) wiped = Wipe_RMRF(); else if (New_File_System == "ext4") wiped = Wipe_EXT4(); diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 77cf37e50..78fbfa489 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -162,6 +162,8 @@ void TWPartitionManager::Output_Partition(TWPartition* Part) { printf("Can_Be_Mounted "); if (Part->Can_Be_Wiped) printf("Can_Be_Wiped "); + if (Part->Use_Rm_Rf) + printf("Use_Rm_Rf "); if (Part->Can_Be_Backed_Up) printf("Can_Be_Backed_Up "); if (Part->Wipe_During_Factory_Reset) diff --git a/partitions.hpp b/partitions.hpp index 25ae4dbee..e46dcce28 100644 --- a/partitions.hpp +++ b/partitions.hpp @@ -111,6 +111,7 @@ private: bool Can_Be_Mounted; // Indicates that the partition can be mounted bool Can_Be_Wiped; // Indicates that the partition can be wiped bool Can_Be_Backed_Up; // Indicates that the partition will show up in the backup list + bool Use_Rm_Rf; // Indicates that the partition will always be formatted w/ "rm -rf *" bool Wipe_During_Factory_Reset; // Indicates that this partition is wiped during a factory reset bool Wipe_Available_in_GUI; // Inidcates that the wipe can be user initiated in the GUI system bool Is_SubPartition; // Indicates that this partition is a sub-partition of another partition (e.g. datadata is a sub-partition of data) -- cgit v1.2.3