Changeset 22917b9


Ignore:
Timestamp:
06/28/14 09:50:59 (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:
b0982c5
Parents:
2f5e05b
Message:

Fix a bug after doing package updates, which may include newer versions of GRUB

Afterwards, lets update the grub on each boot-device, and sync the grub.cfg / modules
with each BE as well. This fixes an issue with a BE having the incorrect
version of grub modules to load after grub was updated on disk

Location:
src-sh
Files:
1 added
3 edited

Legend:

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

    r404a46cc r22917b9  
    710710  rm $bList 
    711711} 
     712 
     713 
     714# Restamp grub-install onto the ZFS root disks 
     715update_grub_boot() 
     716{ 
     717  ROOTFS=`mount | awk '/ \/ / {print $1}'` 
     718  BEDS="$( echo ${ROOTFS} | awk -F '/' '{print $2}' )" 
     719  if [ "$BEDS" = "dev" ] ; then BEDS="ROOT"; fi 
     720 
     721  for i in `beadm list -a 2>/dev/null | grep "/${BEDS}/" | awk '{print $1}'` 
     722  do 
     723    if ! mount | grep -q "$dTank on / ("; then 
     724       echo -e "Copying grub.cfg to $dTank...\c" >&2 
     725       fMnt="/mnt.$$" 
     726       mkdir $fMnt 
     727       if ! mount -t zfs ${dTank} $fMnt ; then 
     728          echo "WARNING: Failed to update grub.cfg on: ${dTank}" >&2 
     729          continue 
     730       else 
     731         # Copy grub config and modules over to old dataset 
     732         # This is done so that newer grub on boot-sector has 
     733         # matching modules to load from all BE's 
     734         cp /boot/grub/grub.cfg ${fMnt}/boot/grub/grub.cfg 
     735         rm -rf ${fMnt}/boot/grub/i386-* 
     736         cp -r /boot/grub/i386-* ${fMnt}/boot/grub/ 
     737         echo -e "done" >&2 
     738         umount ${fMnt} >/dev/null 
     739         rmdir ${fMnt} >/dev/null 
     740       fi 
     741    fi 
     742  done 
     743 
     744  # Check if we can re-stamp the boot-loader on any of this pools disks 
     745  TANK=`echo $ROOTFS | cut -d '/' -f 1` 
     746  for i in `zpool status $TANK | grep -B 50 " cache "  | grep -B 50 " log " | grep ONLINE | awk '{print $1}'` 
     747  do 
     748     if [ ! -e "/dev/${i}" ] ; then continue; fi 
     749     disk=`echo $i | sed 's|.eli||g'` 
     750 
     751     # Now get the root of the disk 
     752     disk=`echo $disk | sed 's|p[1-9]$||g' | sed "s|s[1-9][a-z]||g"` 
     753     if [ ! -e "/dev/${disk}" ] ; then continue; fi 
     754 
     755     # Re-install GRUB on this disk 
     756     echo "Installing GRUB to $disk" >&2 
     757     grub-install /dev/${disk} 
     758  done 
     759  return 0 
     760} 
  • src-sh/pc-updatemanager/pc-updatemanager

    r9fa1b39 r22917b9  
    11761176    if [ "$SYSTYPE" = "PCBSD" ]; then pc-extractoverlay desktop; fi 
    11771177    if [ "$SYSTYPE" = "TRUEOS" ]; then pc-extractoverlay server; fi 
     1178 
     1179    # Lets restamp grub on all ZFS disks and update config 
     1180    update_grub_boot 
    11781181  fi 
    11791182 
  • src-sh/port-files/pkg-plist

    r273247c r22917b9  
    2626bin/pc-systemflag 
    2727bin/enable_user_pefs 
     28bin/restamp-grub 
    2829sbin/pc-sysinstall 
    2930share/lpreserver/backend/zfsmon.sh 
Note: See TracChangeset for help on using the changeset viewer.