aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bsdinstall
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2021-12-08 10:37:50 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2021-12-15 14:24:07 +0000
commit9935b0e8ea41804b32576987531be4d31ba705f1 (patch)
tree38b1d57aab6976027c7ff4639125a49a2476c910 /usr.sbin/bsdinstall
parent40c928e7b80a7e2ba3652f7c3dc1d30fe92e5b48 (diff)
Diffstat (limited to 'usr.sbin/bsdinstall')
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot32
1 files changed, 32 insertions, 0 deletions
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index 45c8b001c393..4867538354cb 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -1573,6 +1573,28 @@ dialog_menu_diskinfo()
return $SUCCESS
}
+dialog_zpool_name()
+{
+ local prompt="$* is already taken, please enter a name for the ZFS pool \
+ (Or confirm using the same name by just pressing enter)"
+ local hline=
+ local value="$*"
+ local height width
+
+ f_dialog_inputbox_size height width \
+ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$prompt" "$value" "$hline"
+
+ $DIALOG \
+ --title "$DIALOG_TITLE" \
+ --backtitle "$DIALOG_BACKTITLE" \
+ --hline "$hline" \
+ --ok-label "Ok" \
+ --no-cancel \
+ --inputbox "$prompt" \
+ $height $width "$value" \
+ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
+}
+
############################################################ MAIN
#
@@ -1591,6 +1613,16 @@ f_dprintf "BSDINSTALL_CHROOT=[%s]" "$BSDINSTALL_CHROOT"
f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSDINSTALL_TMPETC"
f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT"
+pools=$(zpool import | awk '$1 == "pool:" { print $2}')
+for pool in ${pools}; do
+ f_dprintf "Checking ${pool} against ${ZFSBOOT_POOL_NAME}"
+ if [ "${pool}" = "${ZFSBOOT_POOL_NAME}" ]; then
+ f_dprintf "Pool ${pool} already taken"
+ ZFSBOOT_POOL_NAME=$(dialog_zpool_name "${ZFSBOOT_POOL_NAME}")
+ break;
+ fi
+done
+
#
# Determine default boot type
#