Ignore:
Timestamp:
Apr 8, 2010, 4:16:04 AM (14 years ago)
Author:
Bruno Cornec
Message:
  • Fixes for #414: remove comments from grub conf file if used and improve grub conf file generation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/restore-scripts/mondo/grub-MR

    r2615 r2619  
    105105echo "Now I'll use grub-install" >> $LOGFILE
    106106if [ "$MNT_RESTORING" ] ; then
    107     chroot $MNT_RESTORING grub-install $1 >> $LOGFILE
     107    chroot $MNT_RESTORING grub-install $1 2>&1 | tee -a $LOGFILE
    108108    res=$?
    109109else
    110     grub-install $1 >> $LOGFILE
     110    grub-install $1 2>&1 | tee -a $LOGFILE
    111111    res=$?
    112112fi
     
    117117echo "Now I'll use grub-install.unsupported" >> $LOGFILE
    118118if [ "$MNT_RESTORING" ] ; then
    119     chroot $MNT_RESTORING grub-install.unsupported $1 >> $LOGFILE
     119    chroot $MNT_RESTORING grub-install.unsupported $1 2>&1 | tee -a $LOGFILE
    120120    res=$?
    121121else
    122     grub-install.unsupported $1 >> $LOGFILE
     122    grub-install.unsupported $1 2>&1 | tee -a $LOGFILE
    123123    res=$?
    124124fi
     
    128128echo "Trying a hack" >> $LOGFILE
    129129FindBootPart $1 $2 2>&1 | tee -a $LOGFILE
    130 mbrdev=`echo $1 | sed 's/[^0-9]*\([0-9]*\)$/\1/'`
     130mbrdev=`echo $1 | sed 's/\([^0-9]*\)[0-9]*$/\1/'`
    131131if echo $bootpart | grep "/cciss/" > /dev/null ; then
    132132    partno=`basename $bootpart | cut -d'p' -f2`
     133    mbrdev=`echo $mbrdev | cut -d'p' -f1`
    133134elif echo $bootpart | grep "/mapper/mpath" > /dev/null ; then
    134135    partno=`basename $bootpart | cut -d'p' -f3`
     136    mbrdev=`echo $mbrdev | cut -d'p' -f1`
    135137else
    136138    partno=`basename $bootpart | sed 's/[a-z]*//'`
     
    160162for driveno in 0 1 2 ; do
    161163    try_grub_hack $driveno $partno "" >> $LOGFILE 2>> $LOGFILE && break
    162     try_grub_Hack $driveno $partno "find $BOOTPATHNAME/stage1" >> $LOGFILE 2>> $LOGFILE && break
     164    try_grub_hack $driveno $partno "find $BOOTPATHNAME/stage1" >> $LOGFILE 2>> $LOGFILE && break
    163165done
    164166res=$?
     
    170172echo "Now I'll use grub-install.patched" >> $LOGFILE
    171173cp -f `which grub-install.patched` /mnt/RESTORING/sbin
    172 chroot /mnt/RESTORING grub-install.patched $1 >> $LOGFILE
     174chroot /mnt/RESTORING grub-install.patched $1 2>&1 | tee -a $LOGFILE
    173175res=$?
    174176echo "grub-install.patched returned $res" >> $LOGFILE
     
    178180
    179181if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ]; then
    180     GRUBCFGFILE=/boot/grub/menu.lst
     182    grep -vE '^#' /boot/grub/menu.lst > /mnt/RESTORING/tmp/grub.conf
    181183elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then
    182     GRUBCFGFILE=/boot/grub/grub.cfg
     184    grep -vE '^#' /boot/grub/grub.cfg > /mnt/RESTORING/tmp/grub.conf
    183185else
    184     echo "Unable to find Grub conf file"
     186    echo "Unable to find Grub conf file" | tee -a $LOGFILE
    185187    exit -1
    186188fi
    187 echo "Trying to use the existing $GRUBCFGFILE file in batch mode" >> $LOGFILE
    188 chroot /mnt/RESTORING grub --batch < /mnt/RESTORING$GRUBCFGFILE
     189echo "Trying to use the existing grub conf file in batch mode" >> $LOGFILE
     190cat /mnt/RESTORING/tmp/grub.conf >> $LOGFILE
     191chroot /mnt/RESTORING grub --batch < /mnt/RESTORING/tmp/grub.conf
    189192res=$?
    190 echo "$GRUBCFGFILE approach returned $res" >> $LOGFILE
     193echo "grub conf file approach returned $res" >> $LOGFILE
     194rm -f /mnt/RESTORING/tmp/grub.conf
    191195[ "$res" -eq "0" ] && exit 0
    192196
Note: See TracChangeset for help on using the changeset viewer.