[Buildroot] [git commit branch/2018.05.x] vim: install /bin/vi as a relative symlink

Peter Korsgaard peter at korsgaard.com
Thu Aug 23 22:08:34 UTC 2018


commit: https://git.buildroot.net/buildroot/commit/?id=9867b138e13ba0689f753518fcddb63635d3f2dc
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2018.05.x

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 at datacom.com.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
(cherry picked from commit 52385d789af0d17bf12406e5c028651ccbd841f0)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/vim/vim.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/vim/vim.mk b/package/vim/vim.mk
index 5ee889882a..0cc6512599 100644
--- a/package/vim/vim.mk
+++ b/package/vim/vim.mk
@@ -65,9 +65,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)


More information about the buildroot mailing list