vim: install /bin/vi as a relative symlink
authorCarlos Santos <casantos@datacom.com.br>
Wed, 18 Jul 2018 12:34:43 +0000 (09:34 -0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 5 Aug 2018 12:42:26 +0000 (14:42 +0200)
Prevent creating a dangling symlink when vim is not present on the host
machine. With BR2_ROOTFS_MERGED_USR, just link to "vim", since they are
on the same directory, otherwise link to "../usr/bin/vim".

Signed-off-by: Carlos Santos <casantos@datacom.com.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/vim/vim.mk

index dbf71c573f6c7188fc9fb06363c285068f0cd817..ee0c8b61e4cb95624822e85359b6a3668aad0e47 100644 (file)
@@ -63,9 +63,15 @@ define VIM_REMOVE_DOCS
 endef
 
 # Avoid oopses with vipw/vigr, lack of $EDITOR and 'vi' command expectation
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
 define VIM_INSTALL_VI_SYMLINK
-       ln -sf /usr/bin/vim $(TARGET_DIR)/bin/vi
+       ln -sf vim $(TARGET_DIR)/usr/bin/vi
 endef
+else
+define VIM_INSTALL_VI_SYMLINK
+       ln -sf ../usr/bin/vim $(TARGET_DIR)/bin/vi
+endef
+endif
 VIM_POST_INSTALL_TARGET_HOOKS += VIM_INSTALL_VI_SYMLINK
 
 ifeq ($(BR2_PACKAGE_VIM_RUNTIME),y)