summaryrefslogtreecommitdiffstats
path: root/partitions.hpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2019-01-12 05:49:52 +0100
committerEthan Yonker <dees_troy@teamw.in>2019-04-03 23:44:00 +0200
commit53796e73334ac9d87d4cb5a355fc8c1d205104f6 (patch)
treebb74fbf8593d23beddba9f899d05925b6fe03470 /partitions.hpp
parentFix build in 5.1 tree (diff)
downloadandroid_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.tar
android_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.tar.gz
android_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.tar.bz2
android_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.tar.lz
android_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.tar.xz
android_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.tar.zst
android_bootable_recovery-53796e73334ac9d87d4cb5a355fc8c1d205104f6.zip
Diffstat (limited to 'partitions.hpp')
-rw-r--r--partitions.hpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/partitions.hpp b/partitions.hpp
index c124457f6..4071b942c 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -29,6 +29,9 @@
#define MAX_FSTAB_LINE_LENGTH 2048
+#define REPACK_ORIG_DIR "/tmp/repackorig/"
+#define REPACK_NEW_DIR "/tmp/repacknew/"
+
using namespace std;
// BasePartition is used for overriding so we can run custom, device
@@ -72,6 +75,19 @@ struct Flags_Map {
char* fstab_line;
};
+enum Repack_Type {
+ REPLACE_NONE = 0,
+ REPLACE_RAMDISK = 1,
+ REPLACE_KERNEL = 2,
+};
+
+struct Repack_Options_struct {
+ Repack_Type Type;
+ bool Backup_First;
+ bool Disable_Verity;
+ bool Disable_Force_Encrypt;
+};
+
enum PartitionManager_Op { // PartitionManager Restore Mode for Raw_Read_Write()
PM_BACKUP = 0,
PM_RESTORE = 1,
@@ -300,7 +316,7 @@ public:
int Mount_Settings_Storage(bool Display_Error); // Mounts the settings file storage location (usually internal)
TWPartition* Find_Partition_By_Path(const string& Path); // Returns a pointer to a partition based on path
TWPartition* Find_Partition_By_Block_Device(const string& Block_Device); // Returns a pointer to a partition based on block device
- int Check_Backup_Name(bool Display_Error); // Checks the current backup name to ensure that it is valid
+ int Check_Backup_Name(const std::string& Backup_Name, bool Display_Error, bool Must_Be_Unique); // Checks the current backup name to ensure that it is valid and optionally that a backup with that name doesn't already exist
int Run_Backup(bool adbbackup); // Initiates a backup in the current storage
int Run_Restore(const string& Restore_Name); // Restores a backup
bool Write_ADB_Stream_Header(uint64_t partition_count); // Write ADB header over twrpbu FIFO
@@ -361,6 +377,9 @@ public:
void read_uevent(); // Reads uevent data into a buffer
void close_uevent(); // Closes the uevent netlink socket
void Add_Partition(TWPartition* Part); // Adds a new partition to the Partitions vector
+ bool Prepare_Repack(TWPartition* Part, const std::string& Temp_Folder_Destination, const bool Create_Backup, const std::string& Backup_Name); // Prepares an image for repacking by unpacking it to the temp folder destination
+ bool Prepare_Repack(const std::string& Source_Path, const std::string& Temp_Folder_Destination, const bool Copy_Source, const bool Create_Destination = true); // Prepares an image for repacking by unpacking it to the temp folder destination
+ bool Repack_Images(const std::string& Target_Image, const struct Repack_Options_struct& Repack_Options); // Repacks the boot image with a new kernel or a new ramdisk
private:
void Setup_Settings_Storage_Partition(TWPartition* Part); // Sets up settings storage
@@ -373,6 +392,7 @@ private:
void Post_Decrypt(const string& Block_Device); // Completes various post-decrypt tasks
void Coldboot_Scan(std::vector<string> *sysfs_entries, const string& Path, int depth); // Scans subfolders to find matches to the paths stored in sysfs_entries so we can trigger the uevent system to "re-add" devices
void Coldboot(); // Starts the scan of the /sys/block folder
+ bool Prepare_Empty_Folder(const std::string& Folder); // Creates an empty folder at Folder. If the folder already exists, the folder is deleted, then created
pid_t mtppid;
bool mtp_was_enabled;
int mtp_write_fd;