From nobody Tue Feb 15 06:10:26 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DE99719C5C3A; Tue, 15 Feb 2022 06:10:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JyW0f4yJlz4qTT; Tue, 15 Feb 2022 06:10:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644905426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gQZk3daO8hXUBCHT4ovTaLeUSrVuuR4jxxretTSyzio=; b=mBxzHtpiSbONfVV6sNM6/E54XAon5/Lhcoja6NMtCyx7DD2ujO6hcABm7qcWabR0XaH6os ++++KMcEKh7/fPXXQCBqUtNqxMovny04WzcAKV4EPc59PNoGvsDGNR+ClWu/A2Oi7KZUiL k2RozUeurslbspbr9cHMmZQLYKiUoEd+KMSC3K5vANW6Xq/t8ydSdGRLH0l8MhjTw4JSmB a5GKiVhS0i1IYA1IFhzOD/K1v0K6UQnd9T72I4UFCIi/G6+NhRbA3UOOZwqpvabpoSInsB RyufsK3eI48LKlip9DGQmdbTYUS6Eas1mRgYpbMXeIwocFynXHzKAgjx72LERg== 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 7963C1D41E; Tue, 15 Feb 2022 06:10:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21F6AQ0K075902; Tue, 15 Feb 2022 06:10:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21F6AQCj075901; Tue, 15 Feb 2022 06:10:26 GMT (envelope-from git) Date: Tue, 15 Feb 2022 06:10:26 GMT Message-Id: <202202150610.21F6AQCj075901@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 35d33d408213 - stable/12 - freebsd-update: improve BE creation feature 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 35d33d408213d20c63d60c0dfcdf77b2b36f5eee Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644905426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gQZk3daO8hXUBCHT4ovTaLeUSrVuuR4jxxretTSyzio=; b=XvbABhIsWBcQ2CDVjAcgqPuQ6JIHVgIuSk0XVLeIh4EWrJgt5SbdVHqfd8wyIc8d50i/1/ wqls2cawXnG5DKLkv32nFtLRGiwmI33qDdt5H4TB0HuBB1YhfXpyuJj1dKE9SLJ783Zm3P hsV6++RxUktNxOsTAvprm2Vr8p7LTkNyhh2DZ5atwGi6JbIRnaA0QAV6/9Vz5cPjqN3I/B WRY6d9fIz/qFpR1SkFPikK6YDRmuQTVkeS/uXoTPVrPk4wzLkzTGMG04wrPY6kYgCyMT+4 SrfhzGxZoCCf6UO9Meil+CYuTSGo3hmBOsDa32jpFLn5PGktLeZbCtJdn0NR7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644905426; a=rsa-sha256; cv=none; b=WVBYXI5vEnObF3f1wevHCq24Ra95sNwK4HRJeP9AasJPP4+urWbkqUZNgi5oLrLSzpSE6i It9aHCweNMWkJXgE2oK0SLIEAj8EswDu2ybpFlUJ5D8h4d065yqVa1w9P2RHRjJu3V1mLC R8NVXmhfVDOXloPkRkBuvuuT9n15C9TPH/F+63S1JaxQtXuyCkKfLKirhBdxfwMLLHjwsY 8eX/LUW3jWvmYOEYLxBAwKBZ0lsFbEwiJ18RcUCSvErG3vAVe4SjKjlyCKnNwFDWnXb6nu oJLf+I/vgmEeLdIBjQNH/zV+rQG8BRqbFpJVxLFxZmfcemA0iRTwrJcKm8ujrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=35d33d408213d20c63d60c0dfcdf77b2b36f5eee commit 35d33d408213d20c63d60c0dfcdf77b2b36f5eee Author: Kyle Evans AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Kyle Evans CommitDate: 2022-02-15 06:09:41 +0000 freebsd-update: improve BE creation feature This addresses one nit and one bug in the BE creation feature of freebsd-update: The nit addressed is that it currently only names the BEs after the userland version, but the kernel version may be higher. After this change, we request both and pass them through sort(1) to choose the highest. This is especially helpful if a freebsd-update patch touched one but not the other. The bug fixed is that roots updated that are not located at '/', e.g., by using -b or -j, will no longer create boot environments automatically. There's a very low chance these will actually change the BE in any meaningful way, anyways. It could make sense in the future to allow an argument-override to create the BE anyways if someone comes up with a non-standard setup, e.g., where a jail is an important part of their boot environment on an appliance or some such setup. Half of this patch is submitted by delphij@, the other half kevans@. PR: 261446 (cherry picked from commit e01e8f911b935eabcc35b4d121951e4e21042ee5) --- usr.sbin/freebsd-update/freebsd-update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 1776115d0776..9743cd652d16 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -890,7 +890,12 @@ install_check_params () { install_create_be () { # Figure out if we're running in a jail and return if we are if [ `sysctl -n security.jail.jailed` = 1 ]; then - return 1 + return 1 + fi + # Operating on roots that aren't located at / will, more often than not, + # not touch the boot environment. + if [ "$BASEDIR" != "/" ]; then + return 1 fi # Create a boot environment if enabled if [ ${BOOTENV} = yes ]; then @@ -911,7 +916,7 @@ install_create_be () { esac if [ ${CREATEBE} = yes ]; then echo -n "Creating snapshot of existing boot environment... " - VERSION=`freebsd-version -k` + VERSION=`freebsd-version -ku | sort -V | tail -n 1` TIMESTAMP=`date +"%Y-%m-%d_%H%M%S"` bectl create ${VERSION}_${TIMESTAMP} if [ $? -eq 0 ]; then