Changeset f671ad3


Ignore:
Timestamp:
07/03/14 08:05:57 (12 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:
4d7a2d5, 234414e
Parents:
a217080
Message:

Fix a bug in previous commit, strip out the log / cache devices
on a line-by-line basis now

File:
1 edited

Legend:

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

    ra217080 rf671ad3  
    772772  # Check if we can re-stamp the boot-loader on any of this pools disks 
    773773  TANK=`echo $ROOTFS | cut -d '/' -f 1` 
    774   for i in `zpool status $TANK | grep -B 50 " cache "  | grep -B 50 " log " | grep ONLINE | awk '{print $1}'` 
    775   do 
    776      if [ ! -e "/dev/${i}" ] ; then continue; fi 
    777  
    778      disk="$i" 
     774  zpool status $TANK > /tmp/.zpStatus.$$ 
     775 
     776  while read line 
     777  do 
     778     # If we have reached cache / log devices, we can break now 
     779     echo $line | grep -q " cache " 
     780     if [ $? -eq 0 ] ; then break ; fi 
     781     echo $line | grep -q " log " 
     782     if [ $? -eq 0 ] ; then break ; fi 
     783 
     784     # Only try to stamp disks marked as online 
     785     echo $line | grep -q "ONLINE" 
     786     if [ $? -ne 0 ] ; then continue ; fi 
     787 
     788     # Get the disk name 
     789     disk="`echo $line | awk '{print $1}'`" 
     790 
     791     # Is this a legit disk? 
     792     if [ ! -e "/dev/${disk}" ] ; then 
     793        echo "Warning: No such disk device /dev/${disk}" 
     794        continue 
     795     fi 
    779796 
    780797     # If this is a GPTID / rawuuid, find out 
     
    799816     echo "Installing GRUB to $disk" >&2 
    800817     grub-install /dev/${disk} 
    801   done 
     818  done < /tmp/.zpStatus.$$ 
     819  rm /tmp/.zpStatus.$$ 
    802820  return 0 
    803821} 
Note: See TracChangeset for help on using the changeset viewer.