Changeset 2451 in MondoRescue


Ignore:
Timestamp:
Oct 6, 2009, 1:34:09 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Fix a mr_asprintf usage without & causing a seg fault.
  • Adds support for grub2 conf file grub.cfg in addition to menu.lst
  • Fix for #288: only take the first result in SizeOfPartition in case of multiple mounts
  • Improve USB log in case of error by adding the conf file

(Backport from 2.2.9)

Location:
branches/2.2.10
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/mindi

    r2446 r2451  
    14881488            LogAll "----------- syslinux's errors --------------" |tee -a $LOGFILE
    14891489            cat $MINDI_TMP/syslinux.log |tee -a $LOGFILE
     1490            echo "----------- syslinux's conf --------------" |tee -a $LOGFILE
     1491            cat $MINDI_TMP/usb/syslinux.cfg |tee -a $LOGFILE
    14901492            LogAll "Failed to create USB image."
    14911493        else
     
    16951697        return 0
    16961698    fi
    1697     free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
    16981699    max_kernel_size=$(($free_space+`du -sk $kernelpath | cut -f1`))
    16991700    LogFile "Free space left on image = $free_space KB"
     
    17901791        return 0
    17911792    fi
    1792     free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
    17931793    max_kernel_size=$(($free_space+`du -sk $kernelpath | cut -f1`))
    17941794    LogFile "Free space left on image = $free_space KB"
     
    20352035    res=`$FDISK -s $device 2>> $LOGFILE`
    20362036    # end patch
    2037     [ "$res" = "" ] && res=`df -k -P -x supermount | tr -s '\t' ' ' | grep -F "$device " | cut -d' ' -f2`
     2037    # take only the first in case of multiple mount (cifs, nfs, ...)
     2038    [ "$res" = "" ] && res=`df -k -P -x supermount | tr -s '\t' ' ' | grep -F "$device " | cut -d' ' -f2 | head -1`
    20382039    [ "$res" = "" ] && res="-1"
    20392040    echo $res
  • branches/2.2.10/mondo/src/common/libmondo-archive.c

    r2428 r2451  
    687687            run_program_and_log_output("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5);
    688688        }
    689         if (!does_file_exist("/boot/grub/menu.lst")) {
    690             fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst but I cannot find it there. What is wrong with your Linux distribution?");
     689        if ((!does_file_exist("/boot/grub/menu.lst")) || (!does_file_exist("/boot/grub/grub.cfg"))) {
     690            fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst or /boot/grub/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?");
    691691        }
    692692    } else if (bkpinfo->boot_loader == 'E') {
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2405 r2451  
    13871387    backup_crucial_file(MNT_RESTORING, "/etc/fstab");
    13881388    backup_crucial_file(MNT_RESTORING, "/boot/grub/menu.lst");
     1389    backup_crucial_file(MNT_RESTORING, "/boot/grub/grub.cfg");
    13891390    backup_crucial_file(MNT_RESTORING, "/etc/lilo.conf");
    13901391    backup_crucial_file(MNT_RESTORING, "/etc/elilo.conf");
     
    15121513        mvaddstr_and_log_it(g_currentY,
    15131514                            0,
    1514                             "Modifying fstab, mtab, device.map and menu.lst, and running GRUB...                             ");
     1515                            "Modifying fstab, mtab, device.map and menu.lst/grub.cfg, and running GRUB...                             ");
    15151516        for (done = FALSE; !done;) {
    15161517            p = popup_and_get_string("Boot device", "Please confirm/enter the boot device. If in doubt, try /dev/hda", boot_device);
     
    15381539                done = TRUE;
    15391540            }
    1540             popup_and_OK("You will now edit fstab, mtab, device.map and menu.lst");
     1541            popup_and_OK("You will now edit fstab, mtab, device.map and menu.lst/grub.cfg");
    15411542            if (!g_text_mode) {
    15421543                newtSuspend();
     
    15521553            mr_free(tmp);
    15531554
    1554             mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
     1555            if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) {
     1556                mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
     1557            } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) {
     1558                mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor);
     1559            }
    15551560            paranoid_system(tmp);
    15561561            mr_free(tmp);
  • branches/2.2.10/mondo/src/restore-scripts/mondo/grub-MR

    r2185 r2451  
    159159# ---------------------------------
    160160
    161 echo "Trying to use the existing menu.lst file in batch mode" >> $LOGFILE
    162 chroot /mnt/RESTORING grub --batch < /mnt/RESTORING/boot/grub/menu.lst
     161if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ]; then
     162    GRUBCFGFILE=/boot/grub/menu.lst
     163elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then
     164    GRUBCFGFILE=/boot/grub/grub.cfg
     165else
     166    echo "Unable to find Grub conf file"
     167    exit -1
     168fi
     169echo "Trying to use the existing $GRUBCFGFILE file in batch mode" >> $LOGFILE
     170chroot /mnt/RESTORING grub --batch < /mnt/RESTORING$GRUBCFGFILE
    163171res=$?
    164 echo "menu.lst approach returned $res" >> $LOGFILE
     172echo "$GRUBCFGFILE approach returned $res" >> $LOGFILE
    165173[ "$res" -eq "0" ] && exit 0
    166174
  • branches/2.2.10/mondo/src/restore-scripts/mondo/stabgrub-me

    r2095 r2451  
    5757LocateOldGrub() {
    5858    old_grubconf=""
    59     if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ] ; then
    60         LogIt "No need for menu.lst search." 2
    61         old_grubconf=/mnt/RESTORING/boot/grub/menu.lst
     59    if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ] || [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ] ; then
     60        LogIt "No need for menu.lst/grub.cfg search." 2
     61        if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ]; then
     62            old_grubconf=/mnt/RESTORING/boot/grub/menu.lst
     63        elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then
     64            old_grubconf=/mnt/RESTORING/boot/grub/grub.cfg
     65        fi
    6266        if [ -L "$old_grubconf" ] ; then
    6367            l=`readlink "$old_grubconf"`
     
    120124LogIt "OK so far: I've found all the files I need." 2
    121125new_fstab=/mnt/RESTORING/etc/fstab.NEW
    122 new_grubconf=/mnt/RESTORING/boot/grub/menu.lst.NEW
     126if [ -f /mnt/RESTORING/boot/grub/menu.lst ]; then
     127    new_grubconf=/mnt/RESTORING/boot/grub/menu.lst.NEW
     128elif [ -f /mnt/RESTORING/boot/grub/grub.cfg ]; then
     129    new_grubconf=/mnt/RESTORING/boot/grub/grub.cfg.NEW
     130fi
    123131# change back to /tmp if /mnt/RESTORING/etc be problematic
    124132
Note: See TracChangeset for help on using the changeset viewer.