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/fresh" 10
  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/fresh"
  fi
fi
}
