Changeset 234414e


Ignore:
Timestamp:
07/03/14 08:17:13 (11 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, enter/10, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
189b2c1
Parents:
f671ad3
Message:

Cleanup some of the flow when doing gptid parsing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/libsh/functions.sh

    rf671ad3 r234414e  
    720720  local realName="" 
    721721 
    722   while read line 
    723   do 
    724     echo "$line" | grep -q " Name: " 
     722  while read uline 
     723  do 
     724    echo "$uline" | grep -q " Name: " 
    725725    if [ $? -eq 0 ]; then 
    726       realName="`echo $line | awk '{print $3}'`" 
     726      realName="`echo $uline | awk '{print $3}'`" 
    727727      continue 
    728728    fi 
    729729 
    730     echo "$line" | grep -q "rawuuid: $needle" 
     730    echo "$uline" | grep -q "rawuuid: $needle" 
    731731    if [ $? -eq 0 ]; then 
    732732       echo "$realName" 
     
    774774  zpool status $TANK > /tmp/.zpStatus.$$ 
    775775 
    776   while read line 
     776  restampDisks="" 
     777 
     778  while read zline 
    777779  do 
    778780     # If we have reached cache / log devices, we can break now 
    779      echo $line | grep -q " cache " 
     781     echo $zline | grep -q " cache " 
    780782     if [ $? -eq 0 ] ; then break ; fi 
    781      echo $line | grep -q " log " 
     783     echo $zline | grep -q " log " 
    782784     if [ $? -eq 0 ] ; then break ; fi 
    783785 
    784786     # Only try to stamp disks marked as online 
    785      echo $line | grep -q "ONLINE" 
     787     echo $zline | grep -q "state: " 
     788     if [ $? -eq 0 ] ; then continue ; fi 
     789     echo $zline | grep -q "ONLINE" 
    786790     if [ $? -ne 0 ] ; then continue ; fi 
    787791 
    788792     # Get the disk name 
    789      disk="`echo $line | awk '{print $1}'`" 
     793     disk="`echo $zline | awk '{print $1}'`" 
    790794 
    791795     # Is this a legit disk? 
    792      if [ ! -e "/dev/${disk}" ] ; then 
    793         echo "Warning: No such disk device /dev/${disk}" 
    794         continue 
    795      fi 
     796     if [ ! -e "/dev/${disk}" ] ; then continue; fi 
     797 
     798     restampDisks="$restampDisks $disk" 
     799  done < /tmp/.zpStatus.$$ 
     800  rm /tmp/.zpStatus.$$ 
     801 
     802  for i in $restampDisks 
     803  do 
     804     disk="$i" 
    796805 
    797806     # If this is a GPTID / rawuuid, find out 
     
    816825     echo "Installing GRUB to $disk" >&2 
    817826     grub-install /dev/${disk} 
    818   done < /tmp/.zpStatus.$$ 
    819   rm /tmp/.zpStatus.$$ 
     827  done 
    820828  return 0 
    821829} 
Note: See TracChangeset for help on using the changeset viewer.