From nobody Tue Feb 15 06:10:21 2022 X-Original-To: dev-commits-src-branches@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 4E75B19C5976; Tue, 15 Feb 2022 06:10:21 +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 4JyW0Y1h7Hz4qQx; Tue, 15 Feb 2022 06:10:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644905421; 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=2CfOk5xi4Fg2ShVXJ3EcJGlxxOh/IEo9qdmumIcqE3A=; b=atr09jjp9xATLdtRYZ9a1yAHe8EzYBIIizluYySIp/GgnRqsf8Bllhx0zJI2/Wm3RmSd9d 98Fo5iUrgBebG/yafCOTUxJiutUZbG/pyk+KJvSFgOrtTPQlcLJ0C8ou9c2x4uaXBzRV4S RPk8Uwm1HVIThg44JKfnDFuXmIkTxOQ2MpT9uDc4sECDowxxKcULGRBK7QmxJVSp4C/Rxr uqMhMSe+dILsGY+uHTKw68IjK+JFGoERZMGpeRwreiV6k5JyiIRkfoeEw3osYsRn9SZoIJ +zqqTjk75Nwv7X7zRZa7rYIoj3ZqGp92040AVnE4YMbVeuJSdWJsbmFu0hHYrA== 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 19EAE1D53A; Tue, 15 Feb 2022 06:10:21 +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 21F6ALwm075260; Tue, 15 Feb 2022 06:10:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21F6ALFA075256; Tue, 15 Feb 2022 06:10:21 GMT (envelope-from git) Date: Tue, 15 Feb 2022 06:10:21 GMT Message-Id: <202202150610.21F6ALFA075256@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: 47c07814051a - stable/13 - freebsd-update: improve BE creation feature List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 47c07814051a86fec9088a1f78d64fdada8abed6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644905421; 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=2CfOk5xi4Fg2ShVXJ3EcJGlxxOh/IEo9qdmumIcqE3A=; b=yKgZEE9hOMDchJzZEP4hVJrmjzxanA42dR0gSJHc0omWTfLXmoXT2hYab7gitPeRoaPwe3 249UV0c2trTnb43gJeMNHiV0NJ0eoA9wTGZQnmNr3O5/xATppsGQFNqgpdD6soIbwIffcT q8+Rp82ogK3hVRCt3ms+vlvMjFkTPuOnTEY82JD0x8FEN0eH7IYC45cse29dcsOmvqfSo3 9f9g1qLF+Jvt5+i1yIrnvpCVftJfDEzTWSfTXDEKy73SpAD4sUgcQUoOzkSUUoJSRpUYuA 2zRGHNVVxRUGT2k6+7wnQSVMcjjitMZzm8oPa24P++a/liYAPXcOK6Sl3rdMTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644905421; a=rsa-sha256; cv=none; b=KSG3Lt62cdpL4Zn3QMw1zrY+IDxqN6ZXKyCG4StgTWluuZZVZusgY5e9LYOr8rFSK4V8es fkgjnOF4Q9YLGlWFHqz4c8gDx5zkG7rD0TVErq7bXAvq/4DNtmjyiErg9ixj9rJLV+Dm2c J3d+POGJwrkHdzH+jFyEP/8vhgkWAGRNGh65iR4Ht5g4aneZKElTpX23sHSHiycECXSk8Z RFrSsUpHRxIxoCP8OKlZxUxx9Ik18I7Fo3seLb8nNxM7RY/zWvpChmLdVa5CA3AIOOENfr ZrnFtGgG+8ffZ66AL/JCHw+L3/UoS5rn8rLiRokKdTjA6RfdQKuzwqi4xCkExA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=47c07814051a86fec9088a1f78d64fdada8abed6 commit 47c07814051a86fec9088a1f78d64fdada8abed6 Author: Kyle Evans AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Kyle Evans CommitDate: 2022-02-15 06:09:50 +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