mksh: add mkshrc when using TW_USE_TOOLBOX
Fixes broken shell prompt in Terminal and adb shell
Before: https://del.dog/7vphlkc
After: https://del.dog/vhkjgo8
Add as prebuilt with suffix "_twrp" to avoid conflict
with original mkshrc and rename via POST_INSTALL_CMD
Prebuilt version adjusts TMPDIR variable from
"/data/local/tmp" to "/tmp" for TWRP
Change-Id: I42a1b2a8c114f66dbe659c07485f1dfae8a5d314
diff --git a/etc/Android.mk b/etc/Android.mk
index cda0f37..4aeb251 100644
--- a/etc/Android.mk
+++ b/etc/Android.mk
@@ -88,3 +88,18 @@
include $(BUILD_PREBUILT)
endif
endif
+
+ifeq ($(TW_USE_TOOLBOX), true)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := init.recovery.mksh.rc
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+
+ # Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
+ # during ramdisk creation and only allows init.recovery.*.rc files to be copied
+ # from TARGET_ROOT_OUT thereafter
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+ LOCAL_SRC_FILES := $(LOCAL_MODULE)
+ include $(BUILD_PREBUILT)
+endif
diff --git a/etc/init.rc b/etc/init.rc
index bcd519b..348471d 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -1,4 +1,5 @@
import /init.recovery.logd.rc
+import /init.recovery.mksh.rc
import /init.recovery.usb.rc
import /init.recovery.service.rc
import /init.recovery.vold_decrypt.rc
diff --git a/etc/init.recovery.mksh.rc b/etc/init.recovery.mksh.rc
new file mode 100755
index 0000000..3afd946
--- /dev/null
+++ b/etc/init.recovery.mksh.rc
@@ -0,0 +1,2 @@
+on init
+ export ENV /etc/mkshrc