post_install() {
if [ "$1" = 'configure' ] || [ "$1" = 'abort-upgrade' ] || [ "$1" = 'abort-deconfigure' ] || [ "$1" = 'abort-remove' ] || [ "pacman" = 'pacman' ]; then
  if [ -x "/data/data/com.termux/files/usr/bin/update-alternatives" ]; then
    # editor
    update-alternatives \
      --install "/data/data/com.termux/files/usr/bin/editor" "editor" "/data/data/com.termux/files/usr/bin/nano" 50 \
      --slave "/data/data/com.termux/files/usr/share/man/man1/editor.1.gz" "editor.1.gz" "/data/data/com.termux/files/usr/share/man/man1/nano.1.gz"
  fi
fi
}
pre_remove() {
if [ "$1" = 'remove' ] || [ "$1" != 'upgrade' ] || [ "pacman" = 'pacman' ]; then
  if [ -x "/data/data/com.termux/files/usr/bin/update-alternatives" ]; then
    update-alternatives --remove "editor" "/data/data/com.termux/files/usr/bin/nano"
  fi
fi
}
