From nobody Tue Mar 15 18:16:11 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 41F9A1A24ADF; Tue, 15 Mar 2022 18:16:12 +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 4KJ1n75bQkz58sC; Tue, 15 Mar 2022 18:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647368172; 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=WyjTNGQ/iM7GgUAsfwoBeEXiVBGrLPNi+ys/qdUbuEQ=; b=OSKqm2j6rmL5+ysqi2nazhj7R3IFw+fV9CJE1WCRfJX+JTV+wDbglpNsLBwZtx71hYVIsR wMYKfPdtUtl3G4NW+uYn4JuvfGrODFonzY/NlBiNuo157G4z1zTq9feDQnhTFdd1cBTNr8 /Nm6LDlPlJxB/+oZmGETxzRBlNsoTsGd7e3gt2NRUfUkcd92qJV+glALk7ZYNQpVfZih8+ 8Kyo4Yjj1Ntg6FX6rfPuny8LPKKdx90YvR9gDxZ7sTLYz658hBdIpqq2i7YvBmzXNmV1BE Ll6U6PMvyk2S+vhRrpiwuREIYBSdsxGJy/FLDLDPqZy9NdpEyrva0Rs53Jdjew== 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 8E0BB26A91; Tue, 15 Mar 2022 18:16:11 +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 22FIGBsr075543; Tue, 15 Mar 2022 18:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22FIGB4a075542; Tue, 15 Mar 2022 18:16:11 GMT (envelope-from git) Date: Tue, 15 Mar 2022 18:16:11 GMT Message-Id: <202203151816.22FIGB4a075542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f0df8a13116d - releng/12.3 - 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: f0df8a13116dca6ac42334d23430160fbeaf6c09 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647368172; 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=WyjTNGQ/iM7GgUAsfwoBeEXiVBGrLPNi+ys/qdUbuEQ=; b=GXu+zDRiYh8UvGpdhJ/eT7qs7osbLH7UAcetGBSExbBXPgT9ieGFu3vkYEvcJ15HwU/ShR 3QHAEyB2QQWPs6Er4JrBrCdiAI8xb4xZuXf7B+2r6vOcFhnSe1FXE8k2s6+voxGI4eAdYh 8PNrJrcNXqtM9pc4z4jaDYSEsfmmkX0oXfODj5SXm+Dtcm4NaCVNJ00TJwWO6kgRkq8ryY Ls5Lu31uOyzuX6tyOSHTTQXSSsOvNBtXGjASjzDKgOYnDTshZ8o2BcpAUVLXwmSwTf0Ymr AXeDiUlpoXB3qhWUDlQSK3vutjH2Zpfn6vTjRIcRfpbcbKUTYyo0nSQj38wJlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647368172; a=rsa-sha256; cv=none; b=Mfuv/5ZSEFbud+r+nCFlC6L+/5U9S5hiXE6Jrk8FJ6t6SI5tAtywZGEAWv9jMsTOJQlrK0 qA0fY+NuJxIYzXp4y7o6Ptxkq/zqlUCVI1vZIyvqA5DqkOqIDrwj9m0yxjl+fGdZ5fnSXu UGxzbXnbkZTKFonlEkG+UqxEs/xkwWaDfnCSkj8Lj+el07oGbR1/ztgvEN0E6h5matnX9n 6iipecqM/k3/AaPxPPKRhRIe1Fcf6sRov0NLcJNGf1DtkwczVAF5jeAJmEB39ziA08HX8F QxMk+VHNm/mjWuIeSHAjF69Edq4gTHZxP+GioNaPYswqZSlSIQTSUqH+LC5ihg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f0df8a13116dca6ac42334d23430160fbeaf6c09 commit f0df8a13116dca6ac42334d23430160fbeaf6c09 Author: Kyle Evans AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Mark Johnston CommitDate: 2022-03-15 17:46: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) (cherry picked from commit 35d33d408213d20c63d60c0dfcdf77b2b36f5eee) Approved by: so Security: FreeBSD-EN-22:09.freebsd-update --- 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