Compare commits
2 Commits
c3833c397b
...
91f4022ad1
Author | SHA1 | Date | |
---|---|---|---|
91f4022ad1 | |||
60b8ff36d5 |
11
setup.sh
11
setup.sh
@@ -46,7 +46,7 @@ function install_zfs () {
|
|||||||
|
|
||||||
function get_partitions () {
|
function get_partitions () {
|
||||||
declare partitions_json
|
declare partitions_json
|
||||||
partitions_json="$(lsblk --output PATH,PARTTYPE --json)" || return 1
|
partitions_json="$(lsblk --output PATH,PARTTYPE --json --tree)" || return 1
|
||||||
printf -- '%s' "${partitions_json}"
|
printf -- '%s' "${partitions_json}"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -58,14 +58,10 @@ function get_parts () {
|
|||||||
zfs_install_drive="${2:-}"
|
zfs_install_drive="${2:-}"
|
||||||
case "${parttype}" in
|
case "${parttype}" in
|
||||||
zfs)
|
zfs)
|
||||||
parts="$(get_partitions | jq --raw-output '.[][] | select(.parttype=="6a85cf4d-1dd2-11b2-99a6-080020736631") | .path')" || exit 1
|
parts="$(get_partitions | jq --raw-output '.[][] | select(.children | length > 0) | select(.children[].parttype=="6a85cf4d-1dd2-11b2-99a6-080020736631") | .children[].path')" || exit 1
|
||||||
;;
|
;;
|
||||||
efi)
|
efi)
|
||||||
if [[ "${zfs_install_drive}" ]]; then
|
parts="$(get_partitions | jq --raw-output '.[][] | select(.children | length > 0) | select(.children[].path=="'"${zfs_install_drive:?}"'") | select(.children[].parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b") | .children[].path')" || exit 1
|
||||||
parts="$(get_partitions | jq --raw-output '.[][] | select(.path=="'"${zfs_install_drive}"'") | select(.parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b") | .path')" || exit 1
|
|
||||||
else
|
|
||||||
parts="$(get_partitions | jq --raw-output '.[][] | select(.parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b") | .path')" || exit 1
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
>2 printf -- '%s\n' 'Unknown partition type '"'"'"${parttype}"'"'"', exiting ...'
|
>2 printf -- '%s\n' 'Unknown partition type '"'"'"${parttype}"'"'"', exiting ...'
|
||||||
@@ -117,6 +113,7 @@ function select_part () {
|
|||||||
part_type="${1:?}" # 'efi' or 'zfs'
|
part_type="${1:?}" # 'efi' or 'zfs'
|
||||||
zfs_install_drive="${2:-}"
|
zfs_install_drive="${2:-}"
|
||||||
if [[ "${zfs_install_drive}" ]]; then
|
if [[ "${zfs_install_drive}" ]]; then
|
||||||
|
# This is intended to find correct EFI partition
|
||||||
parts="$(get_parts "${part_type}" "${zfs_install_drive}")"
|
parts="$(get_parts "${part_type}" "${zfs_install_drive}")"
|
||||||
else
|
else
|
||||||
parts="$(get_parts "${part_type}")"
|
parts="$(get_parts "${part_type}")"
|
||||||
|
Reference in New Issue
Block a user