refactor(iso): Correctly print and exit when in subshell (#1)
This commit is contained in:
parent
38ca0c9cd3
commit
d18ad238d5
8
setup.sh
8
setup.sh
@ -62,7 +62,7 @@ function get_parts () {
|
||||
parts="$(get_partitions | jq --raw-output '.[][] | select(.parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b") | .path')" || exit 1
|
||||
;;
|
||||
*)
|
||||
>2 printf -- '%s\n' 'Unknown partition type '"'"'"${parttype}"'"'"', exiting 1 ...'
|
||||
>2 printf -- '%s\n' 'Unknown partition type '"'"'"${parttype}"'"'"', exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
esac
|
||||
@ -78,7 +78,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 1 ...'
|
||||
>2 printf -- '%s\n' 'No '"${parttype^^}"' partition found. Exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
1)
|
||||
@ -88,7 +88,7 @@ function we_have_exactly_one_part () {
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
>2 printf -- '%s\n' 'Partition list does not look valid. Cowardly exiting 1 ...'
|
||||
>2 printf -- '%s\n' 'Partition list does not look valid. Cowardly exiting ...'
|
||||
exit 77
|
||||
fi
|
||||
}
|
||||
@ -101,7 +101,7 @@ function get_drive_id () {
|
||||
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 ...'
|
||||
>2 printf -- '%s\n' 'Not exactly one '"'${1:?}'"' partition entry in /dev/disk/by-id, exiting ...'
|
||||
exit 77
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user