Use the alternatives system for vi providers
Make build.sh scripts of vim, vim-python, neovim and vis use the alternatives system (update-alternatives) to provide the "vi" command.
This commit is contained in:
parent
7535177e70
commit
0267184ad3
@ -44,3 +44,27 @@ termux_step_post_make_install() {
|
||||
mkdir -p $_CONFIG_DIR
|
||||
cp $TERMUX_PKG_BUILDER_DIR/sysinit.vim $_CONFIG_DIR/
|
||||
}
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
cat <<- EOF > ./postinst
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
if [ "\$1" = "configure" ] || [ "\$1" = "abort-upgrade" ]; then
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/editor editor $TERMUX_PREFIX/bin/nvim 40
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/vi vi $TERMUX_PREFIX/bin/nvim 15
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
|
||||
cat <<- EOF > ./prerm
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
if [ "\$1" != "upgrade" ]; then
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --remove editor $TERMUX_PREFIX/bin/nvim
|
||||
update-alternatives --remove vi $TERMUX_PREFIX/bin/nvim
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
}
|
@ -73,9 +73,6 @@ termux_step_post_make_install() {
|
||||
cp $TERMUX_PREFIX/share/vim/vim82/tutor/{tutor,tutor.vim,tutor.utf-8} $TERMUX_PKG_TMPDIR/
|
||||
rm -f $TERMUX_PREFIX/share/vim/vim82/tutor/*
|
||||
cp $TERMUX_PKG_TMPDIR/{tutor,tutor.vim,tutor.utf-8} $TERMUX_PREFIX/share/vim/vim82/tutor/
|
||||
|
||||
cd $TERMUX_PREFIX/bin
|
||||
ln -f -s vim vi
|
||||
}
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
@ -85,6 +82,8 @@ termux_step_create_debscripts() {
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/editor editor $TERMUX_PREFIX/bin/vim 50
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/vi vi $TERMUX_PREFIX/bin/vim 20
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
@ -94,6 +93,7 @@ termux_step_create_debscripts() {
|
||||
if [ "\$1" != "upgrade" ]; then
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --remove editor $TERMUX_PREFIX/bin/vim
|
||||
update-alternatives --remove vi $TERMUX_PREFIX/bin/vim
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
|
@ -59,9 +59,6 @@ termux_step_post_make_install() {
|
||||
cp $TERMUX_PREFIX/share/vim/vim82/tutor/{tutor,tutor.vim,tutor.utf-8} $TERMUX_PKG_TMPDIR/
|
||||
rm -f $TERMUX_PREFIX/share/vim/vim82/tutor/*
|
||||
cp $TERMUX_PKG_TMPDIR/{tutor,tutor.vim,tutor.utf-8} $TERMUX_PREFIX/share/vim/vim82/tutor/
|
||||
|
||||
cd $TERMUX_PREFIX/bin
|
||||
ln -f -s vim vi
|
||||
}
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
@ -71,6 +68,8 @@ termux_step_create_debscripts() {
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/editor editor $TERMUX_PREFIX/bin/vim 50
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/vi vi $TERMUX_PREFIX/bin/vim 20
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
@ -80,6 +79,7 @@ termux_step_create_debscripts() {
|
||||
if [ "\$1" != "upgrade" ]; then
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --remove editor $TERMUX_PREFIX/bin/vim
|
||||
update-alternatives --remove vi $TERMUX_PREFIX/bin/vim
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
|
@ -12,3 +12,27 @@ TERMUX_PKG_BUILD_IN_SRC=true
|
||||
termux_step_pre_configure() {
|
||||
CFLAGS+=" -I$TERMUX_PREFIX/include/lua5.3"
|
||||
}
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
cat <<- EOF > ./postinst
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
if [ "\$1" = "configure" ] || [ "\$1" = "abort-upgrade" ]; then
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/editor editor $TERMUX_PREFIX/bin/vis 30
|
||||
update-alternatives --install \
|
||||
$TERMUX_PREFIX/bin/vi vi $TERMUX_PREFIX/bin/vis 10
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
|
||||
cat <<- EOF > ./prerm
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
if [ "\$1" != "upgrade" ]; then
|
||||
if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then
|
||||
update-alternatives --remove editor $TERMUX_PREFIX/bin/vis
|
||||
update-alternatives --remove vi $TERMUX_PREFIX/bin/vis
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user