summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk7
-rw-r--r--partition.cpp60
-rw-r--r--prebuilt/Android.mk8
3 files changed, 54 insertions, 21 deletions
diff --git a/Android.mk b/Android.mk
index 3e0c97b62..44149736b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -413,11 +413,18 @@ endif
LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
LOCAL_CFLAGS += -DTWHTCD_PATH=\"$(TWHTCD_PATH)\"
ifeq ($(TW_INCLUDE_NTFS_3G),true)
+ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 4; echo $$?),0)
+ LOCAL_ADDITIONAL_DEPENDENCIES += \
+ mount.ntfs \
+ fsck.ntfs \
+ mkfs.ntfs
+else
LOCAL_ADDITIONAL_DEPENDENCIES += \
ntfs-3g \
ntfsfix \
mkntfs
endif
+endif
ifeq ($(TARGET_USERIMAGES_USE_F2FS), true)
ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 3; echo $$?),0)
LOCAL_ADDITIONAL_DEPENDENCIES += \
diff --git a/partition.cpp b/partition.cpp
index a17a647c4..58db70629 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1013,13 +1013,21 @@ bool TWPartition::Mount(bool Display_Error) {
}
}
- if (Current_File_System == "ntfs" && TWFunc::Path_Exists("/sbin/ntfs-3g")) {
+ if (Current_File_System == "ntfs" && (TWFunc::Path_Exists("/sbin/ntfs-3g") || TWFunc::Path_Exists("/sbin/mount.ntfs"))) {
string cmd;
+ string Ntfsmount_Binary = "";
+
+ if (TWFunc::Path_Exists("/sbin/ntfs-3g"))
+ Ntfsmount_Binary = "ntfs-3g";
+ else if (TWFunc::Path_Exists("/sbin/mount.ntfs"))
+ Ntfsmount_Binary = "mount.ntfs";
+
if (Mount_Read_Only)
- cmd = "/sbin/ntfs-3g -o ro " + Actual_Block_Device + " " + Mount_Point;
+ cmd = "/sbin/" + Ntfsmount_Binary + " -o ro " + Actual_Block_Device + " " + Mount_Point;
else
- cmd = "/sbin/ntfs-3g " + Actual_Block_Device + " " + Mount_Point;
+ cmd = "/sbin/" + Ntfsmount_Binary + " " + Actual_Block_Device + " " + Mount_Point;
LOGINFO("cmd: '%s'\n", cmd.c_str());
+
if (TWFunc::Exec_Cmd(cmd) == 0) {
return true;
} else {
@@ -1250,7 +1258,7 @@ bool TWPartition::Can_Repair() {
return true;
else if (Current_File_System == "f2fs" && TWFunc::Path_Exists("/sbin/fsck.f2fs"))
return true;
- else if (Current_File_System == "ntfs" && TWFunc::Path_Exists("/sbin/ntfsfix"))
+ else if (Current_File_System == "ntfs" && (TWFunc::Path_Exists("/sbin/ntfsfix") || TWFunc::Path_Exists("/sbin/fsck.ntfs")))
return true;
return false;
}
@@ -1335,15 +1343,20 @@ bool TWPartition::Repair() {
}
}
if (Current_File_System == "ntfs") {
- if (!TWFunc::Path_Exists("/sbin/ntfsfix")) {
+ string Ntfsfix_Binary;
+ if (TWFunc::Path_Exists("/sbin/ntfsfix"))
+ Ntfsfix_Binary = "ntfsfix";
+ else if (TWFunc::Path_Exists("/sbin/fsck.ntfs"))
+ Ntfsfix_Binary = "fsck.ntfs";
+ else {
gui_msg(Msg(msg::kError, "repair_not_exist={1} does not exist! Cannot repair!")("ntfsfix"));
return false;
}
if (!UnMount(true))
return false;
- gui_msg(Msg("reparing=Repairing {1} using {2}...")(Display_Name)("ntfsfix"));
+ gui_msg(Msg("reparing=Repairing {1} using {2}...")(Display_Name)(Ntfsfix_Binary));
Find_Actual_Block_Device();
- command = "/sbin/ntfsfix " + Actual_Block_Device;
+ command = "/sbin/" + Ntfsfix_Binary + " " + Actual_Block_Device;
LOGINFO("Repair command: %s\n", command.c_str());
if (TWFunc::Exec_Cmd(command) == 0) {
gui_msg("done=Done.");
@@ -1877,23 +1890,28 @@ bool TWPartition::Wipe_F2FS() {
bool TWPartition::Wipe_NTFS() {
string command;
+ string Ntfsmake_Binary;
- if (TWFunc::Path_Exists("/sbin/mkntfs")) {
- if (!UnMount(true))
- return false;
+ if (TWFunc::Path_Exists("/sbin/mkntfs"))
+ Ntfsmake_Binary = "mkntfs";
+ else if (TWFunc::Path_Exists("/sbin/mkfs.ntfs"))
+ Ntfsmake_Binary = "mkfs.ntfs";
+ else
+ return false;
- gui_msg(Msg("formating_using=Formatting {1} using {2}...")(Display_Name)("mkntfs"));
- Find_Actual_Block_Device();
- command = "mkntfs " + Actual_Block_Device;
- if (TWFunc::Exec_Cmd(command) == 0) {
- Recreate_AndSec_Folder();
- gui_msg("done=Done.");
- return true;
- } else {
- gui_msg(Msg(msg::kError, "unable_to_wipe=Unable to wipe {1}.")(Display_Name));
- return false;
- }
+ if (!UnMount(true))
+ return false;
+
+ gui_msg(Msg("formating_using=Formatting {1} using {2}...")(Display_Name)(Ntfsmake_Binary));
+ Find_Actual_Block_Device();
+ command = "/sbin/" + Ntfsmake_Binary + " " + Actual_Block_Device;
+ if (TWFunc::Exec_Cmd(command) == 0) {
+ Recreate_AndSec_Folder();
+ gui_msg("done=Done.");
return true;
+ } else {
+ gui_msg(Msg(msg::kError, "unable_to_wipe=Unable to wipe {1}.")(Display_Name));
+ return false;
}
return false;
}
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 068367c83..df14bbdac 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -189,10 +189,18 @@ ifneq ($(wildcard external/pcre/Android.mk),)
RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcre.so
endif
ifeq ($(TW_INCLUDE_NTFS_3G),true)
+ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 4; echo $$?),0)
+ RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mount.ntfs
+ RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fsck.ntfs
+ RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.ntfs
+ RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libntfs-3g.so
+ RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libfuse.so
+else
RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/ntfs-3g
RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/ntfsfix
RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkntfs
endif
+endif
TWRP_AUTOGEN := $(intermediates)/teamwin