1-get-initial-setup-working #2

Merged
hygienic-books merged 92 commits from 1-get-initial-setup-working into main 2023-03-05 03:02:48 +00:00
Showing only changes of commit ef03281a63 - Show all commits

View File

@ -87,21 +87,14 @@ function we_have_exactly_one_part () {
fi
}
function no_zpool_exists () {
declare zpool_list
zpool_list="$(zpool list -H)"
[[ "$(wc -l <<<"${zpool_list}")" -le '1' ]] && [[ "$(wc -c <<<"${zpool_list}")" -le '1' ]] && return 0
return 1
}
function zpool_drive_id () {
function get_drive_id () {
declare drive_id
drive_id="$(find -L /dev/disk/by-id -samefile "${1:?}")"
if [[ "$(wc -l <<<"${drive_id}")" -eq '1' ]]; then
if [[ "$(wc -l <<<"${drive_id}")" -eq '1' ]] && [[ "$(wc -c <<<"${drive_id}")" -gt '1' ]]; then
printf -- '%s' "${drive_id}"
return 0
fi
printf -- '%s\n' 'More than zpool partition entry in /dev/disk/by-id, exiting 1 ...'
printf -- '%s\n' 'Not exactly one '"'${1:?}'"' partition entry in /dev/disk/by-id, exiting 1 ...'
exit 1
}