git: 8a16a2cb0978 - stable/13 - growfs script: fix config-dependent errors

From: Mike Karels <karels_at_FreeBSD.org>
Date: Fri, 13 Jan 2023 20:59:45 UTC
The branch stable/13 has been updated by karels:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a16a2cb09787edd6910d56112ff0aadfc387258

commit 8a16a2cb09787edd6910d56112ff0aadfc387258
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2023-01-04 18:25:54 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2023-01-13 19:15:54 +0000

    growfs script: fix config-dependent errors
    
    - awk sometimes formatted swapbase as floating point, which gpart
      does not accept; force int.
    
    - Fix typo in code for checking vm.max_swap_pages.
    
    - While here, do not set kernel env if "gpart add" fails.
    
    - Add "gpart show" before modification to verbose output.
    
    Reported by:    marklmi at yahoo dot com
    Tested by:      marklmi at yahoo dot com
    
    (cherry picked from commit 0e2fdab227a1e02956271e5a15403d1408de1eed)
---
 libexec/rc/rc.d/growfs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs
index 3c738e24177e..4cd4f19c8eac 100755
--- a/libexec/rc/rc.d/growfs
+++ b/libexec/rc/rc.d/growfs
@@ -89,7 +89,7 @@ growfs_swap_max()
 
 	if [ $swapmax -gt $vm_swap_max ]
 	then
-		$swapmax=$vm_swap_max
+		swapmax=$vm_swap_max
 	fi
 	echo -n "$swapmax"
 }
@@ -260,9 +260,9 @@ growfs_start()
 						" sz ", size[i]
 					swapbase = (expand + size[i]) / sector
 					swapbase -= swapsize + align
-					swapcmd = "gpart add -t freebsd-swap -a " align " -b " swapbase " " pdev "; kenv growfs_swap_pdev=" pdev " >/dev/null; "
+					swapcmd = "gpart add -t freebsd-swap -a " align " -b " int(swapbase) " " pdev " && kenv growfs_swap_pdev=" pdev " >/dev/null; "
 					if (verbose)
-						swapcmd = "set -x; " swapcmd
+						swapcmd = "set -x; gpart show; " swapcmd
 				}
 				cmd[i] = swapcmd "gpart resize -i " idx[i] " " pdev
 				if (parttype[i] == "GPT")