#!/bin/bash

mode=$(/opt/tool/saturn-device-id -r 14 | cut -c 11-12)
hdd=("B0" "B1" "B2" "D0")
ssd=("B3" "B4" "B5")

if [[ " ${hdd[@]} " =~ " $mode " ]];then
    n=1
    modenum=4
elif [[ " ${ssd[@]} " =~ " $mode " ]];then
    n=0
    modenum=8
else
    n=9
fi

disks=($(lsblk -d -o NAME,RM,ROTA | egrep "sd.*0.*${n}" | awk '{print $1}'))
num=${#disks[@]}

if [ $num -eq $modenum ];then
    echo "$num ${disks[*]}"
else
    echo "error:磁盘个数与型号不匹配。"
    exit 1
fi
