=== modified file 'zsh-functions/confz_fs_init' --- zsh-functions/confz_fs_init 2018-09-17 17:05:56 +0000 +++ zsh-functions/confz_fs_init 2018-02-01 17:19:16 +0000 @@ -37,7 +37,6 @@ case $fs_blkid_result in (2);; (0) while IFS='=' read key val; do - [[ $key == *' '* ]] && die "Malformed blkid output for \"export\" format." fs_blkid_output[$key]=$val done <<<$out;; (*) die "blkid probe failed on device: ${(qqq)1}" @@ -568,25 +567,24 @@ [[ -n $vars[mkfs_opts] ]] && do_command+=( "${(Q@)${(z)vars[mkfs_opts]}}" ) do_command+=( ${vars[device]} ) - local tries # blk_out DEVNAME LABEL UUID TYPE SEC_TYPE PARTLABEL PARTUUID + local tries blk_out DEVNAME LABEL UUID TYPE SEC_TYPE PARTLABEL PARTUUID tries=10 while ((tries)); do - fs_blkid_probe $vars[device] - [[ $fs_blkid_result == 0 ]] && break;; + blk_out=$(blkid -o export ${vars[device]}) + case $? in + (0) break;; + (2) ;; + (*) die "$0: error $? from blkid";; + esac tries=$[$tries - 1] done fail_reason="no blkid signature found on $vars[device]" - # Check if anything was detected at all - (( $#fs_blkid_output )) || return 1 - - # Check if it is a filesystem - [[ -z ${fs_blkid_output[TYPE]:-} && -z ${fs_blkid_output[LABEL]:-} && -z ${fs_blkid_output[UUID]:-} ]] && return 1 - - # Check if it matches requirements - [[ ${fs_blkid_output[LABEL]:-} == ${vars[label]:-} && $fs_blkid_output[TYPE] == $vars[filesystem] ]] && return 0 - + [[ -z $blk_out ]] && return 1 # nothing found on the device + eval $blk_out + [[ $LABEL == ${vars[label]} && $TYPE == $vars[filesystem] ]] && return 0 + [[ -z $TYPE && -z $LABEL && -z $UUID ]] && return 1 die "$0: filesystem already present on ${(qqq)vars[device]}!" }