Skip to content

Commit

Permalink
freebsd-update: refuse to operate on a pkgbase system
Browse files Browse the repository at this point in the history
FreeBSD-update is not compatible with packaged base.

PR:		282252
Reviewed by:	bapt, markj (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47341
  • Loading branch information
emaste committed Oct 31, 2024
1 parent 68e0137 commit cf1aba2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions usr.sbin/freebsd-update/freebsd-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,25 @@ IDS_check_params () {
fetch_setup_verboselevel
}

# Packaged base and freebsd-update are incompatible. Exit with an error if
# packaged base is in use.
check_pkgbase()
{
# Packaged base requires that pkg is bootstrapped.
if ! pkg -c ${BASEDIR} -N >/dev/null 2>/dev/null; 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 <<EOF
FreeBSD-update is incompatible with the use of packaged base. Please see
https://wiki.freebsd.org/PkgBase for more information.
EOF
exit 1
}

#### Core functionality -- the actual work gets done here

# Use an SRV query to pick a server. If the SRV query doesn't provide
Expand Down Expand Up @@ -3517,6 +3536,7 @@ cmd_cron () {

# Fetch files for upgrading to a new release.
cmd_upgrade () {
check_pkgbase
finalize_components_config ${COMPONENTS}
upgrade_check_params
upgrade_check_kmod_ports
Expand Down Expand Up @@ -3551,6 +3571,7 @@ cmd_updatesready () {

# Install downloaded updates.
cmd_install () {
check_pkgbase
finalize_components_config ${COMPONENTS}
install_check_params
install_create_be
Expand All @@ -3559,6 +3580,7 @@ cmd_install () {

# Rollback most recently installed updates.
cmd_rollback () {
check_pkgbase
finalize_components_config ${COMPONENTS}
rollback_check_params
rollback_run || exit 1
Expand Down

0 comments on commit cf1aba2

Please sign in to comment.