Changeset 2635 in MondoRescue for branches/2.2.10/mondo/src/restore-scripts/mondo
- Timestamp:
- May 17, 2010, 5:57:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/restore-scripts/mondo/grub-MR
r2508 r2635 69 69 70 70 echo -en "\ 71 device (hd$driveno) $mbr part\n\71 device (hd$driveno) $mbrdev\n\ 72 72 $extraline\n\ 73 73 root (hd$driveno,$partno)\n\ … … 77 77 log_file=/tmp/grub.output 78 78 if [ "$MNT_RESTORING" ] ; then 79 chroot /mnt/RESTORING grub --batch < /tmp/feed.txt > $log_file79 chroot $MNT_RESTORING grub --batch < /tmp/feed.txt > $log_file 80 80 else 81 81 grub --batch < /tmp/feed.txt > $log_file … … 104 104 105 105 echo "Now I'll use grub-install" >> $LOGFILE 106 chroot /mnt/RESTORING grub-install $1 >> $LOGFILE 107 res=$? 106 if [ "$MNT_RESTORING" ] ; then 107 chroot $MNT_RESTORING grub-install $1 2>&1 | tee -a $LOGFILE 108 res=$? 109 else 110 grub-install $1 2>&1 | tee -a $LOGFILE 111 res=$? 112 fi 108 113 echo "grub-install returned $res" >> $LOGFILE 109 114 [ "$res" -eq "0" ] && exit 0 110 115 116 # For some OpenSuSE 117 echo "Now I'll use grub-install.unsupported" >> $LOGFILE 118 if [ "$MNT_RESTORING" ] ; then 119 chroot $MNT_RESTORING grub-install.unsupported $1 2>&1 | tee -a $LOGFILE 120 res=$? 121 else 122 grub-install.unsupported $1 2>&1 | tee -a $LOGFILE 123 res=$? 124 fi 125 echo "grub-install.unsupported returned $res" >> $LOGFILE 126 [ "$res" -eq "0" ] && exit 0 127 111 128 echo "Trying a hack" >> $LOGFILE 112 FindBootPart $1 $2 113 mbr part=$1129 FindBootPart $1 $2 2>&1 | tee -a $LOGFILE 130 mbrdev=`echo $1 | sed 's/\([^0-9]*\)[0-9]*$/\1/'` 114 131 if echo $bootpart | grep "/cciss/" > /dev/null ; then 115 132 partno=`basename $bootpart | cut -d'p' -f2` 133 mbrdev=`echo $mbrdev | cut -d'p' -f1` 116 134 elif echo $bootpart | grep "/mapper/mpath" > /dev/null ; then 117 135 partno=`basename $bootpart | cut -d'p' -f3` 136 mbrdev=`echo $mbrdev | cut -d'p' -f1` 118 137 else 119 partno=`basename $bootpart | sed s/[a-z]*//`138 partno=`basename $bootpart | sed 's/[a-z]*//'` 120 139 fi 121 140 if [ ! "$partno" ] ; then … … 125 144 fi 126 145 if echo $bootpart | grep "/md" > /dev/null ; then 146 # FIXME: Why this if not used later 127 147 base=`basename $bootpart` 128 148 line=`grep $base /proc/mdstat | head -n1` 129 echo "mbr part was $mbrpart"130 mbr part=`parted2fdisk -l | grep /dev/ | head -n1 | tr ':' ' ' | cut -d' ' -f2`131 echo "mbr part is $mbrpart"149 echo "mbrdev was $mbrdev" 2>&1 | tee -a $LOGFILE 150 mbrdev=`parted2fdisk -l | grep /dev/ | head -n1 | tr ':' ' ' | cut -d' ' -f2` 151 echo "mbrdev is $mbrdev" 2>&1 | tee -a $LOGFILE 132 152 partno="0"; # cheating - FIXME 133 153 fi 134 echo ".............Cool." 154 echo ".............Cool." 2>&1 | tee -a $LOGFILE 135 155 136 156 grub=`FindPathOfRESTExe grub` … … 142 162 for driveno in 0 1 2 ; do 143 163 try_grub_hack $driveno $partno "" >> $LOGFILE 2>> $LOGFILE && break 144 try_grub_ Hack $driveno $partno "find $BOOTPATHNAME/stage1" >> $LOGFILE 2>> $LOGFILE && break164 try_grub_hack $driveno $partno "find $BOOTPATHNAME/stage1" >> $LOGFILE 2>> $LOGFILE && break 145 165 done 146 166 res=$? … … 152 172 echo "Now I'll use grub-install.patched" >> $LOGFILE 153 173 cp -f `which grub-install.patched` /mnt/RESTORING/sbin 154 chroot /mnt/RESTORING grub-install.patched $1 >>$LOGFILE174 chroot /mnt/RESTORING grub-install.patched $1 2>&1 | tee -a $LOGFILE 155 175 res=$? 156 176 echo "grub-install.patched returned $res" >> $LOGFILE … … 160 180 161 181 if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ]; then 162 GRUBCFGFILE=/boot/grub/menu.lst182 grep -vE '^#' /boot/grub/menu.lst > /mnt/RESTORING/tmp/grub.conf 163 183 elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then 164 GRUBCFGFILE=/boot/grub/grub.cfg184 grep -vE '^#' /boot/grub/grub.cfg > /mnt/RESTORING/tmp/grub.conf 165 185 else 166 echo "Unable to find Grub conf file" 186 echo "Unable to find Grub conf file" | tee -a $LOGFILE 167 187 exit -1 168 188 fi 169 echo "Trying to use the existing $GRUBCFGFILE file in batch mode" >> $LOGFILE 170 chroot /mnt/RESTORING grub --batch < /mnt/RESTORING$GRUBCFGFILE 189 echo "Trying to use the existing grub conf file in batch mode" >> $LOGFILE 190 cat /mnt/RESTORING/tmp/grub.conf >> $LOGFILE 191 chroot /mnt/RESTORING grub --batch < /mnt/RESTORING/tmp/grub.conf 171 192 res=$? 172 echo "$GRUBCFGFILE approach returned $res" >> $LOGFILE 193 echo "grub conf file approach returned $res" >> $LOGFILE 194 rm -f /mnt/RESTORING/tmp/grub.conf 173 195 [ "$res" -eq "0" ] && exit 0 174 196
Note:
See TracChangeset
for help on using the changeset viewer.