1-get-initial-setup-working #2
							
								
								
									
										13
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								setup.sh
									
									
									
									
									
								
							| @@ -87,21 +87,14 @@ function we_have_exactly_one_part () { | |||||||
|     fi |     fi | ||||||
| } | } | ||||||
|  |  | ||||||
| function no_zpool_exists () { | function get_drive_id () { | ||||||
|     declare zpool_list |  | ||||||
|     zpool_list="$(zpool list -H)" |  | ||||||
|     [[ "$(wc -l <<<"${zpool_list}")" -le '1' ]] && [[ "$(wc -c <<<"${zpool_list}")" -le '1' ]] && return 0 |  | ||||||
|     return 1 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function zpool_drive_id () { |  | ||||||
|     declare drive_id |     declare drive_id | ||||||
|     drive_id="$(find -L /dev/disk/by-id -samefile "${1:?}")" |     drive_id="$(find -L /dev/disk/by-id -samefile "${1:?}")" | ||||||
|     if [[ "$(wc -l <<<"${drive_id}")" -eq '1' ]]; then |     if [[ "$(wc -l <<<"${drive_id}")" -eq '1' ]] && [[ "$(wc -c <<<"${drive_id}")" -gt '1' ]]; then | ||||||
|         printf -- '%s' "${drive_id}" |         printf -- '%s' "${drive_id}" | ||||||
|         return 0 |         return 0 | ||||||
|     fi |     fi | ||||||
|     printf -- '%s\n' 'More than zpool partition entry in /dev/disk/by-id, exiting 1 ...' |     printf -- '%s\n' 'Not exactly one '"'${1:?}'"' partition entry in /dev/disk/by-id, exiting 1 ...' | ||||||
|     exit 1 |     exit 1 | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user