Ignore:
Timestamp:
Dec 17, 2008, 5:26:31 PM (15 years ago)
Author:
Bruno Cornec
Message:

Use /boot/grub/menu.lst everywhere instead of meesing up with /etc/grub.conf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.8/mondo/src/restore-scripts/mondo/stabgrub-me

    r1448 r2095  
    1919LocateOldFstab() {
    2020    old_fstab=""
    21     old_grubconf=""
    2221    if [ -f "/mnt/RESTORING/etc/fstab" ] ; then
    2322        LogIt "No need for fstab search." 2
    2423#        fstab_list=/mnt/RESTORING/etc/fstab
    2524        old_fstab=/mnt/RESTORING/etc/fstab
    26         old_grubconf=/mnt/RESTORING/etc/grub.conf
    27         # For some distros, e.g. Debian, /etc/grub.conf is a symbolic link
    28         # which we need to resolve and prepend with /mnt/RESTORING because
    29         # we run this outside the chroot.
    30         if [ -L "$old_grubconf" ] ; then
    31             l=`readlink "$old_grubconf"`
    32             if [ _"`echo $l | cut -c1`" = _"/" ]; then
    33                 # If readlink gives an absolute path it's related to the chroot
    34                 old_grubconf=/mnt/RESTORING/$l
    35             else
    36                 # If readlink gives a relative path, it's in the same dir
    37                 old_grubconf=/mnt/RESTORING/etc/$l
    38             fi
    39         fi 
    4025        return 0
    4126    elif [ -f "/mnt/cdrom/archives/CUCKOO" ] ; then
     
    6550        return 1
    6651    fi
    67     old_grubconf=$where_they_live/grub.conf
    6852    old_fstab=$where_they_live/fstab
    69     LogIt "GRUB and fstab found." 2
     53    LogIt "fstab found." 2
    7054    return 0
     55}
     56
     57LocateOldGrub() {
     58    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
     62        if [ -L "$old_grubconf" ] ; then
     63            l=`readlink "$old_grubconf"`
     64            if [ _"`echo $l | cut -c1`" = _"/" ]; then
     65                # If readlink gives an absolute path it's related to the chroot
     66                old_grubconf=/mnt/RESTORING/$l
     67            else
     68                # If readlink gives a relative path, it's in the same dir
     69                old_grubconf=/mnt/RESTORING/boot/grub/$l
     70            fi
     71        fi 
     72        return 0
     73    fi
     74    LogIt "GRUB not found." 2
     75    return 1
    7176}
    7277
     
    106111LogIt "stabgrub-me '$1' --- starting"
    107112LocateOldFstab
     113LocateOldGrub
    108114old_mountlist=/tmp/mountlist.original
    109115new_mountlist=/tmp/mountlist.txt
     
    114120LogIt "OK so far: I've found all the files I need." 2
    115121new_fstab=/mnt/RESTORING/etc/fstab.NEW
    116 new_grubconf=/mnt/RESTORING/etc/grub.conf.NEW
     122new_grubconf=/mnt/RESTORING/boot/grub/menu.lst.NEW
    117123# change back to /tmp if /mnt/RESTORING/etc be problematic
    118124
Note: See TracChangeset for help on using the changeset viewer.