Changeset a217080


Ignore:
Timestamp:
07/03/14 07:50:55 (13 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:
f671ad3
Parents:
5aa9eb0f
Message:

Fix a bug re-stamping "grub-install" to a zpool when the zpool is only
reporting the rawuuid of the disk devices

File:
1 edited

Legend:

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

    r22917b9 ra217080  
    711711} 
    712712 
     713# Function to take a gptid/<foo> string, and map it to the real device name 
     714map_gptid_to_dev() 
     715{ 
     716  gpart list > /tmp/.gptList.$$ 
     717 
     718  # Strip off the gptid/ 
     719  local needle="`echo $1 | sed 's|gptid/||g'`" 
     720  local realName="" 
     721 
     722  while read line 
     723  do 
     724    echo "$line" | grep -q " Name: " 
     725    if [ $? -eq 0 ]; then 
     726      realName="`echo $line | awk '{print $3}'`" 
     727      continue 
     728    fi 
     729 
     730    echo "$line" | grep -q "rawuuid: $needle" 
     731    if [ $? -eq 0 ]; then 
     732       echo "$realName" 
     733       rm /tmp/.gptList.$$ 
     734       return 0 
     735       break 
     736    fi 
     737  done < /tmp/.gptList.$$ 
     738  rm /tmp/.gptList.$$ 
     739  return 1 
     740} 
    713741 
    714742# Restamp grub-install onto the ZFS root disks 
     
    747775  do 
    748776     if [ ! -e "/dev/${i}" ] ; then continue; fi 
    749      disk=`echo $i | sed 's|.eli||g'` 
     777 
     778     disk="$i" 
     779 
     780     # If this is a GPTID / rawuuid, find out 
     781     echo "$disk" | grep -q "gptid" 
     782     if [ $? -eq 0 ] ; then 
     783        # Just a GPTID, resolve it down to real device 
     784        disk="$(map_gptid_to_dev ${i})" 
     785        if [ -z "$disk" ] ; then 
     786           echo "Warning: Unable to map ${i} to real device name" 
     787           continue 
     788        fi 
     789     fi 
     790 
     791     # Remove the .eli, if it exists 
     792     disk=`echo $disk | sed 's|.eli||g'` 
    750793 
    751794     # Now get the root of the disk 
Note: See TracChangeset for help on using the changeset viewer.