From nobody Sat Feb 12 21:36:35 2022 X-Original-To: dev-commits-src-main@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 5F55C19B08F5; Sat, 12 Feb 2022 21:36:36 +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 4Jx3hh0q8Cz3qVG; Sat, 12 Feb 2022 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644701796; 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=5m8H9KFhY0HvnKx/Gn/Q912p091cTUUoPdWVNCBC4bw=; b=Fl4wd8iUsP+YHT4gUtHd5oVTzhqQ8ZTMo+GIDfL15myMGKqeJezi5AEwGsl/xrbdH8tXI6 Y091Ht2wF5mepi/CxMXWHIauiGUFUm2GiLWxzs2iE1aNsENV2i+/Jj1cKdKGex2NQqe3UU 3GtFnCaHYZ2MffYEnoxkvqQGdyFYuRyNnzg4kxcKAG5bELbPdvbbIHgmMaoukGt37zPJwd do+lB08AHPMKytPSsJN06R8xh0YklBd4G7Yv+JyN5or8sAXExwsJYDicBH2vxVwHsWc2oT uNBwZLtkPqi5aj0S+t5jcJucybhVYlSXHt1B99lXhSTk1ioXy1P9OzlBpkLeBQ== 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 E5EED70BF; Sat, 12 Feb 2022 21:36:35 +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 21CLaZGI031208; Sat, 12 Feb 2022 21:36:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21CLaZAT031207; Sat, 12 Feb 2022 21:36:35 GMT (envelope-from git) Date: Sat, 12 Feb 2022 21:36:35 GMT Message-Id: <202202122136.21CLaZAT031207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e01e8f911b93 - main - freebsd-update: improve BE creation feature List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: e01e8f911b935eabcc35b4d121951e4e21042ee5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644701796; 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=5m8H9KFhY0HvnKx/Gn/Q912p091cTUUoPdWVNCBC4bw=; b=axlcRiml8ezctU4OcurxSX2ovQm025cUNNBxsAPbpRspHC1mm0VK8TcxjpnGtQ8ZtgOA3X sESoDYEHmX0IZYTe7xSTQN00w8FAMv64T8qEytjRe6oAr1V1hJKtUV6K8ZGwujlWpnto4i iJK19oaBZm8MSaNQ3EsUV2rG2RiaoKkX4It7oOjqWJs6y8ZTuJLuCRFQxSwPEcgGEay71O UQEhE81PpjT93HZ6/5zpFdMH+OwbW1I4dWSaTX5fnp6pvHtHvig8HtmIKwbQXMg0160gPS SUP9/op7fUKTkfpu9SH+wMjArIgrI+3IODF2xyZYIpbiY0P+GTJQEzr14nJPLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644701796; a=rsa-sha256; cv=none; b=gxreVY4iUsqmKbX/Lm51RKNBPHkmt+qw+CwfJL05oFNarE77YGd7e7DrBn8A7B0Fekd/Yi BZwA68DZqY4NILYvye54ZIUAL3P6hZLv3vSBMzbCIkP9FK0dSEHnhCCEa/pLMHIFH7/8ao Bo2MqX1Z3L0rAA/KX3Qf3aK1SvUsJxPwdrRGUnSutevb+rGXlK8GQoB6gje6GEC/ZbWDHb nJnO5EFzqD9a3yFT8WYL7Ri41FnrMFfpYf1a1bWDETXDVjmvm5ezZkssRS74InOUXwCDgs GYdX69o4aYUFkKB3wna5olnI8ZKNwmIYQfvoZTVrsOyq+RDM2Wo8PV478QO+yQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e01e8f911b935eabcc35b4d121951e4e21042ee5 commit e01e8f911b935eabcc35b4d121951e4e21042ee5 Author: Kyle Evans AuthorDate: 2022-02-12 21:36:24 +0000 Commit: Kyle Evans CommitDate: 2022-02-12 21:36:24 +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 MFC after: 3 days Reviewed by: delphij, emaste, Dave Fullard Differential Revision: https://reviews.freebsd.org/D34257 --- 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