diff --git a/data.cpp b/data.cpp index 5fa68144..65f706ed 100644 --- a/data.cpp +++ b/data.cpp @@ -1044,6 +1044,8 @@ void DataManager::Output_Version(void) { strcpy(version, TW_VERSION_STR); fwrite(version, sizeof(version[0]), strlen(version) / sizeof(version[0]), fp); fclose(fp); + TWFunc::copy_file("/etc/recovery.fstab", "/cache/recovery/recovery.fstab", 0644); + PartitionManager.Output_Storage_Fstab(); sync(); LOGINFO("Version number saved to '%s'\n", Path.c_str()); } diff --git a/partitionmanager.cpp b/partitionmanager.cpp index dd2dfd2c..fc76c1ad 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -245,7 +245,7 @@ int TWPartitionManager::Mount_By_Path(string Path, bool Display_Error) { bool found = false; string Local_Path = TWFunc::Get_Root_Path(Path); - if (Local_Path == "/tmp") + if (Local_Path == "/tmp" || Local_Path == "/") return true; // Iterate through all partitions @@ -1869,3 +1869,25 @@ void TWPartitionManager::Get_Partition_List(string ListType, std::vector::iterator iter; + char storage_partition[255]; + string Temp; + FILE *fp = fopen("/cache/recovery/storage.fstab", "w"); + + if (fp == NULL) { + LOGERR("Unable to open '/cache/recovery/storage.fstab'.\n"); + return; + } + + // Iterate through all partitions + for (iter = Partitions.begin(); iter != Partitions.end(); iter++) { + if ((*iter)->Is_Storage) { + Temp = (*iter)->Storage_Path + ";" + (*iter)->Storage_Name + ";\n"; + strcpy(storage_partition, Temp.c_str()); + fwrite(storage_partition, sizeof(storage_partition[0]), strlen(storage_partition) / sizeof(storage_partition[0]), fp); + } + } + fclose(fp); +} \ No newline at end of file diff --git a/partitions.hpp b/partitions.hpp index 3ed4da6a..efe08d76 100644 --- a/partitions.hpp +++ b/partitions.hpp @@ -210,6 +210,7 @@ public: virtual int Fix_Permissions(); virtual void Get_Partition_List(string ListType, std::vector *Partition_List); virtual int Fstab_Processed(); // Indicates if the fstab has been processed or not + virtual void Output_Storage_Fstab(); // Creates a /cache/recovery/storage.fstab file with a list of all potential storage locations for app use private: bool Make_MD5(bool generate_md5, string Backup_Folder, string Backup_Filename); // Generates an MD5 after a backup is made diff --git a/variables.h b/variables.h index ddae2af9..4020b759 100644 --- a/variables.h +++ b/variables.h @@ -17,7 +17,7 @@ #ifndef _VARIABLES_HEADER_ #define _VARIABLES_HEADER_ -#define TW_VERSION_STR "2.5.0.0" +#define TW_VERSION_STR "2.6.0.0" #define TW_USE_COMPRESSION_VAR "tw_use_compression" #define TW_FILENAME "tw_filename"