refactor(meta): Print key log output to stdout without capturing it in subshells (#3)
This commit is contained in:
parent
8566b41452
commit
40948ddbae
14
setup.sh
14
setup.sh
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
3>&1
|
||||
|
||||
declare this_script_url
|
||||
this_script_url="${SCRIPT_URL:?}"
|
||||
|
||||
@ -81,7 +83,7 @@ function get_parts () {
|
||||
parts="$(get_partitions | jq --raw-output '.[][] | select(.children | length > 0) | select(.path=="'"${zfs_install_drive:?}"'") | .children[] | select(.parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b") | .path')" || exit 1
|
||||
;;
|
||||
*)
|
||||
>2 printf -- '%s\n' 'Unknown partition type '"'"'"${parttype}"'"'"', exiting ...'
|
||||
>&3 printf -- '%s\n' 'Unknown partition type '"'"'"${parttype}"'"'"', exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
esac
|
||||
@ -97,7 +99,7 @@ function we_have_exactly_one_part () {
|
||||
if [[ "$(wc -c <<<"${parts_list}")" -gt '1' ]]; then
|
||||
case "${parts_count}" in
|
||||
0)
|
||||
>2 printf -- '%s\n' 'No '"${parttype^^}"' partition found. Exiting ...'
|
||||
>&3 printf -- '%s\n' 'No '"${parttype^^}"' partition found. Exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
1)
|
||||
@ -107,7 +109,7 @@ function we_have_exactly_one_part () {
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
>2 printf -- '%s\n' 'Partition list does not look valid. Cowardly exiting ...'
|
||||
>&3 printf -- '%s\n' 'Partition list does not look valid. Cowardly exiting ...'
|
||||
exit 77
|
||||
fi
|
||||
}
|
||||
@ -120,7 +122,7 @@ function get_drive_id () {
|
||||
printf -- '%s' "${drive_id_single}"
|
||||
return 0
|
||||
fi
|
||||
>2 printf -- '%s\n' 'No '"'${1:?}'"' partition entry in /dev/disk/by-partuuid, exiting ...'
|
||||
>&3 printf -- '%s\n' 'No '"'${1:?}'"' partition entry in /dev/disk/by-partuuid, exiting ...'
|
||||
exit 77
|
||||
}
|
||||
|
||||
@ -145,7 +147,7 @@ function select_part () {
|
||||
part_type_human_readable='ZFS zpool partition with partition type code BF00'
|
||||
;;
|
||||
esac
|
||||
printf -- '%s\n' \
|
||||
>&3 printf -- '%s\n' \
|
||||
'It looks as if there is no '"${part_type_human_readable}" \
|
||||
'on any of the disks. Did you correctly partition a disk before starting?' \
|
||||
'Check https://quico.space/quico-os-setup/arch-zbm#prep. Exiting ...'
|
||||
@ -155,7 +157,7 @@ function select_part () {
|
||||
if we_have_exactly_one_part "${part_type}" "${parts}"; then
|
||||
part="${parts}"
|
||||
else
|
||||
2> printf -- '%s\n' 'More than one '"${part_type^^}"' partition to pick for installation. Cowardly exiting ...'
|
||||
>&3 printf -- '%s\n' 'More than one '"${part_type^^}"' partition to pick for installation. Cowardly exiting ...'
|
||||
exit 77
|
||||
fi
|
||||
printf -- '%s' "${part}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user