1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-26 01:17:07 +00:00

micro: add dpkg alternatives support

Provide $PREFIX/bin/micro as alternative for $PREFIX/bin/editor.
This commit is contained in:
Leonid Pliushch 2019-08-10 03:01:45 +03:00
parent 991a6d70c0
commit 7c8576feb2

View File

@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://micro-editor.github.io/
TERMUX_PKG_DESCRIPTION="Modern and intuitive terminal-based text editor"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_VERSION=1.4.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=0b516826226cf1ddf2fbb274f049cab456a5c162efe3d648f0871564fadcf812
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/zyedidia/micro/releases/download/v${TERMUX_PKG_VERSION}/micro-${TERMUX_PKG_VERSION}-src.tar.gz
TERMUX_PKG_SHA256=0b516826226cf1ddf2fbb274f049cab456a5c162efe3d648f0871564fadcf812
termux_step_make() {
return
@ -24,3 +24,24 @@ termux_step_make_install() {
make build-quick
mv micro $TERMUX_PREFIX/bin/micro
}
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/micro 30
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/micro
fi
fi
EOF
}