2Pcjj ObLJ69twif0YXV0b3LvYe/74P0Msht1fv29yb/2nDDBe+SyZHUEKgWh+lLYTNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760728441; a=rsa-sha256; cv=none; b=VY9bnARcXm3EZhY9EYXVwjaRQwU/dCew+sxcNenu+xe8qPV71NGwl+Hyc92YuKRi64H9fr +4SBmWy3K4yPRXkMmMQ2bMBAFE+T2MSHKNoZOMhZrWU6m42lyCnFK+E3bMxjtIW/fejzT/ CnJCOGq0bk8tvrak9DPxiC+QJBkfQN01+mtQVO6cr4pkcE30KlHKOfYOYFitZzzvQhqnkT 8Tz/LuehX4a8/+pASfbzz8SpFjGQiVxr/mNwSofOjzbQgBPRWBkAIf43NC3jKw3Q0TPvXu y2m1IdvuCbXIF8FvqozM5KH9Y4ZBS9TuP6vwdcwHMf9wxlaV0sdLiugx/ictiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cpDyJ5hDFz16TS; Fri, 17 Oct 2025 19:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59HJE0If036250; Fri, 17 Oct 2025 19:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59HJE0uo036247; Fri, 17 Oct 2025 19:14:00 GMT (envelope-from git) Date: Fri, 17 Oct 2025 19:14:00 GMT Message-Id: <202510171914.59HJE0uo036247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 74a6bb524e5b - main - Makefile: Don't allow install{world,kernel} with pkgbase List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74a6bb524e5b9ad654a9acc5da5c195f406717b5 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=74a6bb524e5b9ad654a9acc5da5c195f406717b5 commit 74a6bb524e5b9ad654a9acc5da5c195f406717b5 Author: Lexi Winter AuthorDate: 2025-10-17 19:06:17 +0000 Commit: Lexi Winter CommitDate: 2025-10-17 19:13:13 +0000 Makefile: Don't allow install{world,kernel} with pkgbase Using these targets on a pkgbase system will cause the installed system to become out of sync with the package database, which is almost certain to cause issues the next time pkg(8) is used. To prevent users doing this accidentally, disallow install* if we detect that FreeBSD-runtime is installed in the target. The check can be overridden with DESTDIR=/ for users who are sure they want to do this. MFC after: 3 days Reviewed by: emaste Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D52879 --- Makefile.inc1 | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index a86dead09aa1..e341599ac505 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -587,7 +587,16 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g} .endif # !defined(_MKSHOWCONFIG) +PKG_NAME_PREFIX?= FreeBSD +PKG_MAINTAINER?= re@FreeBSD.org +PKG_WWW?= https://www.FreeBSD.org +PKG_WORKERS_COUNT?= 1 + .if make(*package*) +.export PKG_NAME_PREFIX +.export PKG_MAINTAINER +.export PKG_WWW + .if !defined(PKG_TIMESTAMP) .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD @@ -598,14 +607,6 @@ SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} .else SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} .endif -PKG_WORKERS_COUNT?= 1 - -PKG_NAME_PREFIX?= FreeBSD -PKG_MAINTAINER?= re@FreeBSD.org -PKG_WWW?= https://www.FreeBSD.org -.export PKG_NAME_PREFIX -.export PKG_MAINTAINER -.export PKG_WWW .endif .if !defined(_MKSHOWCONFIG) @@ -1353,6 +1354,28 @@ __installcheck_DESTDIR: .PHONY .endif .endif +# +# Don't allow installworld or installkernel on a pkgbase system. This avoids +# accidentally updating a pkgbase system with install{world,kernel}, causing +# the installed system to become out of date with the package database. +# +# Skip the check if DESTDIR is defined on the assumption the user knows what +# they're doing. This means the check can be disabled for the running system +# using DESTDIR=/. +# +.if !make(distributeworld) && !defined(DESTDIR) +_installcheck_world: __installcheck_PKG +_installcheck_kernel: __installcheck_PKG +__installcheck_PKG: .PHONY +.if exists(${LOCALBASE}/sbin/pkg-static) + @if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \ + echo >&2 "ERROR: This target should not be used on a system installed from packages." ; \ + echo >&2 " To override this check, set DESTDIR=/."; \ + false; \ + fi +.endif +.endif + .if !defined(DB_FROM_SRC) # # Check for missing UIDs/GIDs.