3-xen-orchestra-install #4

Merged
hygienic-books merged 84 commits from 3-xen-orchestra-install into main 2023-10-22 14:23:54 +00:00
Showing only changes of commit 40948ddbae - Show all commits

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
3>&1
declare this_script_url declare this_script_url
this_script_url="${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 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 exit 77
;; ;;
esac esac
@ -97,7 +99,7 @@ function we_have_exactly_one_part () {
if [[ "$(wc -c <<<"${parts_list}")" -gt '1' ]]; then if [[ "$(wc -c <<<"${parts_list}")" -gt '1' ]]; then
case "${parts_count}" in case "${parts_count}" in
0) 0)
>2 printf -- '%s\n' 'No '"${parttype^^}"' partition found. Exiting ...' >&3 printf -- '%s\n' 'No '"${parttype^^}"' partition found. Exiting ...'
exit 77 exit 77
;; ;;
1) 1)
@ -107,7 +109,7 @@ function we_have_exactly_one_part () {
return 1 return 1
;; ;;
esac 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 exit 77
fi fi
} }
@ -120,7 +122,7 @@ function get_drive_id () {
printf -- '%s' "${drive_id_single}" printf -- '%s' "${drive_id_single}"
return 0 return 0
fi 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 exit 77
} }
@ -145,7 +147,7 @@ function select_part () {
part_type_human_readable='ZFS zpool partition with partition type code BF00' part_type_human_readable='ZFS zpool partition with partition type code BF00'
;; ;;
esac esac
printf -- '%s\n' \ >&3 printf -- '%s\n' \
'It looks as if there is no '"${part_type_human_readable}" \ 'It looks as if there is no '"${part_type_human_readable}" \
'on any of the disks. Did you correctly partition a disk before starting?' \ 'on any of the disks. Did you correctly partition a disk before starting?' \
'Check https://quico.space/quico-os-setup/arch-zbm#prep. Exiting ...' '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 if we_have_exactly_one_part "${part_type}" "${parts}"; then
part="${parts}" part="${parts}"
else 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 exit 77
fi fi
printf -- '%s' "${part}" printf -- '%s' "${part}"