git: 7b9dcf526392 - stable/13 - bsdinstall: fix prepopulating the ZFS disk menu with ZFSBOOT_DISKS

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Sun, 24 Jul 2022 15:40:41 UTC
The branch stable/13 has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b9dcf52639271931dadbc2c137ff0b9dc8ccb34

commit 7b9dcf52639271931dadbc2c137ff0b9dc8ccb34
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2022-05-26 22:20:03 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2022-07-24 15:39:44 +0000

    bsdinstall: fix prepopulating the ZFS disk menu with ZFSBOOT_DISKS
    
    If the ZFSBOOT_DISKS variable is set to one or more disk names, then
    those disks should be preselected in the disk menu.  However, the code
    wasn't correctly setting the variable, leaving all disks unselected.
    
    MFC after:      2 weeks
    Sponsored by:   Axcient
    Reviewed by:    dteske
    Differential Revision: https://reviews.freebsd.org/D35331
    
    (cherry picked from commit caf73e58579343fc1661f43554b30115bb940535)
    
    Fix a memory leak from caf73e58579
    
    Don't shadow an already-local variable with another local declaration.
    
    Reported by:    dteske
    MFC after:      13 days
    MFC with:       caf73e58579343fc1661f43554b30115bb940535
    Sponsored by:   Axcient
    Differential Revision:  https://reviews.freebsd.org/D35331
    
    (cherry picked from commit 77d678b7a4075a056be621b46be50377f08bfc9e)
---
 usr.sbin/bsdinstall/scripts/zfsboot | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index 14fbdd0d67fb..9a15bd719f5a 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -644,7 +644,7 @@ dialog_menu_layout()
 		while :; do
 			# Loop over list of available disks, resetting state
 			for disk in $disks; do
-				f_isset _${disk}_status && _${disk}_status=
+				f_isset _${disk}_status && setvar _${disk}_status
 			done
 
 			# Loop over list of selected disks and create temporary
@@ -654,7 +654,7 @@ dialog_menu_layout()
 					$disk $DEVICE_TYPE_DISK disk
 				f_isset _${disk}_status ||
 					local _${disk}_status
-				_${disk}_status=on
+				setvar _${disk}_status on
 			done
 
 			# Create the checklist menu of discovered disk devices