From nobody Thu Dec 30 09:10:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F12BA1927782; Thu, 30 Dec 2021 09:10:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JPjCq3vYpz4fsh; Thu, 30 Dec 2021 09:10:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 666B015D27; Thu, 30 Dec 2021 09:10:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BU9AF0I097102; Thu, 30 Dec 2021 09:10:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BU9AFQY097099; Thu, 30 Dec 2021 09:10:15 GMT (envelope-from git) Date: Thu, 30 Dec 2021 09:10:15 GMT Message-Id: <202112300910.1BU9AFQY097099@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 52ce808aba3f - stable/13 - bsdinstall: zfsboot: Prompt user for zpool name if the pool already exists List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 52ce808aba3f8b0dfd7529b530232e327af704a3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640855415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mkuBPj1iWxVdSGwDMhTayLih8ArpqqjdVlCbYzHWUlM=; b=xhSQzGVcPsTpu5Pcac2EFM3MyE0s28g6cekJXGL/8I04GmeIuOtXuqbLpv8v3JapKKuIaV y4JGJ1Miw4lDH9S2L7kzxfnILJgRYjK7RSxjQ5GFfMe4CAxuCnPZelbbfZvto1AZj1AsL7 KZI5JfWI1HVkpcD81Kj6Bn5xJR0HVQqXO/vr8zWKrQVV+PZhgMDG0w22vzTK4sCqBzzKfz drvPId0maaAtPYHfYY4JW0z9/cFSR2lVs2tel6O4p3/DTNuLwxzeXFHkXpneoLVYFddnWv lYykrsHDOYsQ7OpJmKJ+poN0jz37lC1afIIcLa+RRCvtKpSQmGzeUaIU6ETQJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640855415; a=rsa-sha256; cv=none; b=VB2zSAFjXu1VcDeBmDntXXQMJ9VBrpV1cJ3qdYWlJ2rc+uAwW8KQMPtF3uOsa01puIw4zK LHkl8Spi4pSH4K1KlKztIQ0Atl0hWUtUkXDtS8SvoSHr2r5OXlZU0NyboLxUmr+NTTRFFb d95dK+R8Lp7c9ZxpHvrqX0BJz8U8up3eOeJF38Gw+Xv1e+FuuVrUnLDdIIjAPQcBCejx3Z WiKLXdv486FFWnQZxobtpp9RwYOECLkhxVhYPTZHzncJmHLI4go250juhuHxgPAAr9j3qI Uc/d4BSURjnWgeP7aHHnoU+Hil/3IAcd2BxenMKeUzO5yPa3OgYIaTbSKiQ3hw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=52ce808aba3f8b0dfd7529b530232e327af704a3 commit 52ce808aba3f8b0dfd7529b530232e327af704a3 Author: Emmanuel Vadot AuthorDate: 2021-12-08 10:37:50 +0000 Commit: Emmanuel Vadot CommitDate: 2021-12-30 09:10:05 +0000 bsdinstall: zfsboot: Prompt user for zpool name if the pool already exists If one install FreeBSD on multiple disks (say 13 and CURRENT) the first created pool will always be used. Prompt the user for a new pool name if we detect that the default or supplied one already exists. Reviewed by: imp MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33331 (cherry picked from commit 9935b0e8ea41804b32576987531be4d31ba705f1) --- usr.sbin/bsdinstall/scripts/zfsboot | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 3b673addb10a..7efa40ff8d20 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -1547,6 +1547,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 # @@ -1565,6 +1587,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 #