MINGW_INSTALL=ucrt64

post_install() {
  cd ${MINGW_INSTALL}
  local _prefix=$(cygpath -m "$(pwd)")
  cd -
  #fix 'texmf.cnf'
  sed -e "s|/${MINGW_INSTALL}|${_prefix}|g" \
  -i ${_prefix}/etc/texmf/web2c/texmf.cnf
  sed -e "s|/${MINGW_INSTALL}|${_prefix}|g" \
  -i ${_prefix}/share/texmf-dist/web2c/texmf.cnf

  # fix'texmfcnf.lua'
  sed -e "s|/${MINGW_INSTALL}|${_prefix}|g" \
  -i ${_prefix}/share/texmf-dist/web2c/texmfcnf.lua

  # fix 09-texlive-fonts.conf
  sed -e "s|/${MINGW_INSTALL}|${_prefix}|g" \
  -i ${_prefix}/share/fontconfig/conf.avail/09-texlive-fonts.conf

  echo ">>> updmap custom entries should go into /$_prefix/etc/texmf/web2c/updmap-local.cfg"
  echo ">>> fmtutil custom entries should go into /$_prefix/etc/texmf/web2c/fmtutil-local.cnf"
  #echo "NB: To setup ConTeXt and the lua(la)tex font db,"
  #echo "    see http://wiki.archlinux.org/index.php/TeX_Live"
}

post_upgrade() {
  post_install
}
