git: ca7e12f7df22 - main - bsdinstall zfsboot: Add an option to edit the ZFS pool creation options

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 26 Dec 2024 14:47:49 UTC
The branch main has been updated by dim:

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

commit ca7e12f7df222458ec5cac8009c5b0931fb4a95b
Author:     Craig Leres <leres@FreeBSD.org>
AuthorDate: 2024-12-26 14:42:11 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-12-26 14:44:24 +0000

    bsdinstall zfsboot: Add an option to edit the ZFS pool creation options
    
    This allows the default options (-O compress=lz4 -O atime=off) to be
    overridden, before the ZFS boot pool is created. For example, to set the
    compression algorithm to something different.
    
    Reviewed by:    jhb, dim
    MFC after:      3 days
    Differential Revision: https://reviews.freebsd.org/D47478
---
 usr.sbin/bsdinstall/scripts/zfsboot | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index 1d38db2d0f15..45c023b06513 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -324,6 +324,9 @@ msg_unsupported_partition_scheme="%s is an unsupported partition scheme"
 msg_user_cancelled="User Cancelled."
 msg_yes="YES"
 msg_zfs_configuration="ZFS Configuration"
+msg_please_enter_options_for_your_zpool="Please enter options for your zpool"
+msg_zfs_options_name="ZFS Pool Options"
+msg_zfs_options_name_help="Customize ZFS options for the zpool to be created"
 
 ############################################################ FUNCTIONS
 
@@ -374,6 +377,8 @@ dialog_menu_main()
 		                        '$msg_swap_mirror_help'
 		'W $msg_swap_encrypt'   '$swapgeli'
 		                        '$msg_swap_encrypt_help'
+		'O $msg_zfs_options_name'   '$ZFSBOOT_POOL_CREATE_OPTIONS'
+		                        '$msg_zfs_options_name_help'
 	" # END-QUOTE
 	local defaultitem= # Calculated below
 	local hline="$hline_alnum_arrows_punc_tab_enter"
@@ -1853,6 +1858,13 @@ while :; do
 			ZFSBOOT_SWAP_ENCRYPTION=1
 		fi
 		;;
+	?" $msg_zfs_options_name")
+		# Prompt the user to input/change the pool options
+		f_dialog_input input \
+			"$msg_please_enter_options_for_your_zpool" \
+			"$ZFSBOOT_POOL_CREATE_OPTIONS" &&
+			ZFSBOOT_POOL_CREATE_OPTIONS="$input"
+		;;
 	esac
 done