From nobody Fri Jan 13 20:59:38 2023 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 4Ntv1R1k43z2pC5V; Fri, 13 Jan 2023 20:59:39 +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 4Ntv1R0qMlz3t4s; Fri, 13 Jan 2023 20:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673643579; 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=/9R0jWtL83RfoX3mXbmmKQtyLgsHT/sNDP39eydoops=; b=dUWblK+hTBSTT867gdaNrIywpihMLC60k9kXWt7mCdGfSX1wVCYMDHl6TW3Ce+VOsHeItV bxZ3goQ13oeqR8KMefbVzy9uyCXELwKKgNoJ2Ev7RGo55qiw44HHXK8AcW09pSWgEZLtNw kYqH8FCL2TFUJUaRkNnci0E1bu5CT1Q10Ii8OukpGCZTMoodR8y8VFDG3+qCCC8iEVZo+r UPgVL6aoCD0RBO3vO+dGGe1wQ8rFSxknzN4JuQ1BkcHmyprS+4YM2+zIueJV6vSXslggeF FXftXlxC4ETsEsKZJ0HBWxzJSjNh4A+YKoBVqN94q2XkDPjpcxuzBYZChAsH0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673643579; 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=/9R0jWtL83RfoX3mXbmmKQtyLgsHT/sNDP39eydoops=; b=P6vcxP7z+Hc/BFb65D7KX2PRPfJULQ/3d1dbRl7zMc2CjuD1JoX8MyGnvGjclLBiE1krO2 bWUuoF8a4aH/07qIne/Fvqn649GemKn6pdQq9ZYSXFJRzNo3L6pZg5H/9PG96FeJ+fDhUx OAI9PxQdRa9owgSkkRtiFROMGEJH+x4eaemIek557DO7Iig+9wBGgi9C/mcy/qFG700v7X GSxoF4ngxLpy8HH0+qZAyHFoKiqB6Dy0Ii+ZswJEMwmrnn0F2FeD30ZIB7vbprNDmB/1bB RY0Nly0EyzxrWFmq/MoI1QOKV0lUygl5osE1U2eVxpt222RqAf2IGI1sW/X+vA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673643579; a=rsa-sha256; cv=none; b=fTf+k85blnQfRjHs1fvrzpw1CZqAOneM9DihgXoyvzbP4J/aLKtAb17AH3ywHqRBTRgeOk qJx+Qobx9ZgFykK/yXz3khJ+t2l8HbREQYRw0lnJdRSBbMuKK5uFeCgGjavbZInqQp3BRK bOUecCrvoQVzxVBVUi/giQANCjG34o1YXmm/R0wEGnlTmNGd87AI9xcP0r4Ie64jyIT9Gk AQgUmLbq5DjKyy1jvuM05Mb7zIJc4KmhJsvXO449+IhbynE2v4s9N2k8Vq+608KfdDUnBu VTdRGwaUbFDl/vQe9LJkM6BF8nAfWMdTax/No5MN57I0fd0f1q+jhYvesBCq9g== 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 4Ntv1Q6qhxzM8k; Fri, 13 Jan 2023 20:59:38 +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 30DKxc3w097027; Fri, 13 Jan 2023 20:59:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DKxcjg097026; Fri, 13 Jan 2023 20:59:38 GMT (envelope-from git) Date: Fri, 13 Jan 2023 20:59:38 GMT Message-Id: <202301132059.30DKxcjg097026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: e51074735fa3 - stable/13 - MFC growfs script change from August 2021: 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: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e51074735fa32fb48496bdc0dd3799eaf84afd19 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=e51074735fa32fb48496bdc0dd3799eaf84afd19 commit e51074735fa32fb48496bdc0dd3799eaf84afd19 Author: Scott Long AuthorDate: 2021-08-17 21:50:18 +0000 Commit: Mike Karels CommitDate: 2023-01-13 19:11:30 +0000 MFC growfs script change from August 2021: - Fix the growfs rc script to cope with diskid labels. - Fix a warning in growfs. gpart commit is supposed to be called on disk device. - Silence a gpart commit warning in growfs. Submitted by: loos Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31587 Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 045001075ed18295288176211456dde3df7faf46) --- libexec/rc/rc.d/growfs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs index c2955c740d43..5402bd442279 100755 --- a/libexec/rc/rc.d/growfs +++ b/libexec/rc/rc.d/growfs @@ -48,6 +48,19 @@ start_cmd="growfs_start" stop_cmd=":" rcvar="growfs_enable" +growfs_get_diskdev () +{ + local _search=${1} + sysctl -b kern.geom.conftxt | + while read x1 _type _dev line + do + if [ "${_type}" = "DISK" -a -n "$(echo ${_search} | grep ${_dev})" ]; then + echo -n ${_dev} + break + fi + done +} + growfs_start () { echo "Growing root partition to fill device" @@ -69,13 +82,24 @@ growfs_start () # raw device rawdev="$rootdev" else - rawdev=$(glabel status | awk '$1 == "'"$rootdev"'" { print $3 }') + rawdev=$(glabel status | awk -v rootdev=$rootdev 'index(rootdev, $1) { print $3; }') if [ x"$rawdev" = x"" ]; then echo "Can't figure out device for: $rootdev" return fi fi + if [ x"diskid" = x"${rootdev%/*}" ]; then + search=$rootdev + else + search=$rawdev + fi + + diskdev=$(growfs_get_diskdev ${search}) + if [ -z "${diskdev}" ]; then + diskdev=${rootdev} + fi + sysctl -b kern.geom.conftxt | awk ' { lvl=$1 @@ -104,8 +128,8 @@ growfs_start () } exit 0 } -}' dev="$rawdev" - gpart commit "$rootdev" +}' dev="$search" + gpart commit "$diskdev" 2> /dev/null case "$FSTYPE" in ufs) growfs -y /dev/"$rootdev"