Include nano in TWRP by default
Use 'TW_EXCLUDE_NANO := true' to exclude from build
Will be excluded by default if 'TW_OEM_BUILD := true' is set
Change-Id: I812399ef9f3f5d3c7d4baf981924d49255c16e5a
diff --git a/Android.mk b/Android.mk
index d32d055..fdfb9ca 100755
--- a/Android.mk
+++ b/Android.mk
@@ -136,6 +136,7 @@
TW_USE_TOOLBOX := true
TW_EXCLUDE_MTP := true
TW_EXCLUDE_TZDATA := true
+ TW_EXCLUDE_NANO := true
endif
ifeq ($(AB_OTA_UPDATER),true)
@@ -409,6 +410,13 @@
tzdata_twrp
endif
+ifneq ($(TW_EXCLUDE_NANO), true)
+TWRP_REQUIRED_MODULES += \
+ nano_twrp \
+ nano.rc
+endif
+
+
ifneq ($(TW_INCLUDE_CRYPTO),)
TWRP_REQUIRED_MODULES += \
hwservicemanager \
diff --git a/etc/Android.mk b/etc/Android.mk
index 26d86d6..db7b37f 100755
--- a/etc/Android.mk
+++ b/etc/Android.mk
@@ -58,6 +58,15 @@
LOCAL_SRC_FILES := init.recovery.ldconfig.rc
include $(BUILD_PREBUILT)
+include $(CLEAR_VARS)
+LOCAL_MODULE := nano.rc
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/etc/init
+
+LOCAL_SRC_FILES := init/$(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
ifeq ($(AB_OTA_UPDATER),true)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.boot@1.0-service.rc
diff --git a/etc/init/nano.rc b/etc/init/nano.rc
new file mode 100644
index 0000000..f57f656
--- /dev/null
+++ b/etc/init/nano.rc
@@ -0,0 +1,3 @@
+on fs
+ export TERMINFO /system/etc/terminfo
+ export TERM pcansi
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 3f54db1..05355b4 100755
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -318,6 +318,13 @@
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblogwrap.so
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_misc.so
+ifneq ($(TW_EXCLUDE_NANO), true)
+ RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/nano
+ RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libncurses.so
+ RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libssh.so
+ RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libssl.so
+endif
+
include $(CLEAR_VARS)
LOCAL_MODULE := relink_libraries
LOCAL_MODULE_TAGS := optional
@@ -521,3 +528,15 @@
cp -f $(TARGET_OUT)/usr/share/zoneinfo/tzdata $(TARGET_RECOVERY_ROOT_OUT)/system/usr/share/zoneinfo/;
include $(BUILD_PHONY_PACKAGE)
endif
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := nano_twrp
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/system/bin
+LOCAL_REQUIRED_MODULES := nano libncurses
+LOCAL_POST_INSTALL_CMD += \
+ cp -rf $(TARGET_OUT_ETC)/nano $(TARGET_RECOVERY_ROOT_OUT)/system/etc/; \
+ cp -rf external/libncurses/lib/terminfo $(TARGET_RECOVERY_ROOT_OUT)/system/etc/;
+include $(BUILD_PHONY_PACKAGE)
+