Changeset 3149


Ignore:
Timestamp:
Jun 19, 2013, 8:59:05 AM (6 years ago)
Author:
bruno
Message:
  • Minimize diffs between mindi 3.0 and mindi 3.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/mindi

    r3146 r3149  
    3434MINDI_SBIN=${MINDI_PREFIX}/sbin
    3535MINDI_LIB=LLL
     36MINDI_CACHE=/var/cache/mindi
    3637
    3738# Temporary directory for mindi
     
    8586
    8687LOGFILE=/var/log/mindi.log
    87 MINDI_CACHE=/var/cache/mindi
    8888BOOT_MEDIA_MESSAGE="\
    8989To format and restore all files automatically, type 'nuke' <enter>.\n\
     
    156156# Should be declared here as used immediately below potentialy
    157157MindiExit() {
    158     echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE
    159     echo "End date : `date`" >> $LOGFILE
     158    LogFile "Mindi $MINDI_VERSION is exiting"
     159    LogFile "End date : `date`"
    160160    if [ _"$MONDO_SHARE" != _"" ] ; then
    161161        echo "------------- mindi logfile included -------------------------" >> /var/log/mondoarchive.log
     
    181181    local i
    182182    if [ "$1" = "" ] ; then
    183         LogIt "FATAL ERROR"
    184     else
    185         LogIt "FATAL ERROR. $1"
     183        LogAll "FATAL ERROR"
     184    else
     185        LogAll "FATAL ERROR. $1"
    186186    fi
    187187    if [ _"$2" != _"" ]; then
     
    190190    rm -f "$2"
    191191
    192     LogIt "Please e-mail a copy of $LOGFILE to the mailing list."
    193     LogIt "See http://www.mondorescue.org for more information."
    194     LogIt "WE CANNOT HELP unless you enclose that file.\n"
     192    LogAll "Please e-mail a copy of $LOGFILE to the mailing list."
     193    LogAll "See http://www.mondorescue.org for more information."
     194    LogAll "WE CANNOT HELP unless you enclose that file.\n"
    195195    MindiExit -1
    196196}
     
    238238    [ "$KBDEPTH" -gt "128" ] && Die "Edit $MINDI_SBIN/mindi and disable FindAndAddUserKeyboardMappingFile (line 2160, approx.)"
    239239    if [ -e "$bigdir/$mappath" ] ; then
    240         LogFile "INFO: $mappath already added" >> $LOGFILE
     240        LogFile "INFO: $mappath already added"
    241241        return
    242242    elif [ -d "$bigdir/$mappath" ] ; then
     
    244244        return
    245245    fi
    246     LogFile "INFO: Added kbd map $mappath" >> $LOGFILE
     246    LogFile "INFO: Added kbd map $mappath"
    247247    if [ ! -e "$mappath" ] ; then
    248             mappath=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"`
     248        mappath=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"`
    249249        if [ ! -e "$mappath" ] ; then
    250             LogIt "WARNING: Cannot add $mappath: kbd map file not found"
     250            LogAll "WARNING: Cannot add $mappath: kbd map file not found"
    251251            return
    252252        fi
     
    255255    fi
    256256
     257    # TODO: Why that
    257258    mkdir -p $bigdir/etc
    258     tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogIt "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log
     259    tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogAll "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log
    259260    if [ "`echo $mappath | grep -F ".gz"`" ] ; then
    260261        included_list=`gzip -dc $mappath | grep -Fi include | sed s/'"'//g | cut -d' ' -f2`
     
    264265    for included_item in $included_list ; do
    265266        if [ ! -e "$included_item" ] ; then
    266                 sss=`grep -F "${included_item}.inc" $MINDI_TMP/keymaps.find`
     267            sss=`grep -F "${included_item}.inc" $MINDI_TMP/keymaps.find`
    267268            [ "$sss" = "" ] && sss=`grep -F "$included_item" $MINDI_TMP/keymaps.find`
    268269            for ii in $sss ; do
     
    285286        # Non absolute file names should not arrive till here => skipped
    286287        if [ `echo "$incoming" | cut -c1` != '/' ]; then
    287             LogIt "WARNING: Unable to handle $incoming"
     288            LogAll "WARNING: Unable to handle $incoming"
    288289            incoming=`ReadLine`
    289290            continue
     
    297298        done
    298299        if [ -d "$incoming" ]; then
    299             find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir
     300            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0
    300301        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    301302            if [ ! -h "$incoming" ]; then
     
    310311            # Only uncompress modules if not using udevd
    311312            if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
    312                 gunzip -f $outdir/$incoming || LogIt "WARNING: Cannot gunzip $outdir/$incoming"
     313                gunzip -f $outdir/$incoming || LogAll "WARNING: Cannot gunzip $outdir/$incoming"
    313314            fi
    314315            [ -x "$outdir" ] && StripExecutable $outdir
    315316            counter=$(($counter+1))
    316             if [ "$counter" -ge "5" ] ; then
    317                 counter=0
    318                 echo -en "."
    319             fi
     317            LogProgress $counter $2
    320318        fi
    321319        incoming=`ReadLine`
     
    357355            LogFile "INFO: Adding as deps $resolved to filelist"
    358356            vanilla_resolved_name=`echo "$resolved" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'`
    359             mkdir -p $outdir$resolved> /dev/null 2> /dev/null
    360             rmdir $outdir$resolved > /dev/null 2> /dev/null
    361             ln -sf $vanilla_resolved_name $outdir$resolved
    362             LogFile "INFO: Excluding deps $resolved"
    363             grep -Fvx "$resolved" "$filelist" > $filelist.tmp
    364             LogFile "INFO: Replacing it with $vanilla_resolved_name"
    365             echo "$vanilla_resolved_name" >> $filelist.tmp
    366             mv -f $filelist.tmp $filelist
     357            if [ "$vanilla_resolved_name" != "$resolved" ]; then
     358                mkdir -p $outdir$resolved> /dev/null 2> /dev/null
     359                rmdir $outdir$resolved > /dev/null 2> /dev/null
     360                ln -sf $vanilla_resolved_name $outdir$resolved
     361                LogFile "INFO: Excluding deps $resolved"
     362                grep -Fvx "$resolved" "$filelist" > $filelist.tmp
     363                LogFile "INFO: Replacing it with $vanilla_resolved_name"
     364                echo "$vanilla_resolved_name" >> $filelist.tmp
     365                mv -f $filelist.tmp $filelist
     366            fi
    367367        done
    368368    done
     
    375375FindAndAddUserKeyboardMappingFile() {
    376376    local r res mapfile mappath included_item included_list keyfile mp locale
    377     LogIt "INFO: Analyzing your keyboard's configuration."
     377    LogAll "INFO: Analyzing your keyboard's configuration."
    378378    KEYDIR=/lib/kbd
    379379    [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share/kbd     # Slackware
     
    383383    [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole-setup
    384384    if [ ! -e "$KEYDIR" ] ; then
    385         LogIt "WARNING: Keyboard mapping directory not found. I shall use default map at boot-time."
     385        LogAll "WARNING: Keyboard mapping directory not found. I shall use default map at boot-time."
    386386        return 0
    387387    fi
     
    397397    elif [ -e "/etc/console/boottime.kmap.gz" ] ; then
    398398        LogFile "INFO: Debian-style config detected."
    399         echo -en "INFO: Adding the following keyboard mapping tables: "
    400399        mkdir -p $bigdir/tmp
    401400        echo "/etc/console/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE
     
    408407    elif [ -e "/etc/console-setup/boottime.kmap.gz" ] || [ -e "/etc/console-setup/cached.kmap.gz" ] ; then
    409408        LogFile "INFO: Ubuntu-style config detected."
    410         echo -en "INFO: Adding the following keyboard mapping tables: "
    411409        mkdir -p $bigdir/tmp
    412410        if [ -e "/etc/console-setup/boottime.kmap.gz" ] ; then
     
    429427        keyfile=/etc/conf.d/keymaps
    430428    else
    431         echo -en "Searching for rc.config ..."
     429        LogFile "Searching for rc.config ..."
    432430        keyfile=`find /etc -name rc.config | head -n1`
    433431        if [ "$keyfile" = "" ] || [ ! -e "$keyfile" ] ; then
    434             LogIt "WARNING: Unknown config detected. Default keyboard map will be used."
     432            LogAll "WARNING: Unknown config detected. Default keyboard map will be used."
    435433            return
    436434        else
     
    439437    fi
    440438    if [ ! -e "$KEYDIR/keymaps" ] ; then
    441         LogIt "WARNING: Keyboard mapping directory not found. Default keyboard map will be used."
     439        LogAll "WARNING: Keyboard mapping directory not found. Default keyboard map will be used."
    442440        return
    443441    fi
     
    456454    [ ! "$mp" ] && mp=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"`
    457455    # If we have multiple keymaps then log it !!
    458     echo "$mp" | grep -q " "
     456    echo "$mp" | grep -q " " >> $LOGFILE
    459457    if [ $? -eq 0 ]; then
    460458        LogAll "WARNING: Multiple keymaps found: $mp"
     
    470468    LogFile "INFO: mappath = $mappath"
    471469    if [ ! -e "$mappath" ] || [ -d "$mappath" ] ; then
    472         LogIt "WARNING: Keyboard mapping file not found. Default keyboard map will be used."
     470        LogAll "WARNING: Keyboard mapping file not found. Default keyboard map will be used."
    473471        return
    474472    fi
    475     echo -en "INFO: Adding the following keyboard mapping tables: "
     473    LogAll "INFO: Adding the following keyboard mapping tables: "
    476474    mkdir -p $bigdir/tmp
    477475    echo "$mappath" > $bigdir/tmp/KEYMAP-LIVES-HERE
     
    519517    fi
    520518    if [ ! -e "$1" ] ; then
    521         LogIt "WARNING: cannot search specific path '$1'"
     519        LogAll "WARNING: cannot search specific path '$1'"
    522520        return 1
    523521    fi
    524522    # Find all files and links (required for some VMWare VMs)
    525     modpaths=`find $1 -name $2.*o -o -name $2.o.gz -o -name $2.ko.gz -o -name $2.ko.xz -o -name $2 -type f -o -type l`
     523    modpaths=`find "$1" -name $2.*o -o -name $2.o.gz -o -name $2.ko.gz -o -name $2.ko.xz -o -name $2 -type f -o -type l`
    526524    echo "$modpaths"
    527525    cd "$pwd"
     
    551549        filelist=`GenerateListForFile "$incoming"`
    552550        r=$?
    553         [ "$r" -ne "0" ] && LogIt "WARNING: $incoming not found"
     551        [ "$r" -ne "0" ] && LogAll "WARNING: $incoming not found"
    554552        res=$(($res+$r))
    555553#       LogFile "INFO: '$incoming' generates filelist '$filelist'"
     
    558556        done
    559557        progress=$(($progress+1))
    560         echo -en "\r\t\t\t\t\t\t\t\t"
    561         i=$(($progress*100))
    562         i=$(($i/$noof_lines))
    563         echo -en "$i"
    564         echo -en "%"
    565         modres=$(($progress%4))
    566         [ "$modres" -eq "0" ] && echo -en "\t/"
    567         [ "$modres" -eq "1" ] && echo -en "\t-"
    568         [ "$modres" -eq "2" ] && echo -en "\t\\"
    569         [ "$modres" -eq "3" ] && echo -en "\t|"
     558        LogProgress $progress $noof_lines
    570559        incoming=`ReadLine`
    571560    done
     
    618607            done
    619608            progress=$(($progress+1))
    620             echo -en "\r\t\t\t\t\t\t\t\t"
    621             i=$(($progress*100))
    622             i=$(($i/$noof_lines))
    623             echo -en "$i"
    624             echo -en "%"
    625             modres=$(($progress%4))
    626             [ "$modres" -eq "0" ] && echo -en "\t/"
    627             [ "$modres" -eq "1" ] && echo -en "\t-"
    628             [ "$modres" -eq "2" ] && echo -en "\t\\"
    629             [ "$modres" -eq "3" ] && echo -en "\t|"
     609            LogProgress $progress $noof_lines
    630610            incoming=`ReadLine`
    631611        done
     
    645625        LocateDeps $fname | tee -a $LOGFILE >> $outfile.pre
    646626        progress=$(($progress+1))
    647         echo -en "\r\t\t\t\t\t\t\t\t"
    648         i=$(($progress*100))
    649         i=$(($i/$noof_lines))
    650         echo -en "$i"
    651         echo -en "%"
    652         modres=$(($progress%4))
    653         [ "$modres" -eq "0" ] && echo -en "\t/"
    654         [ "$modres" -eq "1" ] && echo -en "\t-"
    655         [ "$modres" -eq "2" ] && echo -en "\t\\"
    656         [ "$modres" -eq "3" ] && echo -en "\t|"
     627        LogProgress $progress $noof_lines
    657628    done
    658629    if [ _"$MONDO_SHARE" != _"" ]; then
     
    661632        mkdir -p $bigdir/bin
    662633        if [ -e "$MINDI_TMP/post-nuke.tgz" ] ; then
    663             LogIt "\nINFO: Incorporating post-nuke tarball"
     634            LogAll "\nINFO: Incorporating post-nuke tarball"
    664635            old_pwd=`pwd`
    665636            cd "$bigdir"
    666             tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || LogIt "ERROR: when untarring post-nuke tarball" $MINDI_TMP/$$.log
     637            tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || LogAll "ERROR: when untarring post-nuke tarball" $MINDI_TMP/$$.log
    667638            cd "$old_pwd"
    668639        fi
     
    679650        cp -f $MINDI_TMP/BOOTLOADER.* $bigdir 2>> $LOGFILE || LogIt "\nINFO: Mondo v1.2x defaults to LILO as the bootloader, BTW."
    680651        if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    681             LogIt "\nINFO: Incorporating Network-related settings"
     652            LogAll "\nINFO: Incorporating Network-related settings"
    682653            for r in NETFS-* ISO-PREFIX ; do
    683654                cp -f $MINDI_TMP/$r $bigdir/tmp 2>> $LOGFILE || Die "Cannot copy $r - did you run out of disk space?"
     
    718689        du -sk $i
    719690    done
    720 }
    721 
    722 
    723 GetHomeDir() {
    724     local res loc
    725     loc=`which $1 2>/dev/null`
    726     res=`file $loc | $AWK '{print $NF;}'`
    727     dirname $res
    728691}
    729692
     
    806769}
    807770
    808 # Searches parent raid device of given disk device
    809 # $1: disk device (i.e. /dev/hda1)
    810 GetParentRaidDev() {
    811     if [ ! -f /etc/raidtab ]; then
    812         return
    813     fi
    814     $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {dev=\$2} /^[[:space:]]*device/ {if(\$2==\"$1\") {print dev; exit}}" < /etc/raidtab
    815 }
    816 
    817 
    818771# Searches members of raid device
    819772# $1: raid device (/dev/md...)
     
    888841### Sq-Mod End
    889842###
     843    noof_lines=0
    890844    # Get rid of duplicates, so that if a live kernel module also appears
    891845    # in $EXTRA_MODS that it won't get reported as "live module file not found" twice.
     846    for module in `echo $module_list $EXTRA_MODS | tr ' ' '\n' | sort -u` ; do
     847        noof_lines=$(($noof_lines+1))
     848    done
     849    progress=0
    892850    for module in `echo $module_list $EXTRA_MODS | tr ' ' '\n' | sort -u` ; do
    893851        r=`find /lib/modules/$kern -type f | grep "/${module}\..*o" | tail -n1`
     
    902860        fi
    903861        LogFile "INFO: module $module --> $r"
     862        progress=$(($progress+1))
     863        LogProgress $progress $noof_lines
    904864    done
    905865    find /lib/modules/$kern/modules.* -type f 2> /dev/null
     
    994954}
    995955
     956LogProgress() {
     957    local i progress modres noof_lines
     958 
     959    progress=$1
     960    noof_lines=$2
     961
     962    echo -en "\r\t\t\t\t\t\t\t\t"
     963    i=$(($progress*100))
     964    if [ $noof_lines -ne 0 ]; then
     965        i=$(($i/$noof_lines))
     966    else
     967        i=0
     968    fi
     969    echo -en "$i"
     970    echo -en "%"
     971    modres=$(($progress%4))
     972    [ "$modres" -eq "0" ] && echo -en "\t/"
     973    [ "$modres" -eq "1" ] && echo -en "\t-"
     974    [ "$modres" -eq "2" ] && echo -en "\t\\"
     975    [ "$modres" -eq "3" ] && echo -en "\t|"
     976}
    996977
    997978# Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg
     
    1008989    use_lzo=$USE_LZO; [ "$use_lzo" = "" ] && use_lzo="no"
    1009990    use_gzip=$USE_GZIP; [ "$use_gzip" = "" ] && use_gzip="no"
     991    use_lzma=$USE_LZMA; [ "$use_lzma" = "" ] && use_lzma="no"
    1010992    use_comp=$USE_COMP; [ "$use_comp" = "" ] && use_comp="yes"
    1011993    use_star=$USE_STAR; [ "$use_star" = "" ] && use_star="no"
     
    1013995    echo "use-gzip $use_gzip" >> $outfile
    1014996    echo "use-star $use_star" >> $outfile
     997    echo "use-lzma $use_lzma" >> $outfile
    1015998    echo "use-comp $use_comp" >> $outfile
    1016999    echo "datestamp `date`" >> $outfile
    10171000    [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile
     1001    AddFileToCfgIfExists $MINDI_TMP/NETFS-DEV           netfs-dev           $outfile
     1002    AddFileToCfgIfExists $MINDI_TMP/NETFS-PROTO         netfs-proto           $outfile
    10181003    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-IPADDR netfs-client-ipaddr $outfile
    10191004    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-NETMASK netfs-client-netmask $outfile
     
    10241009    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-USER  netfs-server-user  $outfile
    10251010    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-PATH   netfs-server-path   $outfile
    1026     AddFileToCfgIfExists $MINDI_TMP/NETFS-DEV           netfs-dev           $outfile
    1027     AddFileToCfgIfExists $MINDI_TMP/NETFS-PROTO         netfs-proto           $outfile
    10281011    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-IPADDR netfs-server-ipaddr $outfile
    10291012    AddFileToCfgIfExists $MINDI_TMP/ISO-DEV           iso-dev           $outfile
     
    10611044absolute_partition old_partition_fmt current_lvolume uname skip
    10621045
     1046    LogFile "------------------------------------"
    10631047    LogFile "Your raw fstab file looks like this:"
    10641048    LogFile "------------------------------------"
    10651049    cat $MY_FSTAB >> $LOGFILE
     1050    LogAll "-----------------------------------"
    10661051    LogAll "Your mountlist will look like this:"
    1067     LogFile "-----------------------------------"
     1052    LogAll "-----------------------------------"
    10681053
    10691054# mountlist(OUT)
     
    10801065   
    10811066    if [ $LVM != "false" ]; then
    1082         echo -en "Analyzing LVM...\n"
     1067        LogAll "INFO: Analyzing LVM..."
    10831068        $MINDI_LIB/analyze-my-lvm > $MINDI_TMP/lvm.res
    10841069        if [ $? -ne 0 ]; then
     
    10931078    done
    10941079    [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`"
    1095     printf "        %-15s %-15s %-15s %-13s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABEL/UUID | tee -a $LOGFILE
     1080    printf "%-15s %-15s %-15s %-13s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE MB" LABEL/UUID | tee -a $LOGFILE
     1081    printf "%-15s %-15s %-15s %-13s %-15s\n" ------ ---------- ------  -------  ---------- | tee -a $LOGFILE
    10961082    useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1 tmpfs devpts sysfs proc debugfs"
    10971083    for c_p in $all_partitions ; do
     
    14151401                partition_format="compaq"
    14161402            elif [ ! "`grep -F device /etc/raidtab 2> /dev/null | grep -w $current_partition`" ] ; then
    1417                 LogIt "WARNING: Unable to find mountpoint of $current_partition - ignoring"
     1403                LogAll "WARNING: Unable to find mountpoint of $current_partition - ignoring"
    14181404                continue
    14191405            fi
     
    14261412        partition_format="`echo "$partition_format" | cut -d',' -f1`"; # in case user has ext3,ext2 or something dumb like that
    14271413        [ "$partition_format" = "auto" ] && partition_format="`mount | grep -w $current_partition | $AWK '{print$5;}'`"; # in case user uses 'auto' (dumb!)
    1428         unofficial_outstring=`printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"`
     1414        unofficial_outstring=`printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"`
    14291415        if [ "$current_partition" = "" ] ; then
    14301416            LogFile "WARNING: Unknown partition (outstring = $unofficial_outstring)"
     
    14331419                partition_mountpt=raid
    14341420                partition_format=raid
    1435                 printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
     1421                printf "%-15s %-15s %-15s %7s %15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
    14361422                printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist
    14371423            else
     
    14491435                partition_format="vfat"
    14501436            fi
    1451             printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
     1437            printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
    14521438            printf "%s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist
    14531439        fi
    14541440    done
     1441    LogAll "-----------------------------------"
    14551442}
    14561443
     
    14741461}
    14751462
    1476 MakeSureNumberIsInteger() {
    1477     res=`echo "$1" | tr -s '\-[0-9]' ' '`
    1478     if [ "$res" != " " ] && [ "$res" != "" ] ; then
    1479     echo "result = '$res'"
    1480         Die "$1 should be an integer"
    1481     fi
    1482 }
    1483 
    1484 
    14851463OfferToMakeBootableISO() {
    14861464    local i old_pwd
    14871465    if [ -z "$ISO_CMD" ]; then
    1488         LogIt "ERROR: Neither mkisofs nor genisoimage found, unable to make CD image"
     1466        LogAll "ERROR: Neither mkisofs nor genisoimage found, unable to make CD image"
    14891467        return
    14901468    fi
     
    14961474    rm -Rf $MINDI_TMP/iso
    14971475    mkdir -p $MINDI_TMP/iso/{images,archives}
    1498     cp -f $MINDI_CACHE/{*.gz,*.img} $MINDI_TMP/iso/images 2>> $LOGFILE || LogIt "WARNING: OfferToMakeBootableISO: Cannot copy $MINDI_CACHE/*.gz to $MINDI_TMP/iso/images"
    14991476    LogFile "INFO: mindi_lib = $MINDI_LIB"
     1477    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"
    15001478    for i in memdisk memtest.bin memtest.img ; do
    15011479        j=$MINDI_LIB/$i
    15021480        k=$MINDI_TMP/iso
    15031481        if [ -e "$j" ] ; then
    1504             LogIt "INFO: Copying $j to $k"
     1482            LogAll "INFO: Copying $j to $k"
    15051483            cp -f $j $k 2>> $LOGFILE || Die "Failed to copy $j to $k"
    15061484            cp -f $j $MINDI_TMP 2>> $LOGFILE || Die "Failed to copy $j to $MINDI_TMP"
     
    15481526        LogAll "$ISO_CMD returned the following errors:"
    15491527        cat $MINDI_TMP/mkisofs.log | tee -a $LOGFILE
    1550         LogIt "ERROR: Failed to create ISO image."
     1528        LogAll "ERROR: Failed to create ISO image."
    15511529    else
    15521530        LogAll "INFO: Created bootable ISO image at $MINDI_CACHE/mindi.iso"
     
    15881566    fi
    15891567    echo -en "."
     1568    # Some distro do auto mount at that point (Ubuntu)
    15901569    LogFile "INFO: Unmounting $USBPART just in case"
    15911570    umount $USBPART 2>> $LOGFILE 1>> $LOGFILE
     
    16681647    echo -en "."
    16691648    mkdir -p $MINDI_TMP/usb/images
    1670     cp -f $MINDI_CACHE/*.img $MINDI_CACHE/*.gz $MINDI_TMP/usb/images 2>> $LOGFILE || LogIt "ERROR: OfferToMakeBootableUSB: Cannot copy $i to $MINDI_TMP/usb/images"
     1649    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"
    16711650    echo -en "."
    16721651    LogFile "INFO: mindi_lib = $MINDI_LIB"
     
    18561835
    18571836    retval=0
     1837
    18581838    [ ! -e "$kernelpath" ] && Die "PBDI lilo - cannot find $kernelpath kernel"
    18591839    echo -en "Making "$BOOT_SIZE"KB boot disk..."
     
    18641844    mkdir -p $mountpoint
    18651845    dd if=/dev/zero of=$imagefile bs=1k count=$BOOT_SIZE &> /dev/null || Die "Cannot dd blank file"
     1846    LogFile "Creating vfat filesystem on $imagefile"
    18661847    mkdosfs $imagefile >> $LOGFILE 2>> $LOGFILE
    1867     mount -t vfat -o loop $imagefile $mountpoint || LogIt "ERROR: Cannot mount (PBDI)"
     1848    mount -t vfat -o loop $imagefile $mountpoint || LogAll "ERROR: Cannot mount (PBDI)"
     1849
    18681850    # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
    18691851    mkdir -p $mountpoint/etc
     
    20242006        cd "$old_pwd"
    20252007        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    2026         rmdir $mountpoint || LogIt "ERROR: Cannot rmdir (PBDI)"
     2008        rmdir $mountpoint || LogAll "ERROR: Cannot rmdir (PBDI)"
    20272009
    20282010        LogIt "ERROR: Sorry, your kernel is too big for your image"
     
    20392021    umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    20402022    echo -en "..."
    2041     rmdir $mountpoint || LogIt "ERROR: Cannot rmdir (PBDI)"
     2023    rmdir $mountpoint || LogAll "ERROR: Cannot rmdir (PBDI)"
    20422024
    20432025    if [ "$retval" -eq "0" ] ; then
     
    20452027        if [ "$KERN_DISK_MADE" ] ; then
    20462028            [ "$imagefile" != "" ] && rm -f $imagefile
    2047             LogIt "INFO: $BOOT_SIZE KB boot disks were created OK\n"
     2029            LogAll "INFO: $BOOT_SIZE KB boot disks were created OK\n"
    20482030        fi
    20492031    else
    20502032        echo -en "...failed\n"
    2051         LogIt "WARNING: $BOOT_SIZE""KB boot disk was NOT created\n"
     2033        LogAll "WARNING: $BOOT_SIZE""KB boot disk was NOT created\n"
    20522034        [ "$imagefile" != "" ] && rm -f $imagefile
    20532035    fi
    2054     [ "$retval" -ne "0" ] && LogIt "ERROR: PrepareBootDiskImage() is returning nonzero"
     2036    [ "$retval" -ne "0" ] && LogAll "ERROR: PrepareBootDiskImage() is returning nonzero"
    20552037    return $retval
    20562038}
     
    20882070    includefile=$MINDI_TMP/$$.includefile.txt
    20892071
     2072    lfiles=`ls $DEPLIST_DIR/* | grep -v /minimal`
    20902073    if [ -e "$DEPLIST_FILE" ]; then
    2091         lfiles="$DEPLIST_FILE $DEPLIST_DIR/*"
    2092     else
    2093         lfiles="$DEPLIST_DIR/*"
     2074        lfiles="$DEPLIST_FILE $lfiles"
    20942075    fi
    20952076    lines=`grep -vx " *#.*" $lfiles | grep -vx "" | wc -l`
     
    21292110    DropOptimizedLibraries $needlist $bigdir
    21302111    echo -en "Assembling dependency files"
    2131     CopyDependenciesToDirectory < $needlist $bigdir
     2112
     2113    CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist`
    21322114
    21332115    # also copy io.sys and msdos.sys, if we can find them
     
    21412123    i=`cat $MINDI_TMP/BOOTLOADER.DEVICE 2> /dev/null`
    21422124    if [ "$i" ] ; then
    2143         LogIt "INFO: Backing up $i's MBR"
     2125        LogAll "INFO: Backing up $i's MBR"
    21442126        dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
    21452127        sleep 1
     
    21472129        j=$i
    21482130        [ -h "$j" ] && j=`readlink -f $j`
    2149         LogIt "INFO: Creating /dev/boot_device ($j)"
     2131        LogAll "INFO: Creating /dev/boot_device ($j)"
    21502132        mkdir -p $bigdir/dev
    21512133        cp -pRdf $j $bigdir/dev/boot_device 2>> $LOGFILE || Die "Unable to create /dev/boot_device on ramdisk"
     
    21592141    if [ -d /$ti ]; then
    21602142        mkdir -p $ti
    2161         cp -Rdf /$ti/* $ti 2>> $LOGFILE || LogIt "ERROR: issue copying terminfo"
     2143        cp -Rdf /$ti/* $ti 2>> $LOGFILE || LogAll "ERROR: issue copying terminfo"
    21622144    fi
    21632145    if [ -e "$MONDO_SHARE/restore-scripts" ]; then
     
    21662148    fi
    21672149    if [ -d "/lib/dev-state" ]; then
    2168         tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log
     2150        tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log
    21692151    fi
    21702152    cd "$old_pwd"
     
    22062188    echo -en "Tarring and zipping the data content..."
    22072189    size_of_all_tools=`du -sk $bigdir | cut -f1`
    2208     (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $imagesdir/all.tar.gz || LogIt "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log)
     2190    (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $imagesdir/all.tar.gz || LogAll "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log)
     2191    LogFile "Size of the data content"
     2192    LogFile "------------------------"
    22092193    du -sk $imagesdir/*gz >> $LOGFILE
     2194    LogFile "------------------------"
    22102195    echo -e "$DONE"
    22112196
     
    23082293
    23092294
    2310 StripComments()
    2311 {
    2312     local tempfile
    2313 
    2314     tempfile=$MINDI_TMP/$$.strip.txt
    2315     cp -f $1 $tempfile 2>> $LOGFILE
    2316     $AWK '{if (substr($0,0,1)!="#" || substr($0,0,3)=="#!/") {print $0;};}' $tempfile > $1
    2317     rm -f $tempfile
    2318     LogFile "INFO: Stripped comments from $2"
    2319 }
    2320 
    2321 
    2322 
    23232295StripExecutable()
    23242296{
     
    24072379    fi
    24082380    if [ ! "$possible_kernels" ] ; then
    2409         LogFile "INFO: No kernel matches exactly. Are there any duff kernels?"
     2381        LogAll "INFO: No kernel matches exactly. Are there any duff kernels?"
    24102382        possible_kernels="$duff_kernels"
    24112383        if [ ! "$possible_kernels" ] ; then
    2412             LogFile "INFO: Sorry, no duff kernels either"
     2384            LogAll "INFO: Sorry, no duff kernels either"
    24132385        else
    2414             LogFile "INFO: I bet you're running Debian or Gentoo, aren't you?"
    2415             LogFile "INFO: Your kernel doesn't have a sane builddate. Oh well..."
     2386            LogAll "INFO: I bet you're running Debian or Gentoo, aren't you?"
     2387            LogAll "INFO: Your kernel doesn't have a sane builddate. Oh well..."
    24162388        fi
    24172389    fi
     
    24242396    noof_kernels=`CountItemsIn "$possible_kernels"`
    24252397    if [ "$noof_kernels" -eq "0" ] ; then
    2426         LogFile "Could not find your kernel."
     2398        LogAll "Could not find your kernel."
    24272399        if [ -e "/boot/vmlinuz" ] ; then
    2428             LogFile "INFO: Using /boot/vmlinuz as a last resort."
     2400            LogAll "INFO: Using /boot/vmlinuz as a last resort."
    24292401            output=/boot/vmlinuz
    24302402        else
     
    24382410        for i in $possible_kernels ; do
    24392411            if [ "`echo $i | grep "$KERVERRUN"`" ]; then
    2440                 LogFile "INFO: OK, I used my initiative and found that "
    2441                 LogFile "INFO: $i is probably your kernel. "
     2412                LogAll "INFO: OK, I used my initiative and found that "
     2413                LogAll "INFO: $i is probably your kernel. "
    24422414                output="$i"
    24432415                break
     
    28922864LogFile "-----------------------------"
    28932865
    2894 [ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && ln -sf /sbin/mkdosfs /sbin/mkfs.vfat
     2866[ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && LogAll "/sbin/mkfs.vfat is missing!"
    28952867
    28962868# Log some capital variables
    28972869[ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     2870[ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
    28982871LogFile "MONDO_SHARE = $MONDO_SHARE"
    28992872LogFile "MINDI_LIB = $MINDI_LIB"
    29002873LogFile "MINDI_SBIN = $MINDI_SBIN"
    2901 [ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
    29022874LogFile "MINDI_CONF = $MINDI_CONF"
    29032875if [ -f $MINDI_CONFIG ]; then
     
    29532925fi
    29542926
    2955 ### BERLIOS
     2927### TODO
    29562928### Fix as it's not mandatory on ia64
    29572929if [ "$ARCH" = "ia64" ] ; then
     
    29812953    LVM="false"
    29822954fi
     2955
     2956if [ -e "/proc/cmdline" ]; then
     2957    CMDLINE="/proc/cmdline"
     2958elif [ -e "/tmp/cmdline" ]; then
     2959    CMDLINE="/tmp/cmdline"
     2960else
     2961    CMDLINE="/dev/null"
     2962fi
     2963
    29832964LogFile "INFO: LVM set to $LVM"
    29842965LogFile "----------"
     
    30002981    cat /etc/mdadm.conf >> $LOGFILE
    30012982else
     2983    LogFile "-------------"
    30022984    LogFile "No file /etc/mdadm.conf"
    30032985fi
    30042986LogFile "-------------"
    3005 LogFile "cat /proc/cmdline:"
     2987LogFile "cat $CMDLINE"
    30062988LogFile "-------------"
    3007 cat /proc/cmdline >> $LOGFILE
     2989cat $CMDLINE >> $LOGFILE
    30082990LogFile "-------------"
    30092991LogFile "cat /proc/swaps:"
     
    30403022    MODULES="$MODULES `/usr/sbin/esxcfg-module -l | $AWK '{print $1}'`"
    30413023fi
     3024LogFile "Liste of extra modules is:"
     3025LogFile "-------------"
     3026LogFile "$EXTRA_MODS"
     3027LogFile "-------------"
    30423028LogFile "FORCE_MODS:"
    30433029LogFile "-------------"
     
    32183204###
    32193205        if [ $KERNEL_IS_XEN = "yes" ]; then
    3220             LogIt "INFO: xenkernelpath = $xenkernelpath"
     3206            LogAll "INFO: xenkernelpath = $xenkernelpath"
    32213207        fi
    32223208        kernelname=`echo $kernelpath | cut -d'-' -f2- | sed 's/.[bg]z[2]*$//'`
    32233209        if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ]
    32243210        then
    3225            LogIt "WARNING: Module path for ${kernelpath} not found..."
    3226            LogIt "         using running kernel\'s modules."
     3211           LogAll "WARNING: Module path for ${kernelpath} not found..."
     3212           LogAll "         using running kernel\'s modules."
    32273213           kernelname=$KERVERRUN
    3228         fi
    3229         LogIt "INFO: kernelname = $kernelname"
    3230         LogIt "INFO: kernelpath = $kernelpath"
     3214        else
     3215           LogAll "Using modules for kernel: ${kernelname}"
     3216        fi
     3217        LogAll "INFO: kernelname = $kernelname"
     3218        LogAll "INFO: kernelpath = $kernelpath"
    32313219###
    32323220### end of Sq-Modification
     
    32443232        if [ "${11}" ] ; then
    32453233            LILO_OPTIONS=""
    3246     #       LogIt "INFO: LILO will use conservative settings, to be compatible with older BIOSes."
     3234    #       LogAll "INFO: LILO will use conservative settings, to be compatible with older BIOSes."
    32473235        fi
    32483236        LAST_FILELIST_NUMBER=${12}
     
    32683256        fi
    32693257    else
    3270         echo "Syntax: mindi (--custom ....)" >> /dev/stderr
     3258        LogScreen "Syntax: mindi (--custom ....)"
    32713259        MindiExit -1
    32723260    fi
     
    34003388        OfferToMakeBootableUSB
    34013389    fi
     3390    LogAll "Finished."
    34023391elif [ "$TAPEDEV" ] ; then
    34033392    if [ "$ARCH" != "ia64" ] ; then
     
    34223411fi
    34233412# cleanup
    3424 LogIt "INFO: $FRIENDLY_OUTSTRING"
     3413LogAll "INFO: $FRIENDLY_OUTSTRING"
    34253414for mtpt in $FLOPPY_WAS_MOUNTED ; do
    34263415    mount $mtpt
Note: See TracChangeset for help on using the changeset viewer.