nano: copy files directly from source folder

Fixes system/etc/nano not found build error

Change-Id: I5661c766e6a1c959e090b0474d389124291a186f
diff --git a/etc/init.recovery.nano.rc b/etc/init.recovery.nano.rc
index c835be4..f57f656 100644
--- a/etc/init.recovery.nano.rc
+++ b/etc/init.recovery.nano.rc
@@ -1,3 +1,3 @@
 on fs
-    export TERMINFO /etc/terminfo
+    export TERMINFO /system/etc/terminfo
     export TERM pcansi
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 44bf7ed..a28cde0 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -635,8 +635,16 @@
 LOCAL_MODULE_CLASS := ETC
 LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/sbin
 LOCAL_REQUIRED_MODULES := nano libncurses
-LOCAL_POST_INSTALL_CMD += \
-    cp -rf $(TARGET_OUT_ETC)/nano $(TARGET_RECOVERY_ROOT_OUT)/etc/; \
-    cp -rf external/libncurses/lib/terminfo $(TARGET_RECOVERY_ROOT_OUT)/etc/;
+ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+    LOCAL_POST_INSTALL_CMD += \
+        mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root/system/etc/nano; \
+        cp -rf external/nano/etc/* external/nano/syntax/*.nanorc $(TARGET_RECOVERY_ROOT_OUT)/system_root/system/etc/nano/; \
+        cp -rf external/libncurses/lib/terminfo $(TARGET_RECOVERY_ROOT_OUT)/system_root/system/etc/;
+else
+    LOCAL_POST_INSTALL_CMD += \
+        mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/nano; \
+        cp -rf external/nano/etc/* external/nano/syntax/*.nanorc $(TARGET_RECOVERY_ROOT_OUT)/system/etc/nano/; \
+        cp -rf external/libncurses/lib/terminfo $(TARGET_RECOVERY_ROOT_OUT)/system/etc/;
+endif
 include $(BUILD_PHONY_PACKAGE)