fix(zfs): Handle zpool list output (#1)

This commit is contained in:
hygienic-books 2023-02-19 21:00:03 +01:00
parent 2aaa2b6729
commit e21e7381f9

View File

@ -87,7 +87,7 @@ function we_have_exactly_one_part () {
function no_zpool_exists () {
declare zpool_list
zpool_list="$(zpool list -H)"
[[ "$(wc -l <<<"${zpool_list}")" -eq '0' ]] && return 0
[[ "$(wc -l <<<"${zpool_list}")" -le '1' ]] && [[ "$(wc -c <<<"${zpool_list}")" -le '1' ]] && return 0
return 1
}
@ -167,6 +167,9 @@ function setup_zpool () {
create_home_dataset
export_pool
import_pool
else
printf -- '%s\n' 'A zpool already exists, that is unexpected. Cowardly exiting 1 ...'
exit 1
fi
}