Browse Source

micro: add dpkg alternatives support

Provide $PREFIX/bin/micro as alternative for $PREFIX/bin/editor.
android-5
Leonid Plyushch 6 years ago
parent
commit
6a9981be1c
No known key found for this signature in database GPG Key ID: 45F2964132545795
  1. 24
      packages/micro/build.sh

24
packages/micro/build.sh

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

Loading…
Cancel
Save