#!/bin/sh

: "${PORTSDIR:=/usr/ports}"

if [ -f ${PORTSDIR}/Mk/bsd.pkgng.mk ]; then
	FORCE_POST=$(make _POSTMKINCLUDED=1 -f ${PORTSDIR}/Mk/bsd.pkgng.mk -V _FORCE_POST_PATTERNS)
else
	FORCE_POST="rmdir kldxref mkfontscale mkfontdir fc-cache fonts.dir fonts.scale gtk-update-icon-cache gio-querymodules gtk-query-immodules ldconfig load-octave-pkg update-desktop-database update-mime-database gdk-pixbuf-query-loaders catalog.ports glib-compile-schemas"
fi

FORCE_PORT=$FORCE_POST /usr/local/sbin/pkg convert

# Delete the portupgrade pkgdb to avoid discrepencies. It will be auto recreated.
rm -f /var/db/pkg/pkgdb.db > /dev/null 2>&1
