Page MenuHomeFreeBSD

D47341.id145697.diff
No OneTemporary

D47341.id145697.diff

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 <<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
@@ -3532,6 +3561,7 @@
# Fetch files for upgrading to a new release.
cmd_upgrade () {
+ check_pkgbase
finalize_components_config ${COMPONENTS}
upgrade_check_params
upgrade_check_kmod_ports
@@ -3566,6 +3596,7 @@
# Install downloaded updates.
cmd_install () {
+ check_pkgbase
finalize_components_config ${COMPONENTS}
install_check_params
install_create_be
@@ -3574,6 +3605,7 @@
# Rollback most recently installed updates.
cmd_rollback () {
+ check_pkgbase
finalize_components_config ${COMPONENTS}
rollback_check_params
rollback_run || exit 1

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 12:52 AM (6 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29263711
Default Alt Text
D47341.id145697.diff (1 KB)

Event Timeline