Index: usr.sbin/freebsd-update/freebsd-update.sh =================================================================== --- usr.sbin/freebsd-update/freebsd-update.sh +++ usr.sbin/freebsd-update/freebsd-update.sh @@ -1102,6 +1102,35 @@ fetch_setup_verboselevel } +# Packaged base and freebsd-update are incompatible. Exit with an error if +# packaged base is in use. +check_pkgbase() +{ + # No pkg database implies packaged base is not in use. + if [ ! -f ${BASEDIR}/var/db/pkg/local.sqlite ]; then + return + fi + # Check that pkg is bootstrapped. + if [ -z "${LOCALBASE}" ]; then + LOCALBASE=$(sysctl -n user.localbase 2>/dev/null) + fi + if [ -z "${LOCALBASE}" ]; then + LOCALBASE=/usr/local + fi + if [ ! -x "${LOCALBASE}"/sbin/pkg ]; then + return + fi + # Presence of FreeBSD-* package(s) indicates packaged base. + if ! pkg -c ${BASEDIR} info -q -x '^FreeBSD' 2>//dev/null; then + return + fi + cat <