git: be0d16b0b05c - main - bsdinstall: filter out disks that are unavailable from the list of options in ZFS

From: Brad Davis <brd_at_FreeBSD.org>
Date: Sun, 10 Apr 2022 21:15:37 UTC
The branch main has been updated by brd:

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

commit be0d16b0b05c2dea432e4de1cae03b32f8a55ca3
Author:     Brad Davis <brd@FreeBSD.org>
AuthorDate: 2022-04-10 19:59:31 +0000
Commit:     Brad Davis <brd@FreeBSD.org>
CommitDate: 2022-04-10 21:09:14 +0000

    bsdinstall: filter out disks that are unavailable from the list of options in ZFS
    
    Reviewed by:    allanjude, rew
    Differential Revision:  https://reviews.freebsd.org/D34167
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 usr.sbin/bsdinstall/scripts/zfsboot | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index 1c689af5c497..ab2cfba04d29 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -533,6 +533,15 @@ dialog_menu_layout()
 	done
 	disks="${new_list# }"
 
+	# Prune out disks that are not available to install to
+	local avail_disks=
+	for disk in $disks; do
+		debug= $disk get name name
+		geom disk list $name | awk '$1 == "Mode:" && $2 != "r0w0e0" { exit 1 }'
+		[ $? -eq 0 ] && avail_disks="$avail_disks $disk"
+	done
+	disks="${avail_disks# }"
+
 	# Debugging
 	if [ "$debug" ]; then
 		local disk_names=