Changeset 3403 in MondoRescue


Ignore:
Timestamp:
Aug 5, 2015, 8:39:46 AM (9 years ago)
Author:
Bruno Cornec
Message:

Continue to improve mindi for UEFI support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi/mindi

    r3402 r3403  
    113113ISO_OPT="-J -r -v -p Mindi -publisher http://www.mondorescue.org -A Mindi"
    114114
     115# Mindi should master this in fact
     116#BOOT_TYPE="BIOS"
     117
    115118# Mandriva system e.g. use cdrkit, which uses genisoimage instead of mkisofs.
    116119# However, they use exactly the same command line parameters, so just
     
    135138    echo -e "$1" >> $LOGFILE
    136139    if [ _"$2" != _"" ]; then
    137         grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE
     140        grep -Ev "tar: Removing [a-z ]*\`/\'" "$2" >> $LOGFILE
    138141    fi
    139142    rm -f "$2"
     
    185188    fi
    186189    if [ _"$2" != _"" ]; then
    187         grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE
     190        grep -Ev "tar: Removing [a-z ]*\`/\'" "$2" >> $LOGFILE
    188191    fi
    189192    rm -f "$2"
     
    274277
    275278CopyDependenciesToDirectory() {
    276     local outdir incoming counter d found tdir
     279    local outdir incoming counter d found tdir templog
    277280    outdir=$1
     281    templog=$MINDI_TMP/$$.log
    278282    mkdir -p $outdir
    279283    incoming=`ReadLine`
    280284    counter=0
     285    > $templog
     286
    281287    while [ "$incoming" != "" ] ; do
    282288        # Non absolute file names should not arrive till here => skipped
     
    297303        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    298304            if [ ! -h "$incoming" ]; then
    299                 tar cf - -C / $incoming 2>> $MINDI_TMP/$$.log | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $MINDI_TMP/$$.log
     305                tar cf - -C / $incoming 2>> $templog | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $templog
    300306            else
    301307                tdir=`dirname "$incoming"`
     
    14271433
    14281434OfferToMakeBootableISO() {
    1429     local i old_pwd
     1435    local i old_pwd files
    14301436    if [ -z "$ISO_CMD" ]; then
    14311437        LogAll "ERROR: Neither mkisofs nor genisoimage found, unable to make CD image"
     
    14401446    mkdir -p $MINDI_TMP/iso/{images,archives}
    14411447    LogFile "INFO: mindi_lib = $MINDI_LIB"
    1442     cp -f $MINDI_CACHE/{*.gz,*.img} $MINDI_TMP/iso/images 2>> $LOGFILE || LogAll "WARNING: OfferToMakeBootableISO: Cannot copy $MINDI_CACHE/*.gz to $MINDI_TMP/iso/images"
     1448    files=`ls $MINDI_CACHE/{*.gz,*.img}`
     1449    cp -f $files $MINDI_TMP/iso/images 2>> $LOGFILE || LogAll "WARNING: OfferToMakeBootableISO: Cannot copy files to $MINDI_TMP/iso/images"
    14431450    for i in memdisk memtest.bin memtest.img ; do
    14441451        j=$MINDI_LIB/$i
     
    15131520
    15141521OfferToMakeBootableUSB() {
    1515     local i
     1522    local i files
    15161523    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then
    15171524        echo -n "Shall I make a bootable USB device ? (y/[n]) "
     
    15461553    LogFile "INFO: Unmounting $USBPART just in case"
    15471554    umount $USBPART 2>> $LOGFILE 1>> $LOGFILE
    1548     # If your key has no MBR it may cause an issue
    1549     # Use dd if=mbr.bin of=$USBDEVICE or ms-sys -s $USBDEVICE
    1550     if [ -r $MBRFILE ]; then
    1551         LogAll "INFO: Installing an MBR ($MBRFILE) on $USBDEVICE"
    1552         dd if=$MBRFILE of=$USBDEVICE
    1553     else
    1554         LogAll "WARNING: You may need to install an MBR (usually in $MBRFILE, but not found on your system)"
    1555         LogAll "         on $USBDEVICE with dd if=$MBRFILE of=$USBDEVICE"
     1555    if [ $BOOT_TYPE = "BIOS" ]; then
     1556        # If your key has no MBR it may cause an issue
     1557        # Use dd if=mbr.bin of=$USBDEVICE or ms-sys -s $USBDEVICE
     1558        if [ -r $MBRFILE ]; then
     1559            LogAll "INFO: Installing an MBR ($MBRFILE) on $USBDEVICE"
     1560            dd if=$MBRFILE of=$USBDEVICE
     1561        else
     1562            LogAll "WARNING: You may need to install an MBR (usually in $MBRFILE, but not found on your system)"
     1563            LogAll "         on $USBDEVICE with dd if=$MBRFILE of=$USBDEVICE"
     1564        fi
    15561565    fi
    15571566    LogFile "INFO: Preparing $USBDEVICE"
     
    16241633    echo -en "."
    16251634    mkdir -p $MINDI_TMP/usb/images
    1626     cp -f $MINDI_CACHE/*.img $MINDI_CACHE/*.gz $MINDI_TMP/usb/images 2>> $LOGFILE || LogAll "ERROR: OfferToMakeBootableUSB: Cannot copy $i to $MINDI_TMP/usb/images"
     1635    files=`ls $MINDI_CACHE/{*.gz,*.img}`
     1636    cp -f $files $MINDI_TMP/usb/images 2>> $LOGFILE || LogAll "ERROR: OfferToMakeBootableUSB: Cannot copy files to $MINDI_TMP/usb/images"
    16271637    echo -en "."
    16281638    LogFile "INFO: mindi_lib = $MINDI_LIB"
     
    19161926    if [ "$?" -ne "0" ] ; then
    19171927        LogAll "ERROR: Failed to copy $MINDI_TMP/initrd.img to $mountpoint"
    1918         cat $MINDI_TMP/mtpt.$$ >> $LOGFILE
    19191928        LogAll "       Please unload some of your modules and try again."
    1920         rm -f $MINDI_TMP/mtpt.$$
    19211929        LogAll "ERROR: Cannot incorporate initrd.img in bootdisk (kernel / modules too big?)"
    19221930        LogAll "       Try to increase EXTRA_SPACE and BOOT_SIZE in $MINDI_CONFIG"
     
    20512059    # master boot record, too
    20522060    i=`cat $MINDI_TMP/BOOTLOADER.DEVICE 2> /dev/null`
    2053     if [ "$i" ] ; then
     2061    if [ "$i" ] && [ "$BOOT_TYPE" = "BIOS" ]; then
    20542062        LogAll "INFO: Backing up $i's MBR"
    20552063        dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
     
    23662374
    23672375TurnTgzIntoRdz() {
    2368     local tgz_dir_fname rdz_fname tempfile old_pwd nodes kernelsize maxsize res currsize not_copied j k s w needed_modules_path d thelink
     2376    local tgz_dir_fname rdz_fname tempfile old_pwd nodes kernelsize maxsize res currsize not_copied j k s w needed_modules_path d thelink templog
    23692377
    23702378    tgz_dir_fname=$1
     
    23742382    maxsize=$(($maxsize*2)); # to allow for compression of 50%
    23752383    tempfile=$MINDI_TMP/temp.rd
    2376     res=0
     2384    res=0
     2385    templog=$MINDI_TMP/$$.log
     2386    > $templog
     2387
    23772388    echo -en "..."
    23782389    dd if=/dev/zero of=$tempfile bs=1k count=$ramdisk_size &> /dev/null || Die "Not enough room for temporary ramdisk (TurnTgzIntoRdz)"
     
    24832494    rm -f $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis
    24842495
    2485     #tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log
    2486     echo "INFO: Copy the minimal env with cp -a --parents $finallist -t $mountpoint" 2>&1 >> $MINDI_TMP/$$.log
    2487     cp -a --parents $finallist -t $mountpoint 2>> $MINDI_TMP/$$.log || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log
     2496    #tar cf - $finallist 2>> $templog | tar xf - || LogIt "WARNING: Problem in minimal analysis" $templog
     2497    echo "INFO: Copy the minimal env with cp -a --parents $finallist -t $mountpoint" 2>&1 >> $templog
     2498    cp -a --parents $finallist -t $mountpoint 2>> $templog || LogIt "WARNING: Problem in minimal analysis" $templog
    24882499
    24892500    # In case target /bin dir still doesn't exist, create it before using it
     
    25102521        echo "udev device manager found" > $mountpoint/tmp/USE-UDEV
    25112522        LogIt "INFO: udev device manager found"
    2512         tar cf - -C / /etc/udev 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in /etc/udev analysis" $MINDI_TMP/$$.log
     2523        tar cf - -C / /etc/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /etc/udev analysis" $templog
    25132524        # This avoids NIC remapping if on another machine at restore time on Debian/Ubuntu at least
    25142525        rm -f ./etc/udev/rules.d/[z]*[0-9][0-9][-_]persistent-net.rules
    25152526        # Do not do it if it's a link (Ubuntu 64 bits #503)
    25162527        if [ -e "/lib64/udev" ] && [ ! -h "/lib64" ] && [ ! -h "/lib64/udev" ]; then
    2517             tar cf - -C / /lib64/udev 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in /lib64/udev analysis" $MINDI_TMP/$$.log
     2528            tar cf - -C / /lib64/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /lib64/udev analysis" $templog
    25182529        fi
    25192530        if [ -e "/lib32/udev" ] && [ ! -h "/lib32" ] && [  ! -h "/lib32/udev" ]; then
    2520             tar cf - -C / /lib32/udev 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in /lib32/udev analysis" $MINDI_TMP/$$.log
     2531            tar cf - -C / /lib32/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /lib32/udev analysis" $templog
    25212532        fi
    25222533        if [ -e "/lib/udev" ] && [ ! -h "/lib" ] && [  ! -h "/lib/udev" ]; then
    2523             tar cf - -C / /lib/udev 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in /lib/udev analysis" $MINDI_TMP/$$.log
     2534            tar cf - -C / /lib/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /lib/udev analysis" $templog
    25242535        fi
    25252536        if [ -e "/usr/lib/udev" ] && [ ! -h "/usr/lib" ] && [  ! -h "/usr/lib/udev" ]; then
    2526             tar cf - -C / /usr/lib/udev 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in /usr/lib/udev analysis" $MINDI_TMP/$$.log
     2537            tar cf - -C / /usr/lib/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /usr/lib/udev analysis" $templog
    25272538        fi
    25282539        if [ -x /sbin/udevd ] || [ -x /usr/bin/udevd ] || [ -x /usr/lib/systemd/systemd-udevd ]; then
     
    25642575                fi
    25652576            done
    2566             #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $MINDI_TMP/$$.log
    2567             echo "INFO: Copying udev related files with cp -a --parents $finallist -t $mountpoint/" 2>&1 >> $MINDI_TMP/$$.log
    2568             cp -a --parents $finallist -t $mountpoint/ 2>> $MINDI_TMP/$$.log  || LogIt "ERROR: Problem in udev.lis analysis" $MINDI_TMP/$$.log
     2577            #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $templog
     2578            echo "INFO: Copying udev related files with cp -a --parents $finallist -t $mountpoint/" 2>&1 >> $templog
     2579            cp -a --parents $finallist -t $mountpoint/ 2>> $templog  || LogIt "ERROR: Problem in udev.lis analysis" $templog
    25692580            rm -f $MINDI_TMP/udev.lis
    25702581        else
     
    25842595            lis=`grep -Ev '^#' $MINDI_CACHE/tools.files`
    25852596            LocateDeps $lis > $MINDI_TMP/tools.lis
    2586             tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in tools.lis analysis" $MINDI_TMP/$$.log
     2597            tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in tools.lis analysis" $templog
    25872598        fi
    25882599        if [ -f $MINDI_CACHE/mindi-rsthw ]; then
     
    25942605
    25952606    # Management of perl scripts delivered needed at restore time
    2596     LogIt "INFO: Analyzing perl modules dependencies" $MINDI_TMP/$$.log
    2597     mindi-get-perl-modules `cat $MINDI_CONF/perl-scripts` /usr/[s]*bin/mr-* 2>> $MINDI_TMP/$$.log > $MINDI_TMP/perl.lis
    2598     LogIt "DBG4: Perl Modules found:" $MINDI_TMP/$$.log
    2599     LogIt "-------------------------" $MINDI_TMP/$$.log
    2600     cat $MINDI_TMP/perl.lis >> $MINDI_TMP/$$.log
    2601     LogIt "-------------------------" $MINDI_TMP/$$.log
    2602     tar cf - `cat $MINDI_TMP/perl.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in perl scripts analysis" $MINDI_TMP/$$.log
     2607    LogIt "INFO: Analyzing perl modules dependencies"
     2608    mindi-get-perl-modules `cat $MINDI_CONF/perl-scripts` /usr/[s]*bin/mr-* 2>> $templog > $MINDI_TMP/perl.lis || LogIt "ERROR: Problem in mindi-get-perl-modules" $templog
     2609    LogIt "DBG4: Perl Modules found:"
     2610    LogIt "-------------------------"
     2611    cat $MINDI_TMP/perl.lis >> $LOGFILE
     2612    LogIt "-------------------------"
     2613    tar cf - `cat $MINDI_TMP/perl.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in perl scripts analysis" $templog
    26032614
    26042615    for w in cdrom groovy-stuff ; do
     
    26062617    done
    26072618
    2608     tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in fd dev analysis" $MINDI_TMP/$$.log
     2619    tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2>> $templog | tar xf -  || LogIt "ERROR: Problem in fd dev analysis" $templog
    26092620
    26102621    echo -en "..."
     
    26352646
    26362647    LogFile "INFO: Adding $needed_modules to the rootfs with $mkgmopt"
    2637     cp --parents -aL $needed_modules $mountpoint/ 2>> $MINDI_TMP/$$.log || LogIt "ERROR: Unable to copy modules to $mountpoint" $MINDI_TMP/$$.log
     2648    cp --parents -aL $needed_modules $mountpoint/ 2>> $templog || LogIt "ERROR: Unable to copy modules to $mountpoint" $templog
    26382649
    26392650    # Uncompress modules if not using udev and native modprobe
     
    26542665
    26552666    # Also copy modules.* in case of udev so that normal modprobe works
    2656     tar cf - -C / /$needed_modules_path/modules.* 2>> $MINDI_TMP/$$.log | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy modules.* to $mountpoint" $MINDI_TMP/$$.log
     2667    tar cf - -C / /$needed_modules_path/modules.* 2>> $templog | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy modules.* to $mountpoint" $templog
    26572668
    26582669    # Copy FW in case some drivers needs it
     
    26862697            lis="/usr/bin/sg_map /usr/bin/sg_inq /usr/bin/sg_reset /usr/bin/rev"
    26872698            LocateDeps $lis > $MINDI_TMP/obdr.lis
    2688             (cd $mountpoint ; tar cf - $lis -C /  `sort -u $MINDI_TMP/obdr.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in obdr.lis analysis" $MINDI_TMP/$$.log)
     2699            (cd $mountpoint ; tar cf - $lis -C /  `sort -u $MINDI_TMP/obdr.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in obdr.lis analysis" $templog)
    26892700            LogIt "INFO: Copying /usr/bin/sg_reset to ramdisk for improved SCSI OBDR support"
    26902701            found=1
Note: See TracChangeset for help on using the changeset viewer.