fix(zfs): Handle zpool list output (#1)
This commit is contained in:
		
							
								
								
									
										5
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								setup.sh
									
									
									
									
									
								
							@@ -87,7 +87,7 @@ function we_have_exactly_one_part () {
 | 
			
		||||
function no_zpool_exists () {
 | 
			
		||||
    declare zpool_list
 | 
			
		||||
    zpool_list="$(zpool list -H)"
 | 
			
		||||
    [[ "$(wc -l <<<"${zpool_list}")" -eq '0' ]] && return 0
 | 
			
		||||
    [[ "$(wc -l <<<"${zpool_list}")" -le '1' ]] && [[ "$(wc -c <<<"${zpool_list}")" -le '1' ]] && return 0
 | 
			
		||||
    return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -167,6 +167,9 @@ function setup_zpool () {
 | 
			
		||||
        create_home_dataset
 | 
			
		||||
        export_pool
 | 
			
		||||
        import_pool
 | 
			
		||||
    else
 | 
			
		||||
        printf -- '%s\n' 'A zpool already exists, that is unexpected. Cowardly exiting 1 ...'
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user