Changeset 3405 in MondoRescue


Ignore:
Timestamp:
Aug 6, 2015, 8:10:22 AM (5 years ago)
Author:
Bruno Cornec
Message:

Improve logging

Better usage of LogIt? (rarely for screen logs)
Erease templog each time as not reused

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi/mindi

    r3403 r3405  
    303303        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    304304            if [ ! -h "$incoming" ]; then
    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
     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
    306306            else
    307307                tdir=`dirname "$incoming"`
     
    651651            LogIt "ERROR: Cannot find mondo*restore in mondo's tempdir, $MINDI_TMP"
    652652            LogIt "       I bet you've got a spare copy of Mondo or Mindi floating around on your system."
    653             LogIt "       If Mindi was called by Mondo then send me a bug report."
     653                LogIt "       If Mindi was called by Mondo then send me a bug report."
    654654            LogIt "       It not, type 'ps ax' to see which Mondo-related process is still running then kill it. :-)"
    655655            LogIt "       Finally, run Mindi again."
     
    24942494    rm -f $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis
    24952495
    2496     #tar cf - $finallist 2>> $templog | tar xf - || LogIt "WARNING: Problem in minimal analysis" $templog
     2496    #tar cf - $finallist 2> $templog | tar xf - || LogIt "WARNING: Problem in minimal analysis" $templog
    24972497    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
     2498    cp -a --parents $finallist -t $mountpoint 2> $templog || LogIt "WARNING: Problem in minimal analysis" $templog
    24992499
    25002500    # In case target /bin dir still doesn't exist, create it before using it
     
    25102510    # To improve support for distribution scripts, we now prefer to use bash as the std shell. Also fixes #600
    25112511    ln -sf /bin/bash bin/sh
    2512     LogIt "INFO: Using bash as default shell"
     2512    LogFile "INFO: Using bash as default shell"
    25132513
    25142514    # Avoids an issue on some distro (RHEL5)
     
    25202520    if [ $? -eq 0 ]; then
    25212521        echo "udev device manager found" > $mountpoint/tmp/USE-UDEV
    2522         LogIt "INFO: udev device manager found"
    2523         tar cf - -C / /etc/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /etc/udev analysis" $templog
     2522        LogFile "INFO: udev device manager found"
     2523        tar cf - -C / /etc/udev 2> $templog | tar xf -  || LogIt "ERROR: Problem in /etc/udev analysis" $templog
    25242524        # This avoids NIC remapping if on another machine at restore time on Debian/Ubuntu at least
    25252525        rm -f ./etc/udev/rules.d/[z]*[0-9][0-9][-_]persistent-net.rules
    25262526        # Do not do it if it's a link (Ubuntu 64 bits #503)
    25272527        if [ -e "/lib64/udev" ] && [ ! -h "/lib64" ] && [ ! -h "/lib64/udev" ]; then
    2528             tar cf - -C / /lib64/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /lib64/udev analysis" $templog
     2528            tar cf - -C / /lib64/udev 2> $templog | tar xf -  || LogIt "ERROR: Problem in /lib64/udev analysis" $templog
    25292529        fi
    25302530        if [ -e "/lib32/udev" ] && [ ! -h "/lib32" ] && [  ! -h "/lib32/udev" ]; then
    2531             tar cf - -C / /lib32/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /lib32/udev analysis" $templog
     2531            tar cf - -C / /lib32/udev 2> $templog | tar xf -  || LogIt "ERROR: Problem in /lib32/udev analysis" $templog
    25322532        fi
    25332533        if [ -e "/lib/udev" ] && [ ! -h "/lib" ] && [  ! -h "/lib/udev" ]; then
    2534             tar cf - -C / /lib/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /lib/udev analysis" $templog
     2534            tar cf - -C / /lib/udev 2> $templog | tar xf -  || LogIt "ERROR: Problem in /lib/udev analysis" $templog
    25352535        fi
    25362536        if [ -e "/usr/lib/udev" ] && [ ! -h "/usr/lib" ] && [  ! -h "/usr/lib/udev" ]; then
    2537             tar cf - -C / /usr/lib/udev 2>> $templog | tar xf -  || LogIt "ERROR: Problem in /usr/lib/udev analysis" $templog
     2537            tar cf - -C / /usr/lib/udev 2> $templog | tar xf -  || LogIt "ERROR: Problem in /usr/lib/udev analysis" $templog
    25382538        fi
    25392539        if [ -x /sbin/udevd ] || [ -x /usr/bin/udevd ] || [ -x /usr/lib/systemd/systemd-udevd ]; then
     
    25752575                fi
    25762576            done
    2577             #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $templog
     2577            #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2> $templog | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $templog
    25782578            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
     2579            cp -a --parents $finallist -t $mountpoint/ 2> $templog  || LogIt "ERROR: Problem in udev.lis analysis" $templog
    25802580            rm -f $MINDI_TMP/udev.lis
    25812581        else
     
    25952595            lis=`grep -Ev '^#' $MINDI_CACHE/tools.files`
    25962596            LocateDeps $lis > $MINDI_TMP/tools.lis
    2597             tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in tools.lis analysis" $templog
     2597            tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2> $templog | tar xf - || LogIt "ERROR: Problem in tools.lis analysis" $templog
    25982598        fi
    25992599        if [ -f $MINDI_CACHE/mindi-rsthw ]; then
     
    26062606    # Management of perl scripts delivered needed at restore time
    26072607    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 "-------------------------"
     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    LogFile "DBG4: Perl Modules found:"
     2610    LogFile "-------------------------"
    26112611    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
     2612    LogFile "-------------------------"
     2613    tar cf - `cat $MINDI_TMP/perl.lis` 2> $templog | tar xf - || LogIt "ERROR: Problem in perl scripts analysis" $templog
    26142614
    26152615    for w in cdrom groovy-stuff ; do
     
    26172617    done
    26182618
    2619     tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2>> $templog | tar xf -  || LogIt "ERROR: Problem in fd dev analysis" $templog
     2619    tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2> $templog | tar xf -  || LogIt "ERROR: Problem in fd dev analysis" $templog
    26202620
    26212621    echo -en "..."
     
    26462646
    26472647    LogFile "INFO: Adding $needed_modules to the rootfs with $mkgmopt"
    2648     cp --parents -aL $needed_modules $mountpoint/ 2>> $templog || LogIt "ERROR: Unable to copy modules to $mountpoint" $templog
     2648    cp --parents -aL $needed_modules $mountpoint/ 2> $templog || LogIt "ERROR: Unable to copy modules to $mountpoint" $templog
    26492649
    26502650    # Uncompress modules if not using udev and native modprobe
     
    26652665
    26662666    # Also copy modules.* in case of udev so that normal modprobe works
    2667     tar cf - -C / /$needed_modules_path/modules.* 2>> $templog | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy modules.* to $mountpoint" $templog
     2667    tar cf - -C / /$needed_modules_path/modules.* 2> $templog | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy modules.* to $mountpoint" $templog
    26682668
    26692669    # Copy FW in case some drivers needs it
     
    26972697            lis="/usr/bin/sg_map /usr/bin/sg_inq /usr/bin/sg_reset /usr/bin/rev"
    26982698            LocateDeps $lis > $MINDI_TMP/obdr.lis
    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)
     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)
    27002700            LogIt "INFO: Copying /usr/bin/sg_reset to ramdisk for improved SCSI OBDR support"
    27012701            found=1
     
    33373337    LogIt "INFO: Your $MRCFG file is:"
    33383338    LogIt "--------------------------"
    3339     cat $MINDI_TMP/$MRCFG >> $LOGFILE
     3339    cat $MINDI_TMP/$MRCFG | tee -a $LOGFILE
    33403340    LogIt "--------------------------"
    33413341else
Note: See TracChangeset for help on using the changeset viewer.