1-get-initial-setup-working #2
9
setup.sh
9
setup.sh
@ -92,10 +92,11 @@ function we_have_exactly_one_part () {
|
||||
}
|
||||
|
||||
function get_drive_id () {
|
||||
local drive_id_list
|
||||
drive_id_list="$(find -L /dev/disk/by-id -samefile "${1:?}")"
|
||||
if [[ "$(wc -l <<<"${drive_id_list}")" -eq '1' ]] && [[ "$(wc -c <<<"${drive_id_list}")" -gt '1' ]]; then
|
||||
printf -- '%s' "${drive_id_list}"
|
||||
local drive_id_list drive_id_single
|
||||
drive_id_list="$(find -L /dev/disk/by-id -samefile "${1:?}" | sort)"
|
||||
drive_id_single="$(head -n1 <<<"${drive_id_list}")"
|
||||
if [[ "$(wc -l <<<"${drive_id_single}")" -eq '1' ]] && [[ "$(wc -c <<<"${drive_id_single}")" -gt '1' ]]; then
|
||||
printf -- '%s' "${drive_id_single}"
|
||||
return 0
|
||||
fi
|
||||
>2 printf -- '%s\n' 'Not exactly one '"'${1:?}'"' partition entry in /dev/disk/by-id, exiting 1 ...'
|
||||
|
Loading…
x
Reference in New Issue
Block a user