mirror of
https://github.com/neovim/neovim.git
synced 2026-04-26 01:04:10 +00:00
build: update-alternatives during deb install #37980
Problem: nvim is not added to the system alternatives index when installed via the .deb package, requiring users to explicitly invoke nvim rather than use 'vi' or 'vim' alternatives. Solution: Invoke update-alternatives in CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA steps. Co-authored-by: Mark Landis <anonymouspage@limsei.com>
This commit is contained in:
@@ -70,6 +70,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||||||
# Unfortunately, you "just need to know" that this has a hidden
|
# Unfortunately, you "just need to know" that this has a hidden
|
||||||
# dependency on dpkg-shlibdeps whilst using a debian based host.
|
# dependency on dpkg-shlibdeps whilst using a debian based host.
|
||||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
|
||||||
|
|
||||||
|
# Include postinst and prerm scripts for update-alternatives
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/postinst"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/prerm")
|
||||||
else()
|
else()
|
||||||
set(CPACK_GENERATOR TGZ)
|
set(CPACK_GENERATOR TGZ)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
9
cmake.packaging/postinst
Executable file
9
cmake.packaging/postinst
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Register nvim as an alternative for vi and vim, view, editor
|
||||||
|
update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
|
||||||
|
update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
|
||||||
|
update-alternatives --install /usr/bin/view view /usr/bin/nvim 60
|
||||||
|
|
||||||
|
exit 0
|
||||||
10
cmake.packaging/prerm
Executable file
10
cmake.packaging/prerm
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = "remove" ]; then
|
||||||
|
update-alternatives --remove vi /usr/bin/nvim
|
||||||
|
update-alternatives --remove vim /usr/bin/nvim
|
||||||
|
update-alternatives --remove view /usr/bin/nvim
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user