bash: add to TWRP
Change-Id: Ie1826df01ad5fe2480e96d56b2c4fd1c91449cc2
diff --git a/Android.mk b/Android.mk
index 2794640..5935486 100755
--- a/Android.mk
+++ b/Android.mk
@@ -139,6 +139,7 @@
TW_EXCLUDE_MTP := true
TW_EXCLUDE_TZDATA := true
TW_EXCLUDE_NANO := true
+ TW_EXCLUDE_BASH := true
endif
ifeq ($(AB_OTA_UPDATER),true)
@@ -423,6 +424,13 @@
nano.rc
endif
+ifneq ($(TW_EXCLUDE_BASH), true)
+ ifneq ($(wildcard external/bash/.),)
+ TWRP_REQUIRED_MODULES += \
+ bash_twrp
+ endif
+endif
+
ifeq ($(TW_INCLUDE_REPACKTOOLS), true)
TWRP_REQUIRED_MODULES += \
magiskboot
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 81acfac..f3943ba 100755
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -324,6 +324,10 @@
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libssl.so
endif
+ifneq ($(TW_EXCLUDE_BASH), true)
+ RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/bash
+endif
+
include $(CLEAR_VARS)
LOCAL_MODULE := relink_libraries
LOCAL_MODULE_TAGS := optional
@@ -539,3 +543,21 @@
cp -rf external/libncurses/lib/terminfo $(TARGET_RECOVERY_ROOT_OUT)/system/etc/;
include $(BUILD_PHONY_PACKAGE)
+ifneq ($(TW_EXCLUDE_BASH), true)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := bash_twrp
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE_CLASS := ETC
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/system/bin
+ LOCAL_REQUIRED_MODULES := bash
+
+ LOCAL_POST_INSTALL_CMD += \
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/bash/; \
+ cp -rf external/bash/etc/ $(TARGET_RECOVERY_ROOT_OUT)/system/etc/bash; \
+ sed -i 's/ro.lineage.device/ro.product.device/' $(TARGET_RECOVERY_ROOT_OUT)/system/etc/bash/bashrc; \
+ sed -i '/export TERM/d' $(TARGET_RECOVERY_ROOT_OUT)/system/etc/bash/bashrc; \
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin; \
+ ln -sf /system/bin/bash $(TARGET_RECOVERY_ROOT_OUT)/sbin/bash;
+ include $(BUILD_PHONY_PACKAGE)
+endif
+