Changeset 3147 in MondoRescue for branches/3.1/mondo/src/restore-scripts


Ignore:
Timestamp:
Jun 19, 2013, 8:34:46 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • First pass on svn merge -r 2935:3146 ../3.0
Location:
branches/3.1/mondo/src/restore-scripts/mondo
Files:
4 edited

Legend:

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

    r2937 r3147  
    107107if [ "$MNT_RESTORING" ] ; then
    108108    if [ -x $MNT_RESTORING/usr/sbin/grub-install.unsupported ]; then
    109         echo "Now I'll use grub-install.unsupported in chroot" >> $LOGFILE
    110         chroot $MNT_RESTORING /usr/sbin/grub-install.unsupported $1 >> $LOGFILE 2>> $LOGFILE
     109        echo "Now I'll use OpenSuSE/SLES new grub-install in chroot" >> $LOGFILE
     110        chroot $MNT_RESTORING /usr/sbin/grub-install >> $LOGFILE 2>> $LOGFILE
    111111        res=$?
    112         echo "grub-install.unsupported in chroot returned $res" >> $LOGFILE
     112        echo "grub-install in chroot returned $res" >> $LOGFILE
    113113    fi
    114114else
    115115    if [ -x /usr/sbin/grub-install.unsupported ]; then
    116         echo "Now I'll use grub-install.unsupported locally" >> $LOGFILE
    117         /usr/sbin/grub-install.unsupported $1 >> $LOGFILE 2>> $LOGFILE
     116        echo "Now I'll use OpenSuSE/SLES new grub-install locally" >> $LOGFILE
     117        /usr/sbin/grub-install >> $LOGFILE 2>> $LOGFILE
    118118        res=$?
    119         echo "grub-install.unsupported returned $res" >> $LOGFILE
     119        echo "grub-install returned $res" >> $LOGFILE
    120120    fi
    121121fi
     
    124124echo "Now I'll use grub-install" >> $LOGFILE
    125125if [ "$MNT_RESTORING" ] ; then
     126    echo "Launching: chroot $MNT_RESTORING grub-install $1" >> $LOGFILE
    126127    chroot $MNT_RESTORING grub-install $1 >> $LOGFILE 2>> $LOGFILE
    127128    res=$?
    128129else
     130    echo "Launching: grub-install $1" >> $LOGFILE
    129131    grub-install $1 >> $LOGFILE 2>> $LOGFILE
    130132    res=$?
    131133fi
    132134echo "grub-install returned $res" >> $LOGFILE
     135[ "$res" -eq "0" ] && exit 0
     136
     137
     138echo "Now I'll use grub2-install" >> $LOGFILE
     139if [ "$MNT_RESTORING" ] ; then
     140    chroot $MNT_RESTORING grub2-install $1 >> $LOGFILE 2>> $LOGFILE
     141    res=$?
     142else
     143    grub2-install $1 >> $LOGFILE 2>> $LOGFILE
     144    res=$?
     145fi
     146echo "grub2-install returned $res" >> $LOGFILE
    133147[ "$res" -eq "0" ] && exit 0
    134148
     
    190204elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then
    191205    grep -vE '^#' /boot/grub/grub.cfg > /mnt/RESTORING/tmp/grub.conf
     206elif [ -f "/mnt/RESTORING/boot/grub2/grub.cfg" ]; then
     207    grep -vE '^#' /boot/grub2/grub.cfg > /mnt/RESTORING/tmp/grub.conf
    192208else
    193209    echo "Unable to find Grub conf file" | tee -a $LOGFILE
  • branches/3.1/mondo/src/restore-scripts/mondo/label-partitions-as-necessary

    r2462 r3147  
    2828    else
    2929        if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] || [ "$format" = "ext4" ]; then
    30             command="tune2fs $opttun $label $mountpt"
     30            if [ "$format" = "ext4" ] && [ -x "/sbin/tune4fs" ]; then
     31                command="/sbin/tune4fs $opttun $label $mountpt"
     32            else
     33                command="tune2fs $opttun $label $mountpt"
     34            fi
    3135            LogIt "Running $command"
    3236            $command
     
    3842            if [ "$opttun" = "-U" ]; then
    3943                LogIt "Creating uuid $label on swap partition $mountpt"
    40                 echo -n "$label" | perl -ne 's/-//g;chomp;print pack "H*",$_' | dd conv=notrunc "of=$mountpt" obs=1 seek=1036
     44                if [ -x "/sbin/swaplabel" ]; then
     45                    /sbin/swaplabel $opttun $label $mountpt
     46                else
     47                    echo -n "$label" | perl -ne 's/-//g;chomp;print pack "H*",$_' | dd conv=notrunc "of=$mountpt" obs=1 seek=1036
     48                fi
    4149            else
    42                 command="mkswap $opttun $label $mountpt"
     50                if [ -x "/sbin/swaplabel" ]; then
     51                    command="/sbin/swaplabel $opttun $label $mountpt"
     52                else
     53                    command="mkswap $opttun $label $mountpt"
     54                fi
    4355                LogIt "Running $command"
    4456                $command
    4557            fi
    4658        else
    47             LogIt "I am NOT going to run tune2fs/reiserfstune: the partition is format '$format', which doesn't like tune2fs/reiserfstune anyway"
     59            LogIt "I am NOT going to run tune2|4fs/reiserfstune: the partition is format '$format', which doesn't like tune2|4fs/reiserfstune anyway"
    4860        fi
    4961    fi
     
    5365# ---------------------------------------------
    5466
    55 LogIt "Identifying your drives with tune2fs"
     67LogIt "Identifying your drives with FS tune tool"
    5668if [ "$#" -ne "1" ] ; then
    5769    LogIt "label-partitions-as-necessary $MINDI_CACHE/mountlist.txt < /tmp/fstab.new" 1
  • branches/3.1/mondo/src/restore-scripts/mondo/make-me-bootable

    r2196 r3147  
    22
    33
    4 if [ "$#" -ne "1" ] && [ "$#" -ne "2" ] ; then
    5     echo "make-me-bootable <fname> (dummy)"
     4if [ "$#" -ne "2" ] && [ "$#" -ne "3" ] ; then
     5    echo "make-me-bootable <fname> <drive> [noaction]"
    66    exit 1
    77fi
    88
    9 dummy=$2
     9drivetouse=$2
    1010boot_drv=""
    1111boot_part=""
    1212root_drv=""
    1313root_part=""
     14if [ ! "$LOGFILE" ]; then
     15    LOGFILE="/tmp/mondorestore2.log"
     16fi
     17dummy="$3"
    1418
    15 HAVE_ACTIVE="false"
     19activepart=`parted2fdisk -l $drivetouse | tr -s '\t' ' ' | grep "$drivetouse" | grep '*' | cut -d' ' -f1`
     20
    1621for i in `cat $1 | tr -s '\t' ' ' | cut -d' ' -f1 | grep -vE "/dev/fd|none|#"` ; do
    17     mountpt=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f2`
    18     format=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f3`
    1922    # Warning wrong if LVM !
    2023    drive=`echo $i | sed -e 's/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'`
    21     partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'`
     24    if [ "$drivetouse" = "$drive" ]; then
     25        # We can continue as this is the drive we ned to work on
     26        partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'`
     27        mountpt=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f2`
    2228
    23     if [ "$HAVE_ACTIVE" = "false" ] && [ "`parted2fdisk -l $drive | tr -s '\t' ' ' | grep "$i " | grep -v "*"`" ] ; then
    2429        if [ "$mountpt" = "/" ] ; then
    2530            root_drv=$drive
    26         root_part=$partno
     31            root_part=$partno
    2732        elif [ "$mountpt" = "/boot" ] ; then
    2833            boot_drv=$drive
     
    4651
    4752if [ "$drive" ] ; then
     53    if [ "$partno" = "0" ] || [ ! "$partno" ] ; then
     54        partno="1"
     55    fi
     56    cmd=""
     57    for p in "$activepart"; do
     58        # First desactivate active partitions (coming from previous usage)
     59        cmd="${cmd}a\n$p\n"
     60        if [ "$dummy" != "" ] ; then
     61            echo "Will desactivate $p on $drive" >> $LOGFILE
     62        fi
     63    done
     64    # Then activate the one which should
    4865    if [ "$dummy" != "" ] ; then
    49         if [ "$partno" = "0" ] || [ ! "$partno" ] ; then
    50             partno="1"
    51         fi
    52         echo "$partno"
    53     else
    54         echo -en "a\n$partno\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE
    55     fi
     66        echo "Would activate $partno on $drive" >> $LOGFILE
     67    else
     68        echo -en "${cmd}a\n$partno\np\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE
     69    fi
    5670fi
    5771exit 0
  • branches/3.1/mondo/src/restore-scripts/mondo/stabgrub-me

    r2508 r3147  
    5757LocateOldGrub() {
    5858    old_grubconf=""
    59     if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ] || [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ] ; then
     59    if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ] || [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ] || [ -f "/mnt/RESTORING/boot/grub2/grub.cfg" ] ; then
    6060        LogIt "No need for menu.lst/grub.cfg search." 2
    6161        if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ]; then
     
    6363        elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then
    6464            old_grubconf=/mnt/RESTORING/boot/grub/grub.cfg
     65        elif [ -f "/mnt/RESTORING/boot/grub2/grub.cfg" ]; then
     66            old_grubconf=/mnt/RESTORING/boot/grub2/grub.cfg
    6567        fi
    6668        if [ -L "$old_grubconf" ] ; then
     
    6870            if [ _"`echo $l | cut -c1`" = _"/" ]; then
    6971                # If readlink gives an absolute path it's related to the chroot
    70                 old_grubconf=/mnt/RESTORING/$l
     72                        old_grubconf=/mnt/RESTORING/$l
    7173            else
    7274                # If readlink gives a relative path, it's in the same dir
    73                 old_grubconf=/mnt/RESTORING/boot/grub/$l
     75                    d=`dirname "$old_grubconf"`
     76                        old_grubconf=$d/$l
    7477            fi
    75         fi 
     78        fi
    7679        return 0
    7780    fi
     
    128131elif [ -f /mnt/RESTORING/boot/grub/grub.cfg ]; then
    129132    new_grubconf=/mnt/RESTORING/boot/grub/grub.cfg.NEW
     133elif [ -f /mnt/RESTORING/boot/grub2/grub.cfg ]; then
     134    new_grubconf=/mnt/RESTORING/boot/grub2/grub.cfg.NEW
    130135fi
    131136# change back to /tmp if /mnt/RESTORING/etc be problematic
Note: See TracChangeset for help on using the changeset viewer.