From 97bebe9a99544ed1e6863fde74aeaa8a82de66cf Mon Sep 17 00:00:00 2001
From: hygienic-books <hygienic-books@tentic.net>
Date: Tue, 21 Feb 2023 03:27:56 +0100
Subject: [PATCH] refactor(iso): ZFS partition selection happens only inside
 setup_zpool (#1)

---
 setup.sh | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/setup.sh b/setup.sh
index 3fc188f..7142e16 100644
--- a/setup.sh
+++ b/setup.sh
@@ -188,8 +188,8 @@ function export_pool () {
 }
 
 function setup_zpool () {
-    declare zpool_drive drive_by_id
-    zpool_drive="${1:?}"
+    local zpool_drive drive_by_id
+    zpool_drive="$(select_part 'zfs')"
     drive_by_id="$(get_drive_id "${zpool_drive}")"
 
     set_zpool_password
@@ -569,13 +569,9 @@ function main () {
     else
         set_ntp
         update_pacman_db
-
         install_pkgs 'jq'
-        local zfs_part
-        zfs_part="$(select_part 'zfs')"
-
         install_zfs
-        setup_zpool "${zfs_part}"
+        setup_zpool
         mount_system
         copy_zpool_cache
         install_archlinux