=== modified file 'zsh-functions/confz_fs_init' --- zsh-functions/confz_fs_init 2017-11-22 21:02:00 +0000 +++ zsh-functions/confz_fs_init 2017-11-22 00:24:51 +0000 @@ -4,10 +4,8 @@ # confz functions for dealing with filesystem and mounting # -# load the zstat builtin and keep stat external -zmodload -F zsh/stat b:zstat +# smartctl -i /dev/sda | while IFS=':' read foo bar; do P '***' ${${foo:l}// /_} ${bar/# #}; done -# helper for finding disk drives by their metadata fs_smartctl_probe() { (($+smartctl_probed)) && (($smartctl_probed)) && return 0 local dev item val rest @@ -325,7 +323,7 @@ # set up /dev/md* device confz_mdraid_check() { local line level out seen_level seen_header devices all_empty - local -a seen_devices devices device_numbers + local -a seen_devices devices local -A level_map checkvars md_device raid_devices level @@ -357,11 +355,6 @@ ) level=${level_map[${vars[level]}]} - for device in $devices; do - [[ -b $device ]] || die "$0: not a block device: ${(qqq)device}" - device_numbers+=( zstat +rdev $device ) || die "$0: could not stat ${(qqq)device}" - done - if [[ -b $vars[md_device] ]]; then out=$( mdadm --detail $vars[md_device] ) || \ die "$0: mdadm --detail ${(qqq)vars[md_device]} returned $?" @@ -375,7 +368,7 @@ seen_header=1;; esac else - seen_devices+=( $(( ${${=line}[2]} << 8 + ${${=line}[3]} )) ) + seen_devices+=( ${${=line}[-1]} ) fi done <<<$out @@ -383,9 +376,9 @@ die "$0: raid level mismatch." \ "expected: ${(q)level} got: ${(q)seen_level}" - [[ ${(o)devices} == ${(o)seen_devices} ]] || \ + [[ ${(o)vars[raid_devices]} == ${(o)seen_devices} ]] || \ die $0$': raid device mismatch\nexpected:' \ - ${(oqqq)devices}$'\ngot:' \ + ${(oqqq)vars[raid_devices]}$'\ngot:' \ ${(oqqq)seen_devices} return 0