Changeset 932 in MondoRescue for trunk/mindi/mindi


Ignore:
Timestamp:
Nov 15, 2006, 12:40:15 PM (17 years ago)
Author:
Bruno Cornec
Message:

merge -r913:931 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mindi/mindi

    r929 r932  
    1414
    1515### Which arch are we on (useful for ia64 port)
    16 export ARCH=`/bin/arch`
    17 
    18 RUN_AFTER_INITIAL_BOOT_PHASE="echo \"Who lives in a pineapple under the sea?\" > /tmp/spongebob.squarepants.txt"
     16ARCH=`/bin/arch`
     17
     18#RUN_AFTER_INITIAL_BOOT_PHASE="echo \"Who lives in a pineapple under the sea?\" > /tmp/spongebob.squarepants.txt"
    1919    # after booting from floppy/CD image but before
    2020    # accessing auxiliary data disks (or the rest of
     
    106106
    107107BOOT_MEDIA_MESSAGE="$mindi_boot_msg"
    108 
     108FDISK=$MINDI_SBIN/parted2fdisk
     109FDISKLOG=$MONDOTMP/parted2fdisk.log
     110touch $FDISKLOG
     111
     112# Using a config file allow to overwrite some values
     113MINDI_CONFIG="$MINDI_CONF/mindi.conf"
     114if [ -f $MINDI_CONFIG ]; then
     115    . $MINDI_CONFIG
     116fi
     117
     118# Now we can create what we nedd
     119MONDOTMP=`mktemp -d $TMPDIR/mondobuild.XXXXXXXXXX`
     120mkdir -p $MONDOTMP
     121mkdir -p $CACHE_LOC
    109122# ----------------------------------------------------------------------------
    110123
     
    114127    Die "Program is terminating in response to signal received from OS/user"
    115128}
    116 
    117129
    118130
     
    129141    done
    130142    if [ -e "$MINDI_LIB/memtest.img" ] ; then
    131 #        echo -en "label memtest\n  kernel memtest.bin\n\n"
    132143        echo -en "label memtest\n  kernel memdisk\n  append initrd=memtest.img\n\n"
    133 #        echo "Yep, this is a multi-function CD" > $2/MULTIFUNC
    134     fi
    135 }
    136 
     144    fi
     145}
    137146
    138147
     
    143152    which gawk > /dev/null 2> /dev/null && AWK=`which gawk 2>/dev/null` || AWK="`which awk 2>/dev/null`"
    144153    if which awk &> /dev/null ; then
    145     if ! which gawk &> /dev/null ; then
    146         LogIt "You have awk but not gawk.\nPlease note that mindi works fine with a _sane_ awk binary.\nIf your awk binary misbehaves then please contact your vendor\nor distribution's mailing list for technical support.\n"
    147     fi
     154        if ! which gawk &> /dev/null ; then
     155            LogIt "You have awk but not gawk.\nPlease note that mindi works fine with a _sane_ awk binary.\nIf your awk binary misbehaves then please contact your vendor\nor distribution's mailing list for technical support.\n"
     156        fi
    148157    fi
    149158    which mke2fs > /dev/null 2> /dev/null || Die "Please put mke2fs in system path"
    150     which afio > /dev/null 2> /dev/null || LogIt "afio not found... mindi doesn't need afio but Mondo does... Be aware...\n"
    151     [ ! -e "/etc/issue.net" ] && > /etc/issue.net
    152     FDISK=$MINDI_SBIN/parted2fdisk
    153     FDISKLOG=/tmp/parted2fdisk.log
    154     touch $FDISKLOG
    155159    [ ! -e "$FDISK" ] && Die "Cannot find (s)fdisk"
    156160}
    157 
    158161
    159162
     
    167170
    168171
    169 
    170 
    171 
    172172Aborted() {
    173173    trap SIGHUP SIGTERM SIGTRAP SIGINT
    174     rm -f $CACHEDIR/mindi*img $CACHEDIR/*gz $CACHEDIR/mindi.iso
     174    [ "$CACHE_LOC" != "" ] && rm -f $CACHE_LOC/mindi*img $CACHE_LOC/*gz $CACHE_LOC/mindi.iso
    175175    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/*
    176176    Die "User abort."
     
    181181    [ -e "$1" ] && echo -en "$2 `cat $1`\n" >> $3
    182182}
    183 
    184183
    185184
     
    190189    noof_disks=$3
    191190
    192 #    diskno=1
    193191    diskno=$noof_disks
    194192    mkdir -p $minidir_root/$diskno
    195193    [ "$LAST_COMPRESSED_SIZE" = "" ] && LAST_COMPRESSED_SIZE=0
    196194    if [ ! -e "$filename" ] ; then
    197     if [ -h "$filename" ] ; then
    198         cp --parents -pRdf $filename $minidir_root/$diskno
    199         return $noof_disks
    200     else
    201         Die "AddFileToDir asked me to add $filename, which does not exist. Oops! Did you run out of disk space or is your Linux distro severely broken?"
    202     fi
    203     fi
    204 # move to the disk that has room on it (or end up using the last, if all full)
     195        if [ -h "$filename" ] ; then
     196            cp --parents -pRdf $filename $minidir_root/$diskno
     197            return $noof_disks
     198        else
     199            Die "AddFileToDir asked me to add $filename, which does not exist. Oops! Did you run out of disk space or is your Linux distro severely broken?"
     200        fi
     201    fi
     202
     203    # move to the disk that has room on it (or end up using the last, if all full)
    205204    while [ "$diskno" -lt "40" ] ; do
    206     mkdir -p $minidir_root/$diskno
     205        mkdir -p $minidir_root/$diskno
    207206        filesize=`du -sk $filename | cut -f1`
    208     cp --parents -Rdf $filename $minidir_root/$diskno
     207        cp --parents -Rdf $filename $minidir_root/$diskno
    209208        if [ "$filesize" -le "4" ] ; then
    210209            siz=$filesize
     
    216215            siz=$(($siz-2));# to allow for sectors & the fact that they round up
    217216        fi
    218     [ ! "$siz" ] && siz=4
    219     [ "$siz" -lt "0" ] && siz=0
     217        [ ! "$siz" ] && siz=4
     218        [ "$siz" -lt "0" ] && siz=0
    220219        LAST_COMPRESSED_SIZE=$(($LAST_COMPRESSED_SIZE+$siz))
    221     [ "$LAST_COMPRESSED_SIZE" -le "$MAX_COMPRESSED_SIZE" ] &&return $diskno
    222     echo "disk=$diskno siz=$LAST_COMPRESSED_SIZE" >> $LOGFILE
    223     LAST_COMPRESSED_SIZE=0
    224     rm -f $minidir_root/$diskno/$filename
     220        [ "$LAST_COMPRESSED_SIZE" -le "$MAX_COMPRESSED_SIZE" ] &&return $diskno
     221        echo "disk=$diskno siz=$LAST_COMPRESSED_SIZE" >> $LOGFILE
     222        LAST_COMPRESSED_SIZE=0
     223        rm -f $minidir_root/$diskno/$filename
    225224        diskno=$(($diskno+1))
    226225    done
    227226    return 0 ; # failed
    228227}
    229 
    230 
    231228
    232229
     
    262259    fi
    263260    for included_item in $included_list ; do
    264     if [ ! -e "$included_item" ] ; then
     261        if [ ! -e "$included_item" ] ; then
    265262            sss=`find $KEYDIR/keymaps | grep -F "${included_item}.inc"`
    266         [ "$sss" = "" ] && sss=`find $KEYDIR/keymaps | grep -F "$included_item"`
    267         for ii in $sss ; do
     263            [ "$sss" = "" ] && sss=`find $KEYDIR/keymaps | grep -F "$included_item"`
     264            for ii in $sss ; do
    268265                [ -e "$ii" ] && AddKeyboardMappingFile $ii
    269         done
    270     else
    271         AddKeyboardMappingFile $included_item
    272     fi
    273     done
    274 }
    275 
    276 
    277 
    278 
    279 
     266            done
     267        else
     268            AddKeyboardMappingFile $included_item
     269        fi
     270    done
     271}
    280272
    281273
     
    291283
    292284    sliceno=0
    293     scratchfile=$TMP_ROOT/blah.$$.dat
     285    scratchfile=$MONDOTMP/blah.$$.dat
    294286    cp -f $filename $scratchfile || Die "CUACF -- cannot copy $filename to $scratchfile - did you run out of disk space?"
    295287    [ "`head $scratchfile -n1 | grep -F "bin/sh"`" != "" ] && StripComments $scratchfile "-$filename-"
    296288    [ "`echo "$filename" | grep -F "etc/termcap"`" != "" ] && StripComments $scratchfile "-$filename-"
    297289    if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] ; then
    298     mv $scratchfile $scratchfile.gz
    299     gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz\n"
    300     filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'`
     290        mv $scratchfile $scratchfile.gz
     291        gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz\n"
     292        filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'`
    301293    fi
    302294    filesize=`du -sk $scratchfile | cut -f1`
     
    339331
    340332
    341 
    342 
    343333CopyDependenciesToDirectory() {
    344334    local outdir incoming fname filesize counter
     
    348338    counter=0
    349339    while [ "$incoming" != "" ] ; do
    350     if [ -d "$incoming" ] ; then
     340        if [ -d "$incoming" ] ; then
    351341            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir
    352342        elif [ -e "$incoming" ] ; then
     
    357347            else
    358348                cp --parents -Rdf $incoming $outdir || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
    359         if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then
    360             gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming\n"
    361         fi
    362         [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
    363             fi
    364         counter=$(($counter+1))
    365         if [ "$counter" -ge "5" ] ; then
    366         counter=0
    367             echo -en "."
    368         fi
     349                if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then
     350                    gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming\n"
     351                fi
     352                [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
     353            fi
     354            counter=$(($counter+1))
     355            if [ "$counter" -ge "5" ] ; then
     356                counter=0
     357                echo -en "."
     358            fi
    369359        fi
    370360        incoming=`ReadLine`
    371361    done
    372362}
    373 
    374363
    375364
     
    383372    echo -en "Formatting disk..."
    384373    if which fdformat > /dev/null ; then
    385     fdformat -n $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
     374        fdformat -n $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
    386375    elif which superformat > /dev/null ; then
    387     superformat $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
    388     else
    389     Die "Please install either fdformat or superformat."
     376        superformat $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
     377    else
     378        Die "Please install either fdformat or superformat."
    390379    fi
    391380    echo -en "\rWriting $comment"
    392381    if echo $image | grep "mindi-[r|b]oot\.1440" &> /dev/null ; then
    393     cat $image > $dev &
    394     else
    395     dd if=$image of=$dev &> /dev/null &
     382        cat $image > $dev &
     383    else
     384        dd if=$image of=$dev &> /dev/null &
    396385    fi
    397386    procno=$!
     
    407396
    408397
    409 
    410 
    411 
    412398CountItemsIn() {
    413399    local r
     
    420406
    421407
    422 
    423 
    424 
    425 
    426408CreateDataDiskImagesFromTarballs() {
    427409    local tardir outdir diskno noof_disks kp
     
    434416    echo -en "Creating data disk "
    435417    while [ "$diskno" -le "$noof_disks" ] ; do
    436     echo -en "#$diskno..."
    437     cp -f $tardir/$diskno.tar.gz $outdir || LogIt "[line 424] Cannot copy $tardir/$diskno.tar.gz to $outdir\n"
     418        echo -en "#$diskno..."
     419        cp -f $tardir/$diskno.tar.gz $outdir || LogIt "[line 424] Cannot copy $tardir/$diskno.tar.gz to $outdir\n"
    438420        CreateOneDataDiskImage $tardir/$diskno.tar.gz $outdir/mindi-data-$diskno.img $diskno $noof_disks
    439421        diskno=$(($diskno+1))
     
    453435    noof_disks=$4
    454436
    455     mountpoint=$TMP_ROOT/mountpoint.$$
     437    mountpoint=$MONDOTMP/mountpoint.$$
    456438    mkdir -p $mountpoint
    457439    dd if=/dev/zero of=$imagefile bs=1k count=1440 &> /dev/null || LogIt "Cannot dd (CODI)\n"
    458     mke2fs -N 12 -F $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$
    459     [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$
    460     rm -f /tmp/mke2fs.$$
     440    mke2fs -N 12 -F $imagefile > $MONDOTMP/mke2fs.$$ 2>> $MONDOTMP/mke2fs.$$
     441    [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.$$
     442    rm -f $MONDOTMP/mke2fs.$$
    461443    mount -t ext2 -o loop $imagefile $mountpoint || Die "Can't loopmount $imagefile to $mountpoint! The reason may be missing support for loopfs or ext2 (or both) in the running kernel."
    462444    mv $tarball $mountpoint/
    463445    if [ "$?" -ne "0" ] ; then
    464     umount $mountpoint
    465     Die "Tarball $tarball is too big for disk! (CODI)\nTell Dev Team to adjust MAX_COMPRESSED_SIZE"
     446        umount $mountpoint
     447        Die "Tarball $tarball is too big for disk! (CODI)\nTell Dev Team to adjust MAX_COMPRESSED_SIZE"
    466448    fi
    467449    [ "$diskno" -eq "$noof_disks" ] && echo "This is the last disk ($diskno=$noof_disks)" >> $mountpoint/LAST-DISK
     
    469451    rmdir $mountpoint || LogIt "Cannot rmdir (CODI)\n"
    470452}
    471 
    472453
    473454
     
    481462}
    482463
    483 
    484 
     464# Last function called before exiting
     465# Parameter is exit code value
     466MindiExit() {
     467    local my_partitions
     468
     469    echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE
     470    echo "End date : `date`" >> $LOGFILE
     471
     472    sync
     473    cd /
     474
     475    # Unmount whtat could remain mounted
     476    my_partitions=`mount | grep -F $$ | cut -f1 -d' '`
     477    [ "$my_partitions" != "" ] && umount $my_partitions
     478    # Clean temporary files
     479    rm -Rf $MONDOTMP $FDISKLOG
     480    exit $1
     481}
    485482
    486483Die() {
    487     local my_partitions i
    488     echo "MINDI_VERSION is $MINDI_VERSION" >> $LOGFILE
    489     echo "End date : `date`" >> $LOGFILE
     484    local i
    490485    if [ "$1" = "" ] ; then
    491486        LogIt "Fatal error\n"
     
    493488        LogIt "Fatal error. $1\n"
    494489    fi
    495     sync
    496     cd /
    497 
    498     my_partitions=`mount | grep -F $$ | cut -f1 -d' '`
    499     [ "$my_partitions" != "" ] && umount $my_partitions
    500     # BCO : Too Dangerous !!!
    501     #[ "$TMP_ROOT" != "/tmp" ] && rm -Rf $TMP_ROOT
    502     cd /tmp
    503     mkdir -p mindi.err
    504     for i in /etc/fstab /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log /tmp/mountlist.txt.$$ $FDISKLOG ; do
    505         [ -e "$i" ] && cp -f $i mindi.err/
    506     done
    507     rm -f mindi.err.*.tgz
    508     tar -cf - mindi.err | gzip -9 > mindi.err.$$.tgz
    509     rm -Rf mindi.err /tmp/mountlist.txt.$$ mindilinux $FDISKLOG
    510     LogIt "Please e-mail a copy of /tmp/mindi.err.$$.tgz to the mailing list.\n"
     490
     491    # Creates a tar file containing all required files
     492    for i in /etc/fstab /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log $FDISKLOG ; do
     493        [ -e "$i" ] && cp -f $i $MONDOTMP
     494    done
     495    rm -f $TMPDIR/mindi.err.*.tgz
     496    tar -cf - $MONDOTMP | gzip -9 > $TMPDIR/mindi.err.$$.tgz
     497    LogIt "Please e-mail a copy of $TMPDIR/mindi.err.$$.tgz to the mailing list.\n"
    511498    LogIt "See http://www.mondorescue.org for more information.\n"
    512499    LogIt "WE CANNOT HELP unless you enclose that file.\n"
    513     exit 1
    514 }
    515 
    516 
     500    MindiExit -1
     501}
    517502
    518503
     
    545530        mv -f $filelist.tmp $filelist
    546531    done
    547     sort $filelist | $AWK '{ print $1; }' | uniq > $filelist.tmp
     532    $AWK '{ print $1; }' $filelist | sort -u > $filelist.tmp
    548533    mv -f $filelist.tmp $filelist
    549534    echo -e "$DONE"
    550535}
    551 
    552 
    553536
    554537
     
    631614
    632615
    633 
    634 
    635 
    636616FindHomeOfMindiAndMondo() {
    637617    [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     
    641621    echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    642622    echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
    643     mkdir -p $CACHEDIR
    644 }
    645 
    646 
    647 
     623}
    648624
    649625
     
    659635
    660636
    661 
    662637FindLiloBinary() {
    663638    if which lilo &> /dev/null ; then
    664     if which lilo.real > /dev/null 2> /dev/null ; then
    665         LILO_EXE=lilo.real
    666         LogIt "lilo.real found; will be used instead of lilo (*grumble* *mutter*)\n"
    667     else
    668         LILO_EXE=lilo
    669     fi
    670     $LILO_EXE -V | grep -F "21.6" > /dev/null && Die "Please upgrade LILO. Your verison has a serious bug. If you're not _using_ LILO, fine, uninstall it. :)"
    671     else
    672     LILO_EXE=`which false`
    673     fi
    674 }
     639        if which lilo.real > /dev/null 2> /dev/null ; then
     640            LILO_EXE=lilo.real
     641            LogIt "lilo.real found; will be used instead of lilo (*grumble* *mutter*)\n"
     642        else
     643            LILO_EXE=lilo
     644        fi
     645        $LILO_EXE -V | grep -F "21.6" > /dev/null && Die "Please upgrade LILO. Your version has a serious bug. If you're not _using_ LILO, fine, uninstall it. :)"
     646    else
     647        LILO_EXE=`which false`
     648    fi
     649}
     650
    675651
    676652FindELiloBinary() {
    677653    if which elilo &> /dev/null ; then
    678     LILO_EXE=elilo
    679     else
    680     LILO_EXE=`which false`
     654        LILO_EXE=elilo
     655    else
     656        LILO_EXE=`which false`
    681657    fi
    682658}
     
    684660
    685661FixPathIfBroken() {
    686         if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then
     662    if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then
    687663        PATH=$PATH:/sbin:/usr/sbin
    688664        export PATH
     
    692668    fi
    693669}
    694 
    695670
    696671
     
    702677    if [ "`strings $i 2> /dev/null | head -n1`" = "LILO" ] ; then
    703678        out="$out $i"
    704             last="$i"
     679        last="$i"
    705680    fi
    706681    done
    707682    echo "$last"
    708683}
    709 
    710684
    711685
     
    714688    pwd=`pwd`
    715689    if [ "$YOUR_KERNEL_SUCKS" ] ; then
    716         cd $TMP_ROOT
     690        cd $MONDOTMP
    717691    else
    718692        cd /
     
    732706
    733707
    734 
    735708GenerateGiantDependencyList() {
    736709    local incoming loc fname list_of_files i tempfile outfile progress filelist res r mapfile mappath included_list included_item old_pwd tempdepfile modres noof_lines lvmversion lvmresolved
     
    738711    echo -en "Analyzing dependency requirements"
    739712    outfile=$1
    740     tempfile=$TMP_ROOT/$$.txt
     713    tempfile=$MONDOTMP/$$.txt
    741714    incoming=`ReadLine`
    742715
     
    747720    while [ "$incoming" != "" ] ; do
    748721        if echo "$incoming" | grep -x " *#.*" &> /dev/null ; then
    749 #           echo "Skipping '$incoming'"
    750722            incoming=`ReadLine`
    751723            continue
     
    754726            break
    755727        fi
    756 #       echo "Processing '$incoming'."
    757 #       sleep 1
    758728        filelist=`GenerateListForFile "$incoming"`
    759729        r=$?
     
    846816    noof_lines=`cat $tempfile | wc -l`
    847817    for fname in `cat $tempfile` ; do
    848         tempdepfile=`mktemp /tmp/mindilinux/tempdepfile.XXXXXX`
    849         LocateDeps $fname > $tempdepfile
    850     echo "$fname" >> $outfile.pre
    851         cat $tempdepfile >> $outfile.pre
    852         rm -f $tempdepfile
    853     progress=$(($progress+1))
     818        echo "$fname" >> $outfile.pre
     819        LocateDeps $fname >> $outfile.pre
     820        progress=$(($progress+1))
    854821        echo -en "\r\t\t\t\t\t\t\t\t"
    855822        i=$(($progress*100))
     
    857824        echo -en "$i"
    858825        echo -en "%"
    859     modres=$(($progress%4))
     826        modres=$(($progress%4))
    860827        [ "$modres" -eq "0" ] && echo -en "\t/"
    861828        [ "$modres" -eq "1" ] && echo -en "\t-"
     
    864831    done
    865832    if [ "`DidMondoCallMe`" ] ; then
    866     mkdir -p $bigdir/tmp
    867     mkdir -p $bigdir/sbin
    868     mkdir -p $bigdir/bin
    869     if [ -e "$MONDO_TMP/post-nuke.tgz" ] ; then
    870         LogIt "\nIncorporating post-nuke tarball\n"
    871         old_pwd=`pwd`
    872         cd $bigdir
    873         tar -zxf $MONDO_TMP/post-nuke.tgz || LogIt "Error occurred when untarring post-nuke tarball\n"
    874         cd $old_pwd
    875     fi
    876     if cp -f $MONDO_TMP/mondo*restore $bigdir/usr/bin ; then
    877             LocateDeps $bigdir/usr/bin/mondo*restore >> $outfile.pre
    878     else
    879         LogIt "Cannot find mondo*restore in mondo's tempdir, $MONDO_TMP\n"
    880         LogIt "I bet you've got a spare copy of Mondo or Mindi floating around on your system.\n"
    881             LogIt "If Mindi was called by Mondo then send me a bug report.\n It not, type 'ps ax' to see which Mondo-related process is still running;\n then kill it. :-)\n Finally, run Mindi again."
    882             Die "Odd."
    883         fi
    884         cp -f $MONDO_TMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW.\n"
    885     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
    886         LogIt "Incorporating NFS-related settings\n"
    887         for r in NFS-* ISO-PREFIX ; do
    888             cp -f $MONDO_TMP/$r $bigdir/tmp || Die "Cannot copy $r - did you run out of disk space?"
    889             echo "Copying $r to ramdisk" >> $LOGFILE
    890         done
    891     fi
    892     fi
    893      tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile
     833        mkdir -p $bigdir/tmp
     834        mkdir -p $bigdir/sbin
     835        mkdir -p $bigdir/bin
     836        if [ -e "$MONDOTMP/post-nuke.tgz" ] ; then
     837            LogIt "\nIncorporating post-nuke tarball\n"
     838            old_pwd=`pwd`
     839            cd $bigdir
     840            tar -zxf $MONDOTMP/post-nuke.tgz || LogIt "Error occurred when untarring post-nuke tarball\n"
     841            cd $old_pwd
     842        fi
     843        if cp -f $MONDOTMP/mondo*restore $bigdir/usr/bin ; then
     844            LocateDeps $bigdir/usr/bin/mondo*restore >> $outfile.pre
     845        else
     846            LogIt "Cannot find mondo*restore in mondo's tempdir, $MONDOTMP\n"
     847            LogIt "I bet you've got a spare copy of Mondo or Mindi floating around on your system.\n"
     848            LogIt "If Mindi was called by Mondo then send me a bug report.\n It not, type 'ps ax' to see which Mondo-related process is still running;\n then kill it. :-)\n Finally, run Mindi again."
     849            Die "Odd."
     850        fi
     851        cp -f $MONDOTMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW.\n"
     852        if [ -e "$MONDOTMP/NFS-DEV" ] ; then
     853            LogIt "Incorporating NFS-related settings\n"
     854            for r in NFS-* ISO-PREFIX ; do
     855                cp -f $MONDOTMP/$r $bigdir/tmp || Die "Cannot copy $r - did you run out of disk space?"
     856                echo "Copying $r to ramdisk" >> $LOGFILE
     857            done
     858        fi
     859    fi
     860    tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile
    894861    rm -f $tempfile $outfile.pre
    895862    [ "$res" -eq "0" ] && echo -e "\r\t\t\t\t\t\t\t\t$DONE" || echo "\nFailed."
    896863    return $res
    897864}
    898 
    899 
    900 
    901865
    902866
     
    915879
    916880
    917 
    918881# Returns all disk devices which are part of a raid array
    919 
    920882GetAllRaidMembers() {
    921883    $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*device/ if(\$2) {print \$2}" < /etc/raidtab
     
    929891    done
    930892}
    931 
    932893
    933894
     
    940901
    941902
    942 
    943 
    944 
    945903# Searches parent raid device of given disk device
    946904# $1: disk device (i.e. /dev/hda1)
    947 
    948905GetParentRaidDev() {
    949906    $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {dev=\$2} /^[[:space:]]*device/ {if(\$2==\"$1\") {print dev; exit}}" < /etc/raidtab
     
    951908
    952909
    953 
    954910# Searches members of raid device
    955911# $1: raid device (/dev/md...)
    956 
    957912GetRaidDevMembers() {
    958913    $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {if(dev) exit; if(\$2 == \"$1\") dev=\$2} /^[[:space:]]*device/ {if(dev) {print \$2}}" < /etc/raidtab
    959914}
    960 
    961 
    962 HackAwk() {
    963     local pathname filename dir old_pwd new_fname
    964     pathname=$1
    965     filename=$2
    966     dir=`echo "$pathname" | sed s/$filename//`
    967     old_pwd=`pwd`
    968     cd $dir
    969     [ -f "$filename" ] || Die "Can't find $filename at $dir"
    970     new_fname="an.icky.icky.spider.ewww"
    971     [ "$filename" = "gawk" ] && new_fname="awk"
    972     [ "$filename" = "awk" ] && new_fname="gawk"
    973     ln -s $filename $new_fname
    974     cd $old_pwd
    975 }
    976 
    977 
    978 
    979 
    980 HackMountlist() {
    981     local scratchdir outfile partlist pst partstr \
    982 res partition swapsize
    983     scratchdir=$TMP_ROOT
    984     outfile=$1
    985 
    986     mkdir -p $outfile
    987     rm -Rf $outfile
    988     > $outfile
    989     partlist=$(mount | cut -d' ' -f1,3,5 \
    990     | grep -Ev "((none|/tmp|/ISOs|/proc|/dev/root) )|/mnt/" \
    991     | tr ' ' '|')
    992 
    993     echo -n "Modifying mountlist..."
    994 
    995     if [ ! -f "/mountlist.hacked" ] ; then
    996         Die "Can't find modified mountlist.hacked!"
    997     else
    998         cp /mountlist.hacked "$outfile"
    999         LogIt "Done. (Created by auto-archive, I assume?)\n"
    1000     fi
    1001 }
    1002 
    1003 
    1004915
    1005916
     
    1009920    incoming=`ReadLine`
    1010921    pwd=`pwd`
    1011     cd $TMP_ROOT
     922    cd $MONDOTMP
    1012923    while [ "$incoming" != "" ] ; do
    1013     stub=`basename $incoming`
    1014     newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`
    1015     for i in $newpath ; do
    1016         echo "$i"
    1017     done
    1018     read incoming
     924        stub=`basename $incoming`
     925        newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`
     926        for i in $newpath ; do
     927            echo "$i"
     928        done
     929        read incoming
    1019930    done
    1020931    cd $pwd
    1021932}
    1022 
    1023933
    1024934
     
    1027937
    1028938    grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
    1029 #    for partition in `$FDISK -l | tr -s ' ' '\n' | grep /dev` ; do
    1030 #        [ -e "$i" ] && all_partitions=echo "$i"
    1031 #    done
    1032939    [ -e "/etc/raidtab" ] && $AWK '/^ *device/ {print $2}' /etc/raidtab
    1033940    return
    1034941}
    1035 
    1036 
    1037 
    1038942
    1039943
     
    1047951    echo " "
    1048952}
    1049 
    1050953
    1051954
     
    1076979    [ -f "$oss" ] && find $oss.* 2> /dev/null
    1077980}
    1078 
    1079 
    1080 #ListKernelModules() {
    1081     #local output q
    1082     #output=""
    1083     #for q in `lsmod | sed -n '2,$s/ .*//p'` ; do
    1084         #output="$q $output"
    1085     #done
    1086     #echo "`lsmod | sed -n '2,$s/ .*//p'`"
    1087 #}
    1088 
    1089981
    1090982
     
    11121004}
    11131005
     1006
    11141007# Give all symlinks recursively of a full path name
    11151008ReadAllLink() {
     
    11331026    fi 
    11341027}
     1028
    11351029
    11361030LocateFile() {
     
    11651059
    11661060
    1167 
    11681061LogIt() {
    11691062    if [ -e /dev/stderr ] ; then
    1170     echo -e "$1" >> /dev/stderr
     1063        echo -e "$1" >> /dev/stderr
    11711064    elif [ -e /usr/bin/logger ] ; then
    1172     /usr/bin/logger -s $1
     1065        /usr/bin/logger -s $1
    11731066    fi
    11741067    echo -en "$1" >> $LOGFILE
     
    11761069
    11771070
    1178 
    1179 
    1180 
    1181 
    1182 
    11831071# Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg
    1184 
    11851072MakeMondoConfigFile() {
    11861073    local outfile use_lzo use_comp use_star
     
    12001087    echo "datestamp `date`" >> $outfile
    12011088    [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile
    1202    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
    1203    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
    1204    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
    1205    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
    1206    AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
    1207    AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-PATH   nfs-server-path   $outfile
    1208    AddFileToCfgIfExists $MONDO_TMP/NFS-DEV           nfs-dev           $outfile
    1209    AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
    1210    AddFileToCfgIfExists $MONDO_TMP/ISO-DEV           iso-dev           $outfile
    1211    AddFileToCfgIfExists $MONDO_TMP/ISO-MNT           iso-mnt           $outfile
    1212    AddFileToCfgIfExists $MONDO_TMP/ISO-PREFIX        iso-prefix        $outfile
    1213    AddFileToCfgIfExists $MONDO_TMP/ISODIR            isodir            $outfile
    1214    AddFileToCfgIfExists $MONDO_TMP/BOOTLOADER.DEVICE bootloader.device $outfile
    1215    AddFileToCfgIfExists $MONDO_TMP/BOOTLOADER.NAME   bootloader.name   $outfile
    1216    AddFileToCfgIfExists $MONDO_TMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile
    1217    AddFileToCfgIfExists $MONDO_TMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile
    1218    AddFileToCfgIfExists $MONDO_TMP/BACKUP-MEDIA-TYPE backup-media-type $outfile
    1219    AddFileToCfgIfExists $MONDO_TMP/DIFFERENTIAL      differential      $outfile
    1220 }
    1221 
    1222 
     1089    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
     1090    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
     1091    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
     1092    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
     1093    AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
     1094    AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-PATH   nfs-server-path   $outfile
     1095    AddFileToCfgIfExists $MONDOTMP/NFS-DEV           nfs-dev           $outfile
     1096    AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
     1097    AddFileToCfgIfExists $MONDOTMP/ISO-DEV           iso-dev           $outfile
     1098    AddFileToCfgIfExists $MONDOTMP/ISO-MNT           iso-mnt           $outfile
     1099    AddFileToCfgIfExists $MONDOTMP/ISO-PREFIX        iso-prefix        $outfile
     1100    AddFileToCfgIfExists $MONDOTMP/ISODIR            isodir            $outfile
     1101    AddFileToCfgIfExists $MONDOTMP/BOOTLOADER.DEVICE bootloader.device $outfile
     1102    AddFileToCfgIfExists $MONDOTMP/BOOTLOADER.NAME   bootloader.name   $outfile
     1103    AddFileToCfgIfExists $MONDOTMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile
     1104    AddFileToCfgIfExists $MONDOTMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile
     1105    AddFileToCfgIfExists $MONDOTMP/BACKUP-MEDIA-TYPE backup-media-type $outfile
     1106    AddFileToCfgIfExists $MONDOTMP/DIFFERENTIAL      differential      $outfile
     1107}
    12231108
    12241109
     
    12321117    if [ "$YOUR_KERNEL_SUCKS" ] ; then
    12331118        kver=$FAILSAFE_KVER
    1234         cd $TMP_ROOT
     1119        cd $MONDOTMP
    12351120        searchpath=lib/modules/$kver
    12361121    else
     
    12411126        if [ "${kernelname}" != "" ]
    12421127        then
    1243           kver=${kernelname}
     1128            kver=${kernelname}
    12441129        else
    1245           kver=`uname -r`
     1130            kver=`uname -r`
    12461131        fi
    12471132###
     
    12531138    echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile
    12541139    list_to_echo="`lsmod | sed -n '2,$s/ .*//p'`"
    1255 #    LTE=`echo "$list_to_echo" | tr ' ' '\n' | grep -n "" | cut -d':' -f2,3,4 | tr '\n' ' '`
    1256 #    lte_old="$LTE"
    1257 #    LTE=""
    1258 #    for q in $lte_old ; do
    1259 #   LTE="$q $LTE"
    1260 #    done
    1261 #echo "LTE = '$LTE'" >> $LOGFILE
     1140
    12621141    # Make temporary modprobe.conf file if we are told so
    12631142    if [ $tmpmodprobe_flag == "Y" ] ; then
    1264         infile="/tmp/modprobe.conf.mindi.$$"
     1143        infile="$MONDOTMP/modprobe.conf.mindi"
    12651144        find /etc/modprobe.d -maxdepth 1 -name "*" -xtype f -print0 | xargs -0 cat > $infile
    12661145    else
     
    12841163    echo "echo \"Done.\"" >> $outfile
    12851164    chmod +x $outfile
    1286 #    cp $outfile /tmp/out.txt
    12871165    cd /
    12881166    # Remove temporary modprobe.conf file if we have created one
     
    12911169    fi
    12921170}
    1293 
    1294 
    1295 
    12961171
    12971172
     
    13071182
    13081183# scratchdir, mountlist(OUT)
    1309     scratchdir=$TMP_ROOT
     1184    scratchdir=$MONDOTMP
    13101185    mountlist=$1
    13111186
     
    13351210    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"
    13361211    for c_p in $all_partitions ; do
    1337 #        echo "c_p = $c_p" > /dev/stderr
    13381212        [ "`echo "$useless_dev" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] && continue
    13391213        [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue
     
    14241298                current_partition=$actual_dev
    14251299            else
    1426                     Die "Your system uses a labelled partition ($current_partition), but you lack the tool to support it.\nPlease replace labels with their correct devices in /etc/fstab or install findfs|blkid|vol_id\n"
     1300                Die "Your system uses a labelled partition ($current_partition), but you lack the tool to support it.\nPlease replace labels with their correct devices in /etc/fstab or install findfs|blkid|vol_id\n"
    14271301            fi
    14281302        else
     
    15611435
    15621436
    1563 
    1564 
    1565 
    1566 
    15671437MakeSureNumberIsInteger() {
    15681438    res=`echo "$1" | tr -s '\-[0-9]' ' '`
     
    15721442    fi
    15731443}
    1574 
    1575 
    1576 
    15771444
    15781445
     
    15891456    rm -f $1.tmp
    15901457    if [ "$CDRECOVERY" != "yes" ] ; then
    1591         if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1458        if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    15921459            echo -en "Press <enter> to continue.\n" >> $1
    1593         elif [ ! "$MONDO_TMP" ] ; then
     1460        elif [ ! "$MONDOTMP" ] ; then
    15941461            echo -en "FYI, this is _not_ a Mondo Rescue CD.\n" >> $1
    15951462            if [ -e "$MINDI_LIB/memtest.img" ] ; then
     
    16051472    fi
    16061473}
    1607 
    1608 
    16091474
    16101475
     
    16371502
    16381503
     1504OfferToCopyImagesToDisks() {
     1505    local imagesdir i imagename dev count boot_dev data_dev
     1506    imagesdir=$1
     1507    boot_dev=$2
     1508    data_dev=$3
     1509
     1510    echo -en "Would you like to create boot+data floppy disks now (y/n) ?"
     1511    read i
     1512    [ "$i" != "y" ] && [ "$i" != "Y" ] && return
     1513    mount | grep -F /dev/fd > /dev/null && Die "Please unmount your floppies first."
     1514    echo "WARNING! THIS WILL ERASE YOUR FLOPPY DISKS."
     1515    [ ! -e "$boot_dev" ] && Die "Cannot find $boot_dev - is your Linux distro broken?"
     1516    [ ! -e "$data_dev" ] && Die "Cannot find $data_dev - is your Linux distro broken?"
     1517    i=`find $imagesdir -type f | grep -F "/mindi-root.1" 2> /dev/null`
     1518    j=`find $imagesdir -type f | grep -F "/mindi-boot" | grep -Ev '2880|5760'`
     1519    if [ "$i" ] ; then
     1520        CopyImageToDisk $j $data_dev "boot disk"
     1521        CopyImageToDisk $i $data_dev "root disk"
     1522    else
     1523        CopyImageToDisk $j $boot_dev "boot/root disk"
     1524    fi
     1525    count=1
     1526    for i in `find $imagesdir | grep -F mindi-data` ; do
     1527        CopyImageToDisk $i $data_dev "data disk #$count"
     1528        count=$(($count+1))
     1529    done
     1530}
     1531
     1532
    16391533OfferToMakeBootableISO() {
    16401534    local i old_pwd
     
    16441538        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
    16451539    fi
    1646     if [ ! "$MONDO_TMP" ] ; then
     1540    if [ ! "$MONDOTMP" ] ; then
    16471541        LogIt "NB: Mindi's bootable CD always uses isolinux.\n"
    16481542        LogIt "For a bootable CD w/LILO, please use Mondo.\n"
    16491543    fi
    1650     rm -Rf $TMP_ROOT/iso
    1651     mkdir -p $TMP_ROOT/iso/{images,archives,isolinux}
    1652     cp -f $1/*.img $1/*.gz $TMP_ROOT/iso/images || LogIt "OfferToMakeBootableISO: Cannot copy $i to $TMP_ROOT/iso/images\n"
     1544    rm -Rf $MONDOTMP/iso
     1545    mkdir -p $MONDOTMP/iso/{images,archives,isolinux}
     1546    cp -f $1/*.img $1/*.gz $MONDOTMP/iso/images || LogIt "OfferToMakeBootableISO: Cannot copy $i to $MONDOTMP/iso/images\n"
    16531547    old_pwd=`pwd`
    1654     cd $TMP_ROOT/iso
     1548    cd $MONDOTMP/iso
    16551549    mkdir -p $MONDO_ROOT/iso/isolinux
    16561550    echo "mindi_lib = $MINDI_LIB" >> $LOGFILE
     
    16581552    for i in memdisk memtest.bin memtest.img ; do
    16591553    j=$MINDI_LIB/$i
    1660     k=$TMP_ROOT/iso/isolinux
     1554    k=$MONDOTMP/iso/isolinux
    16611555    if [ -e "$j" ] ; then
    16621556        LogIt "Copying $j to $k\n"
    16631557        cp -f $j $k || Die "Failed to copy $j to $k"
    1664         cp -f $j $TMP_ROOT || Die "Failed to copy $j to $k"
    1665     fi
    1666     done
    1667     MakeSyslinuxMessageFile $TMP_ROOT/iso/isolinux/message.txt
    1668     cp $kernelpath $TMP_ROOT/iso/isolinux/vmlinuz || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/isolinux/vmlinuz). Did you run out of disk space?"
    1669     cp $TMP_ROOT/mindi.rdz $TMP_ROOT/iso/isolinux/initrd.img
    1670     cp $TMP_ROOT/mindi.rdz $CACHEDIR/initrd.img
     1558        cp -f $j $MONDOTMP || Die "Failed to copy $j to $k"
     1559    fi
     1560    done
     1561    MakeSyslinuxMessageFile $MONDOTMP/iso/isolinux/message.txt
     1562    cp $kernelpath $MONDOTMP/iso/isolinux/vmlinuz || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/isolinux/vmlinuz). Did you run out of disk space?"
     1563    cp $MONDOTMP/mindi.rdz $MONDOTMP/iso/isolinux/initrd.img
     1564    cp $MONDOTMP/mindi.rdz $CACHE_LOC/initrd.img
    16711565    [ -e "$iso_cfg_file" ] || Die "FIXME - unable to find $iso_cfg_file - this should never occur"
    1672     cd $TMP_ROOT/iso/isolinux
    1673     cat $iso_cfg_file | HackSyslinuxFile $ramdisk_size $TMP_ROOT/iso > isolinux.cfg || Die "Cannot copy isolinux.cfg from mindi_home to tmp_root - did you run out of disk space?"
    1674     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1566    cd $MONDOTMP/iso/isolinux
     1567    cat $iso_cfg_file | HackSyslinuxFile $ramdisk_size $MONDOTMP/iso > isolinux.cfg || Die "Cannot copy isolinux.cfg from mindi_home to tmp_root - did you run out of disk space?"
     1568    if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    16751569        mv isolinux.cfg isolinux.cfg.old
    16761570        sed s/interactive/iso/ isolinux.cfg.old > isolinux.cfg
     
    16801574        cp $ISOLINUX ../
    16811575    fi
    1682     cd $TMP_ROOT/iso
     1576    cd $MONDOTMP/iso
    16831577    if [ "$ARCH" != "ia64" ] ; then
    1684         cp -f $TMP_ROOT/iso/isolinux/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt} $MONDO_ROOT || Die "Cannot copy core files to ramdisk for boot disk. Did you run out of disk space?"
     1578        cp -f $MONDOTMP/iso/isolinux/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt} $MONDO_ROOT || Die "Cannot copy core files to ramdisk for boot disk. Did you run out of disk space?"
    16851579    fi
    16861580    [ "$MONDO_SHARE" ] && cp -f $MONDO_SHARE/autorun .   
    1687     if [ -d "/home/MondoCD" ] ; then
    1688         cp -pRdu /home/MondoCD/* .
    1689     fi
    16901581    if [ "$ARCH" != "ia64" ] ; then
    16911582        mkisofs -U -J -r -o $CACHEDIR/mindi.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table . > /dev/null 2> /tmp/$$.mk
     
    16941585    fi
    16951586    if [ "$?" -ne "0" ] ; then
    1696     echo "----------- mkisofs's errors --------------" >> $LOGFILE
    1697     cat /tmp/$$.mk >> $LOGFILE
    1698     echo "mkisofs returned the following errors:-"
    1699     cat /tmp/$$.mk
    1700     LogIt "Failed to create ISO image.\n"
    1701     else
    1702     echo "Created bootable ISO image at $CACHEDIR/mindi.iso" >> $LOGFILE
    1703     fi
    1704     rm -f /tmp/$$.mk
     1587        echo "----------- mkisofs's errors --------------" >> $LOGFILE
     1588        cat $MONDOTMP/mkisofs.log >> $LOGFILE
     1589        echo "mkisofs returned the following errors:-"
     1590        cat $MONDOTMP/mkisofs.log
     1591        LogIt "Failed to create ISO image.\n"
     1592    else
     1593        echo "Created bootable ISO image at $CACHEDIR/mindi.iso" >> $LOGFILE
     1594    fi
     1595    rm -f $MONDOTMP/mkisofs.log
    17051596    cd $old_pwd
    17061597}
    1707 
    17081598
    17091599
     
    17111601    [ "$1" -gt "1" ] && echo -en "s"
    17121602}
    1713 
    1714 
    17151603
    17161604
     
    17241612    fi
    17251613    if [ "$disksize" -gt "2880" ] ; then
    1726     if [ "`DidMondoCallMe`" ] ; then
    1727         if [ "$CDRECOVERY" != "yes" ] ; then
    1728             if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
    1729                 echo -en "Press <enter> to continue.\n"
    1730             elif [ ! "$MONDO_TMP" ] ; then
    1731                 echo -en "FYI, this is _not_ a Mondo Rescue CD.\n"
    1732             else
    1733                 echo -en "$BOOT_MEDIA_MESSAGE"
     1614        if [ "`DidMondoCallMe`" ] ; then
     1615            if [ "$CDRECOVERY" != "yes" ] ; then
     1616                if [ -e "$MONDOTMP/NFS-DEV" ] ; then
     1617                    echo -en "Press <enter> to continue.\n"
     1618                elif [ ! "$MONDOTMP" ] ; then
     1619                    echo -en "FYI, this is _not_ a Mondo Rescue CD.\n"
     1620                else
     1621                    echo -en "$BOOT_MEDIA_MESSAGE"
     1622                fi
    17341623            fi
    17351624        fi
    1736     fi
    17371625    fi
    17381626    if [ "$CDRECOVERY" = "yes" ] ; then
     
    17431631    echo -en "\n\n\n"
    17441632}
    1745 
    1746 
    17471633
    17481634
     
    17561642    rand1=$RANDOM
    17571643    rand2=$RANDOM
    1758     image=/tmp/$rand1.$rand2.img
    1759     mtpt=/tmp/$rand1.$rand2.mtpt
     1644    image=$MONDOTMP/$rand1.$rand2.img
     1645    mtpt=$MONDOTMP/$rand1.$rand2.mtpt
    17601646    dd if=/dev/zero of=$image bs=1k count=$disksize
    17611647    mke2fs -N 26 -F $image > /dev/null
     
    17831669    CopyBootBFile $mtpt/boot.b
    17841670
    1785 #    echo "root=/dev/loop0" > bdlilo.conf
    17861671    MakeLiloConfFile $disksize >> bdlilo.conf
    1787 
    1788 #    cat bdlilo.conf > /tmp/bdlilo.conf
    1789 
    1790 #    cat /home/mondostuff/bdlc > bdlilo.conf
    17911672
    17921673    chmod 644 bdlilo.conf
     
    17951676    res=$?
    17961677
    1797 #echo "lilo -v -C bdlilo.conf -r $mtpt"
    1798 #echo -en "Press enter"; read line
    1799 
    18001678    cd $old_pwd
    18011679    umount $mtpt
     
    18041682
    18051683    return $res
    1806 
    1807 }
    1808 
    1809 
    1810 
    1811 
     1684}
    18121685
    18131686
     
    18161689    disksize=$1
    18171690    options=""
    1818         if [ "$ARCH" != "ia64" ] ; then
    1819             echo -en "boot=/dev/loop0\ndisk=/dev/loop0\n"
    1820         fi
    1821         if [ "$disksize" -eq "2880" ] ; then
    1822             echo -en "bios=0x00\nsectors=36\nheads=2\ncylinders=80\n"
    1823         elif [ "$disksize" -eq "1722" ] ; then
    1824             echo -en "bios=0x00\nsectors=21\nheads=2\ncylinders=82\n"
    1825         elif [ "$disksize" -gt "2880" ] ; then
    1826             /bin/true
    1827         else
    1828             echo -en "bios=0x00\nsectors=18\nheads=2\ncylinders=80\n"
    1829         fi
    1830         if [ "$ARCH" != "ia64" ] ; then
    1831             echo -en "install=/boot.b\nmap=/boot.map\n"
    1832         fi
     1691
     1692    if [ "$ARCH" != "ia64" ] ; then
     1693        echo -en "boot=/dev/loop0\ndisk=/dev/loop0\n"
     1694    fi
     1695    if [ "$disksize" -eq "2880" ] ; then
     1696        echo -en "bios=0x00\nsectors=36\nheads=2\ncylinders=80\n"
     1697    elif [ "$disksize" -eq "1722" ] ; then
     1698        echo -en "bios=0x00\nsectors=21\nheads=2\ncylinders=82\n"
     1699    elif [ "$disksize" -gt "2880" ] ; then
     1700        /bin/true
     1701    else
     1702        echo -en "bios=0x00\nsectors=18\nheads=2\ncylinders=80\n"
     1703    fi
     1704    if [ "$ARCH" != "ia64" ] ; then
     1705        echo -en "install=/boot.b\nmap=/boot.map\n"
     1706    fi
    18331707    if [ "$CDRECOVERY" = "yes" ] ; then
    18341708        echo -en "default=RESTORE\n"
    18351709    elif [ "$disksize" -gt "2880" ] && [ "`DidMondoCallMe`" ] ; then
    1836         if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1710        if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    18371711            echo -en "default=iso\n"
    18381712        else
     
    18481722    fi
    18491723    if [ "$CDRECOVERY" != "yes" ] ; then
    1850     echo -en "timeout=300\n"
     1724        echo -en "timeout=300\n"
    18511725    fi
    18521726    echo -en "\n"
    18531727    if [ "$CDRECOVERY" = "yes" ] ; then
    1854     options="RESTORE expert"
     1728        options="RESTORE expert"
    18551729    elif [ "$disksize" -gt "2880" ] ; then
    18561730        if [ "`DidMondoCallMe`" ] ; then
    1857             if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1731            if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    18581732                options="iso"
    18591733            else
     
    18631737        else
    18641738            options="expert"
    1865     fi
     1739        fi
    18661740    else
    18671741        options="expert"
    18681742    fi
    18691743    for i in $options ; do
    1870     ooo=$i
    1871     [ "$ooo" = "RESTORE" ] && ooo="nuke"
    1872     if [ "$ARCH" = "ia64" ] ; then
    1873         rootpart="root=/dev/ram0\n\t"
    1874     else
    1875         rootpart=""
    1876     fi
    1877     outstr="image=vmlinuz\n\tlabel=$i\n\tinitrd=/mindi.rdz\n\t${rootpart}append=\" rw ramdisk=$ramdisksize ramdisk_size=$ramdisksize maxcpus=1 $ooo_mode $ADDITIONAL_BOOT_PARAMS"
     1744        ooo=$i
     1745        [ "$ooo" = "RESTORE" ] && ooo="nuke"
     1746        if [ "$ARCH" = "ia64" ] ; then
     1747            rootpart="root=/dev/ram0\n\t"
     1748        else
     1749            rootpart=""
     1750        fi
     1751        outstr="image=vmlinuz\n\tlabel=$i\n\tinitrd=/mindi.rdz\n\t${rootpart}append=\" rw ramdisk=$ramdisksize ramdisk_size=$ramdisksize maxcpus=1 $ooo_mode $ADDITIONAL_BOOT_PARAMS"
    18781752   
    1879     outstr=$outstr" $ooo_mode"
    1880     outstr=$outstr"\"\n"
    1881     if [ "$disksize" = "1440" ] ; then
    1882         echo -en "$outstr" | sed s/initrd=.*// | grep -v root=
    1883     else
    1884         echo -en "$outstr"
    1885     fi
    1886     done
    1887 }
    1888 
    1889 
     1753        outstr=$outstr" $ooo_mode"
     1754        outstr=$outstr"\"\n"
     1755        if [ "$disksize" = "1440" ] ; then
     1756            echo -en "$outstr" | sed s/initrd=.*// | grep -v root=
     1757        else
     1758            echo -en "$outstr"
     1759        fi
     1760    done
     1761}
    18901762
    18911763
     
    19001772    [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"
    19011773    echo -en "Making "$disksize"KB boot disk..."
    1902     TurnTgzIntoRdz $MINDI_LIB/rootfs $TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
     1774    TurnTgzIntoRdz $MINDI_LIB/rootfs $MONDOTMP/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
    19031775    if [ "$ARCH" != "ia64" ] ; then
    19041776        [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size"
     
    19061778    echo -en "..."
    19071779    imagefile=$imagesdir/mindi-bootroot.$disksize.img
    1908     mountpoint=$TMP_ROOT/mountpoint.$$
     1780    mountpoint=$MONDOTMP/mountpoint.$$
    19091781    mkdir -p $mountpoint
    19101782    dd if=/dev/zero of=$imagefile bs=1k count=$disksize &> /dev/null || Die "Cannot dd blank file"
    19111783    if [ "$ARCH" = "ia64" ] ; then
    1912         mkdosfs $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$
     1784        mkdosfs $imagefile > $MONDOTMP/mke2fs.log 2>> $MONDOTMP/mke2fs.log
    19131785    t=vfat
    19141786    else
    1915         mke2fs -N 26 -m 0 -F $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$
     1787        mke2fs -N 26 -m 0 -F $imagefile > $MONDOTMP/mke2fs.log 2>> $MONDOTMP/mke2fs.log
    19161788    t=ext2
    19171789    fi
    1918     [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$
    1919     rm -f /tmp/mke2fs.$$
     1790    [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.log
     1791    rm -f $MONDOTMP/mke2fs.log
    19201792    mount -t $t -o loop $imagefile $mountpoint || LogIt "Cannot mount (PBDI)\n\n"
    19211793# copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
     
    19241796        liloconf=$mountpoint/etc/lilo.conf
    19251797    else
    1926     liloconf=$mountpoint/elilo.conf
     1798        liloconf=$mountpoint/elilo.conf
    19271799    fi
    19281800    old_pwd=`pwd`
     
    19381810    MakeLiloConfFile $disksize > $liloconf
    19391811
    1940     echo "Copying $TMP_ROOT/mindi.rdz to $mountpoint..." >> $LOGFILE
    1941     cp -f $TMP_ROOT/mindi.rdz $mountpoint 2>> $LOGFILE
     1812    echo "Copying $MONDOTMP/mindi.rdz to $mountpoint..." >> $LOGFILE
     1813    cp -f $MONDOTMP/mindi.rdz $mountpoint 2>> $LOGFILE
    19421814    if [ "$?" -ne "0" ] ; then
    1943     LogIt "Failed to copy $TMP_ROOT/mindi.rdz to $mountpoint\n"
    1944     cat $TMP_ROOT/mtpt.$$ >> $LOGFILE
    1945     LogIt "Please unload some of your modules and try again.\n"
    1946     rm -f $TMP_ROOT/mtpt.$$
    1947     LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"
     1815        LogIt "Failed to copy $MONDOTMP/mindi.rdz to $mountpoint\n"
     1816        cat $MONDOTMP/mtpt.$$ >> $LOGFILE
     1817        LogIt "Please unload some of your modules and try again.\n"
     1818        rm -f $MONDOTMP/mtpt.$$
     1819        LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"
    19481820        retval=$(($retval+1))
    19491821    fi
     
    19511823
    19521824    mkdir -p $mountpoint/tmp
    1953     cp -f $TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null
     1825    cp -f $MONDOTMP/mondo-restore.cfg $mountpoint/tmp &> /dev/null
    19541826    if [ -e "$MINDI_LIB/memtest.img" ] ; then
    19551827        echo -en "image=/memtest.bin\nlabel=memtest\nn" >> $liloconf
     
    19571829#        echo "Yep, this is a multi-function CD" > $mountpoint/MULTIFUNC
    19581830    fi
    1959     if [ -d "/home/MondoCD" ] ; then
    1960     cp -pRdu /home/MondoCD/* . || Die "Cannot do kung pow"
    1961     fi
    1962 
    1963 # copy the kernel across
     1831
     1832    # copy the kernel across
    19641833    rm -Rf $mountpoint/lost+found
    19651834    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
     
    19671836    cp -f $kernelpath $mountpoint/vmlinuz > /dev/null 2> /dev/null
    19681837    if [ "$?" -ne "0" ] || [ "$FORCE_DUAL_FLOPPIES" = "yes" ] ; then
    1969     echo "Files at mountpoint ($mountpoint) :-" >> $LOGFILE
    1970     du -sk $mountpoint/* >> $LOGFILE
    1971     echo "--- end of list of files ---" >> $LOGFILE
    1972     echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n\
     1838        echo "Files at mountpoint ($mountpoint) :-" >> $LOGFILE
     1839        du -sk $mountpoint/* >> $LOGFILE
     1840        echo "--- end of list of files ---" >> $LOGFILE
     1841        echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n\
    19731842Sorry, your kernel is too big for a boot/root floppy.\nI'll try the new boot/root two-disk thingy.\n" >> $LOGFILE
    19741843        rm -f $mountpoint/vmlinuz
    1975     cd $old_pwd
     1844        cd $old_pwd
    19761845        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    19771846        rmdir $mountpoint || LogIt "Cannot rmdir (PBDI)\n"
    1978 #   losetup /dev/loop0 -d
    1979     res=0
     1847    #   losetup /dev/loop0 -d
     1848        res=0
    19801849        write_full_floppy_of_kernel $kernelpath $imagesdir/mindi-boot.1440.img 1440
    1981     res=$(($res+$?))
    1982         cp -f $TMP_ROOT/mindi.rdz $imagesdir/mindi-root.1440.img
    1983     res=$(($res+$?))
    1984     rm -f $imagefile
    1985     if [ "$res" -ne "0" ]; then
    1986         LogIt "Warning - failed to create 1.44MB boot/root floppies\n"
    1987         rm -f $imagesdir/mindi-*.1440.img
    1988     fi
    1989     return $res
     1850        res=$(($res+$?))
     1851        cp -f $MONDOTMP/mindi.rdz $imagesdir/mindi-root.1440.img
     1852        res=$(($res+$?))
     1853        rm -f $imagefile
     1854        if [ "$res" -ne "0" ]; then
     1855            LogIt "Warning - failed to create 1.44MB boot/root floppies\n"
     1856            rm -f $imagesdir/mindi-*.1440.img
     1857        fi
     1858        return $res
    19901859    fi
    19911860    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     
    20041873    elif [ ! "$KERN_DISK_MADE" ] ; then
    20051874# 12/28/2001 - if 1.72MB floppy then don't use LILO's optimizations at all
    2006     $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE
    2007     else
    2008     echo "Not running LILO. It's not that kind of disk." >> $LOGFILE
    2009     fi
     1875        $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE
     1876    else
     1877        echo "Not running LILO. It's not that kind of disk." >> $LOGFILE
     1878    fi
     1879
     1880    # BERLIOS  does not test necessarily what it expects
    20101881    if [ $? -ne "0" ] ; then
    2011     if [ "`grep -F "/tmp/dev.0" $LOGFILE`" ] ; then
    2012         LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"
    2013         LogIt "Please reboot your PC as a workaround.\n"
    2014         Die "LILO sneezed and Mindi caught a cold. Please read the README / FAQ.\n"
    2015     fi
    2016     echo "$LILO_EXE -r $mountpoint ...failed."
    2017     echo -en "Press ENTER to continue."; read line
    2018     LogIt "Cannot run lilo on $mountpoint\nPlease upgrade/downgrade your version of LILO. It has a bug.\n"
    2019     retval=$(($retval+1))
    2020     fi
    2021     cp -f $liloconf /tmp/lilo.conf
     1882        if [ "`grep -F "/tmp/dev.0" $LOGFILE`" ] ; then
     1883            LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"
     1884            LogIt "Please reboot your PC as a workaround.\n"
     1885            Die "LILO sneezed and Mindi caught a cold. Please read the README / FAQ.\n"
     1886        fi
     1887        echo "$LILO_EXE -r $mountpoint ...failed."
     1888        echo -en "Press ENTER to continue."; read line
     1889        LogIt "Cannot run lilo on $mountpoint\nPlease upgrade/downgrade your version of LILO. It has a bug.\n"
     1890        retval=$(($retval+1))
     1891    fi
     1892    cp -f $liloconf $MONDOTMP/lilo.conf
    20221893    if [ "$ARCH" = "ia64" ] ; then
    20231894        cp `dirname $kernelpath`/*.efi $mountpoint
     
    20391910    return $retval
    20401911}
    2041 
    2042 
    20431912
    20441913
     
    20521921    local retval old_pwd
    20531922    retval=0
     1923
    20541924    [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"
    20551925    echo -en "Making "$disksize"KB boot disk..."
    2056     TurnTgzIntoRdz $MINDI_LIB/rootfs $TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
     1926    TurnTgzIntoRdz $MINDI_LIB/rootfs $MONDOTMP/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
    20571927    [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size"
    20581928    echo -en "..."
    20591929    imagefile=$imagesdir/mindi-bootroot.$disksize.img
    2060     mountpoint=$TMP_ROOT/mountpoint.$$
     1930    mountpoint=$MONDOTMP/mountpoint.$$
    20611931    mkdir -p $mountpoint
    20621932# If I format a 1722KB data file & run syslinux on it, the resultant image
     
    20741944    fi
    20751945    mount -t vfat -o loop $imagefile $mountpoint || LogIt "Cannot mount (PBDI)\n\n"
    2076 # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
     1946
     1947    # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
    20771948    old_pwd=`pwd`
    20781949    MakeSyslinuxMessageFile $mountpoint/message.txt
    20791950    cd $mountpoint
    20801951    [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?"
    2081 #    tar -zxf $MINDI_LIB/dev.tgz || LogIt "Cannot untar dev.tgz\n" <--- present for LILO; is it nec. for SYSLINUX too?
    20821952    cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $mountpoint > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to tmp_root"
    2083     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1953    if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    20841954        mv syslinux.cfg syslinux.cfg.orig
    20851955        sed s/interactive/iso/ syslinux.cfg.orig > syslinux.cfg
    20861956    fi
    20871957    cd $old_pwd
    2088     echo "Copying $TMP_ROOT/mindi.rdz to $mountpoint/initrd.img..." >> $LOGFILE
    2089     cp -f $TMP_ROOT/mindi.rdz $mountpoint/initrd.img 2>> $LOGFILE
     1958    echo "Copying $MONDOTMP/mindi.rdz to $mountpoint/initrd.img..." >> $LOGFILE
     1959    cp -f $MONDOTMP/mindi.rdz $mountpoint/initrd.img 2>> $LOGFILE
    20901960    if [ "$?" -ne "0" ] ; then
    2091         LogIt "Failed to copy $TMP_ROOT/mindi.rdz to $mountpoint\n"
    2092         cat $TMP_ROOT/mtpt.$$ >> $LOGFILE
     1961        LogIt "Failed to copy $MONDOTMP/mindi.rdz to $mountpoint\n"
     1962        cat $MONDOTMP/mtpt.$$ >> $LOGFILE
    20931963        LogIt "Please unload some of your modules and try again.\n"
    2094         rm -f $TMP_ROOT/mtpt.$$
     1964        rm -f $MONDOTMP/mtpt.$$
    20951965        LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"
    20961966        retval=$(($retval+1))
     
    20981968
    20991969    mkdir -p $mountpoint/tmp
    2100     cp -f $TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null
    2101 
    2102 # copy the kernel across
     1970    cp -f $MONDOTMP/mondo-restore.cfg $mountpoint/tmp &> /dev/null
     1971
     1972    # copy the kernel across
    21031973    rm -Rf $mountpoint/lost+found
    21041974    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
     
    21151985        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    21161986        rmdir $mountpoint || LogIt "Cannot rmdir (PBDI)\n"
    2117 #   losetup /dev/loop0 -d
    21181987
    21191988        res=0
    21201989        write_full_floppy_of_kernel $kernelpath $imagesdir/mindi-boot.1440.img 1440
    21211990        res=$(($res+$?))
    2122         cp -f $TMP_ROOT/mindi.rdz $imagesdir/mindi-root.1440.img
     1991        cp -f $MONDOTMP/mindi.rdz $imagesdir/mindi-root.1440.img
    21231992        res=$(($res+$?))
    21241993        rm -f $imagefile
     
    21332002    echo "Free space left on floppy = $free_space KB" >> $LOGFILE
    21342003    echo "Max kernel size on $disksize KB floppy (est'd) = $max_kernel_size K" >> $LOGFILE
    2135 # make it bootable
     2004
     2005    # make it bootable
    21362006    rm -f $mountpoint/zero
    21372007    mkdir -p $mountpoint/etc
     
    21622032    imagesdir=$1
    21632033    rm -f $imagesdir/mindi-*.img $imagesdir/[0-9]*.tar.gz $imagesdir/mindi.iso
    2164     needlist=$TMP_ROOT/what-we-need.txt
    2165     bigdir=$TMP_ROOT/bigdir
    2166     minidir_root=$TMP_ROOT/minidir
     2034    needlist=$MONDOTMP/what-we-need.txt
     2035    bigdir=$MONDOTMP/bigdir
     2036    minidir_root=$MONDOTMP/minidir
    21672037    mkdir -p $minidir_root
    21682038    mkdir -p $bigdir/usr/bin
    2169     tardir=$TMP_ROOT/tardir
     2039    tardir=$MONDOTMP/tardir
    21702040
    21712041    lines=`grep -vx " *#.*" $MINDI_CONF/deplist.txt | grep -vx "" | wc -l`
     
    21732043    res=$?
    21742044    if [ "$YOUR_KERNEL_SUCKS" ]; then
    2175     pwd=`pwd`
    2176     cd $TMP_ROOT
     2045        pwd=`pwd`
     2046        cd $MONDOTMP
    21772047        for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do
    2178         cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir"
    2179         if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
    2180         cp --parents -pRdf $i $bigdir
    2181         else
    2182         ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
    2183         BIGNO=$(($BIGNO+1))
    2184         fi
    2185     done
    2186     for i in $EXTRA_MODS ; do
    2187         j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null`
    2188         [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE
    2189         for k in $j ; do
    2190         if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
    2191             cp --parents -pRdf $k $bigdir
    2192         else
    2193             ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
    2194             BIGNO=$(($BIGNO+1))
    2195         fi
    2196         echo "Added failsafe module $k to ramdisk" >> $LOGFILE
     2048            cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir"
     2049            if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
     2050                cp --parents -pRdf $i $bigdir
     2051            else
     2052                ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
     2053                BIGNO=$(($BIGNO+1))
     2054            fi
    21972055        done
    2198     done
    2199     cd $pwd
    2200     else
    2201     ListKernelModulePaths >> $needlist
     2056        for i in $EXTRA_MODS ; do
     2057            j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null`
     2058            [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE
     2059            for k in $j ; do
     2060                if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
     2061                    cp --parents -pRdf $k $bigdir
     2062                else
     2063                    ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
     2064                    BIGNO=$(($BIGNO+1))
     2065                fi
     2066                echo "Added failsafe module $k to ramdisk" >> $LOGFILE
     2067            done
     2068        done
     2069        cd $pwd
     2070    else
     2071        ListKernelModulePaths >> $needlist
    22022072    fi
    22032073    if [ "$res" -ne "0" ] ; then
     
    22072077    mkdir -p $bigdir/tmp
    22082078    if [ "`DidMondoCallMe`" ] ; then
    2209         MakeMondoConfigFile $TMP_ROOT/mondo-restore.cfg
    2210         cp -f $TMP_ROOT/mondo-restore.cfg $bigdir/tmp &> /dev/null
    2211         cp -f $TMP_ROOT/mondo-restore.cfg $CACHE_LOC &> /dev/null
     2079        MakeMondoConfigFile $MONDOTMP/mondo-restore.cfg
     2080        cp -f $MONDOTMP/mondo-restore.cfg $bigdir/tmp &> /dev/null
    22122081    fi
    22132082    [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO
     
    22162085    CopyDependenciesToDirectory < $needlist $bigdir
    22172086
    2218 # also copy io.sys and msdos.sys, if we can find them
     2087    # also copy io.sys and msdos.sys, if we can find them
    22192088    for i in `mount | cut -d' ' -f3` ; do
    2220     for j in io.sys msdos.sys ; do
    2221         [ -e "$i/$j" ] && cp -f $i/$j $bigdir
    2222     done
    2223     done
    2224 
    2225 # master boot record, too
    2226     i=`cat $MONDO_TMP/BOOTLOADER.DEVICE 2> /dev/null`
     2089        for j in io.sys msdos.sys ; do
     2090            [ -e "$i/$j" ] && cp -f $i/$j $bigdir
     2091        done
     2092    done
     2093
     2094    # master boot record, too
     2095    i=`cat $MONDOTMP/BOOTLOADER.DEVICE 2> /dev/null`
    22272096    if [ "$i" ] ; then
    2228     LogIt "Backing up $i's MBR\n"
    2229     dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
    2230 # < < E O F
    2231     sleep 1
    2232     sync
    2233 #        [ "$?" -ne "0" ] && echo "Failed to save $i's MBR to bigdir" >> $LOGFILE
    2234     j=$i
    2235     [ -h "$j" ] && j=`readlink -f $j`
    2236     LogIt "Creating /dev/boot_device ($j)\n"
    2237     mkdir -p $bigdir/dev
    2238     cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk"
    2239     fi
    2240 
    2241 # more stuff
    2242 #    cp -f $MINDI_LIB/embleer* $bigdir
     2097        LogIt "Backing up $i's MBR\n"
     2098        dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
     2099        sleep 1
     2100        sync
     2101        j=$i
     2102        [ -h "$j" ] && j=`readlink -f $j`
     2103        LogIt "Creating /dev/boot_device ($j)\n"
     2104        mkdir -p $bigdir/dev
     2105        cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk"
     2106    fi
     2107
    22432108    old_pwd=`pwd`
    22442109    cd $bigdir
     
    22472112    cp -Rdf $MINDI_LIB/aux-tools/* . 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping aux-tools\n"
    22482113    if [ -e "$MINDI_LIB/x11-tools.tgz" ] ; then
    2249     tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
     2114        tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
    22502115    fi
    22512116    if [ -e "$MONDO_SHARE/restore-scripts" ] ; then
     
    22652130#        EXTRA_SPACE=$(($EXTRA_SPACE*2))
    22662131#    fi
    2267     MakeMountlist $TMP_ROOT/mountlist.txt
     2132    MakeMountlist $MONDOTMP/mountlist.txt
    22682133    mkdir -p $minidir_root/$noof_disks/tmp
    2269     cp -f $TMP_ROOT/mountlist.txt $minidir_root/$noof_disks/tmp/mountlist.txt || Die "Cannot copy mountlist.txt from $TMP_ROOT to data disk"
    2270     cp -f $TMP_ROOT/mountlist.txt $CACHE_LOC
    2271     [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDO_TMP/.
     2134    cp -f $MONDOTMP/mountlist.txt $minidir_root/$noof_disks/tmp/mountlist.txt || Die "Cannot copy mountlist.txt from $MONDOTMP to data disk"
     2135    [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDOTMP/.
    22722136    [ $LVM != "false" ] && $MINDI_LIB/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm
    22732137    cat $minidir_root/$noof_disks/tmp/mountlist.txt >> $LOGFILE
     
    22752139    CreateDataDiskImagesFromTarballs $tardir $imagesdir $noof_disks
    22762140    FRIENDLY_OUTSTRING="Boot and data disk images were created."
    2277 # One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images
     2141    # One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images
    22782142    rmdir $tardir $bigdir
    22792143    rm -f $needlist
     
    22972161
    22982162
    2299 
    23002163Prompt() {
    23012164    echo -en "$1"
    23022165    read line
    23032166}
    2304 
    23052167
    23062168
     
    23102172    i=0
    23112173    while [ "$i" -le "32" ] && [ "$incoming" = "" ] ; do
    2312     i=$(($i+1))
    2313     read incoming
     2174        i=$(($i+1))
     2175        read incoming
    23142176    done
    23152177    echo "$incoming"
    23162178}
    2317 
    23182179
    23192180
     
    23312192            [ -h "$minidir_root/$diskno/$fname" ] && MoveHyperlinkSensibly $fname $minidir_root $diskno $noof_disks
    23322193        done
    2333     diskno=$(($diskno+1))
    2334     done
    2335 
     2194        diskno=$(($diskno+1))
     2195    done
    23362196
    23372197    cd $old_pwd
    23382198    return
    2339 
    2340 
    2341 
    2342 # do some awk/gawk stuff
    2343     cd $minidir_root
    2344     awk_loc=`find -name awk`
    2345     gawk_loc=`find -name gawk`
    2346     if [ "$awk_loc" = "" ] && [ "$gawk_loc" != "" ] ; then
    2347         for i in $gawk_loc ; do HackAwk $i gawk ; done
    2348     elif [ "$gawk_loc" = "" ] && [ "$awk_loc" != "" ] ; then
    2349         for i in $awk_loc ; do HackAwk $i awk ; done
    2350     elif [ "$gawk_loc" != "" ] && [ "$awk_loc" != "" ] ; then
    2351         echo -en "Gawk/awk found. Good.\r"
    2352     else
    2353         Die "Look, I don't want to come across as having an attitude, but you need either awk or gawk. Get a distro that doesn't suck, okay? :-)"
    2354     fi
    2355     cd $old_pwd
    23562199}
    23572200
     
    23592202ReplaceIndividualLine() {
    23602203    local orig_file new_file lino newstring lines_total lines_remaining
     2204
    23612205    orig_file=$1.orig
    23622206    mv -f $1 $orig_file || Die "Cannot move $1 to $orig_file"
     
    23652209    newstring="$3"
    23662210    if [ "$lino" = "" ] || [ "$lino" -lt "1" ] ; then
    2367     echo "Can't find string" >> $LOGFILE
    2368     return 1
     2211        echo "Can't find string" >> $LOGFILE
     2212        return 1
    23692213    fi
    23702214    lines_total=`wc -l $orig_file | gawk '{print $1;}'`
     
    23752219    tail -n$lines_remaining $orig_file >> $new_file
    23762220    echo "Replace line $lino of $new_file with user-specified line, '$newstring'" >> $LOGFILE
    2377 #    cp -f $new_file /tmp/init.new
    23782221    [ -x "$orig_file" ] && chmod +x $new_file
    23792222    rm -f $orig_file
     
    23892232    done
    23902233}
    2391 
    23922234
    23932235
     
    23962238    device=$1
    23972239    if [ "`echo "$device" | grep -F "/dev/md"`" != "" ] ; then
    2398     res=`SizeOfRaidPartition $device`
    2399     [ "$res" = "" ] && Die "Cannot find $device's size - is your /etc/raidtab sane?"
    2400     echo "$res"
    2401     return 0
    2402     fi
    2403 #    res=`$FDISK -l 2>> $LOGFILE | grep -w "$device" | head -n1 | sort -u | tr '*' ' ' | tr -s '\t' '|' | tr -s ' ' ' ' | cut -d' ' -f4 | sed s/+// | sed s/-//`
    2404 # patch from Bill <bill@iwizard.biz> - 2003/08/25
     2240        res=`SizeOfRaidPartition $device`
     2241        [ "$res" = "" ] && Die "Cannot find $device's size - is your /etc/raidtab sane?"
     2242        echo "$res"
     2243        return 0
     2244    fi
     2245    # patch from Bill <bill@iwizard.biz> - 2003/08/25
    24052246    res=`$FDISK -s $device`
    24062247    echo "------- $FDISK -l $device log ------------" >> $LOGFILE
    24072248    cat $FDISKLOG >> $LOGFILE
    24082249    echo "------- $FDISK log end ------------" >> $LOGFILE
    2409 # end patch
     2250    # end patch
    24102251    [ "$res" = "" ] && res=`df -k -P -x supermount | tr -s '\t' ' ' | grep -F "$device " | cut -d' ' -f2`
    24112252    [ "$res" = "" ] && res="-1"
     
    24222263
    24232264    for real_dev in `GetRaidDevMembers $1` ; do
    2424     tmp=`SizeOfPartition $real_dev`
    2425     [ "$tmp" -lt "$smallest_size" ] && smallest_size=$tmp
     2265        tmp=`SizeOfPartition $real_dev`
     2266        [ "$tmp" -lt "$smallest_size" ] && smallest_size=$tmp
    24262267    done
    24272268
    24282269    if [ "$smallest_size" = "$silly" ] ; then
    2429     echo "-1"
    2430     return 1
    2431     else
    2432     echo "$smallest_size"
    2433     return 0
    2434     fi
    2435 }
    2436 
    2437 
    2438 
    2439 
     2270        echo "-1"
     2271        return 1
     2272    else
     2273        echo "$smallest_size"
     2274        return 0
     2275    fi
     2276}
    24402277
    24412278
     
    24432280{
    24442281    local tempfile
    2445     tempfile=$TMP_ROOT/$$.strip.txt
     2282
     2283    tempfile=$MONDOTMP/$$.strip.txt
    24462284    cp -f $1 $tempfile
    24472285    $AWK '{if (substr($0,0,1)!="#" || substr($0,0,3)=="#!/") {print $0;};}' $tempfile > $1
     
    24512289
    24522290
    2453 
    2454 
    2455 
    2456 
    24572291SplitDirectoryIntoMinidirs() {
    24582292    local bigdir minidir_root i noof_disks old_pwd res
     2293
    24592294    bigdir=$1
    24602295    minidir_root=$2
     
    24642299    noof_disks=$?
    24652300    if [ "$noof_disks" -eq "0" ] ; then
    2466     echo "Failed to fit data into several dirs."
     2301        echo "Failed to fit data into several dirs."
    24672302        return 0
    24682303    fi
    24692304    RejigHyperlinks $minidir_root $noof_disks
    24702305    rm -Rf $bigdir/*
    2471    return $noof_disks
    2472 }
    2473 
     2306    return $noof_disks
     2307}
    24742308
    24752309
     
    24772311{
    24782312    local tmpfile
    2479     tmpfile=$TMP_ROOT/stripped.$$.dat
     2313
     2314    tmpfile=$MONDOTMP/stripped.$$.dat
    24802315    [ -d "$1" ] || [ -h "$1" ] && return
    24812316    cp -f $1 $tmpfile
    24822317    strip $tmpfile 2> /dev/null
    24832318    if [ "$?" -eq "0" ] ; then
    2484     cp -f $tmpfile $1
    2485     echo "Stripped binary $2" >> $LOGFILE
     2319        cp -f $tmpfile $1
     2320        echo "Stripped binary $2" >> $LOGFILE
    24862321    fi
    24872322    rm -f $tmpfile
     
    25082343
    25092344
    2510 
    25112345TryToFindKernelPath() {
    25122346    local fname incoming res fkern_ver we_want_version possible_kernels noof_kernels kernelpath kdate duff_kernels
     2347
    25132348    we_want_version=`uname -r`
    25142349    possible_kernels=""
     
    25212356    fi
    25222357    for fname in `find $root -maxdepth 2 -type f | grep -F lin | grep -Ev '^/proc/|^/net/'` ; do
    2523     [ ! -e "$fname" ] && continue
     2358        [ ! -e "$fname" ] && continue
    25242359        [ "$fname" = "/boot/vmlinuz.shipped" ] && [ -f "/boot/vmlinuz" ] && continue; # ignore SuSE's extra kernel
    2525     file $fname | grep -q gzip
    2526     if [ "$?" -eq "0" ] ; then
    2527         # Used by ia64
     2360        file $fname | grep -q gzip
     2361        if [ "$?" -eq "0" ] ; then
     2362            # Used by ia64
    25282363            fkern_ver=`gzip -cd $fname | strings 2> /dev/null | grep "[2-9]+*[.][0-9]+*[.][0-9]+*[^\@]*@"`
    2529     else
     2364        else
    25302365            fkern_ver=`strings $fname 2> /dev/null | grep "[2-9]+*[.][0-9]+*[.][0-9]+*[^\@]*@"`
    2531     fi
     2366        fi
    25322367        [ "$fkern_ver" = "" ] && continue
    2533 #   echo "$fname --> $fkern_ver (but we want $we_want_version)" >> /dev/stderr
    25342368        [ "`echo "$fkern_ver" |grep -F "$we_want_version "`" = "" ] && continue
    2535     [ -f "$fname" ] || continue
    2536     [ -h "$fname" ] && continue
    2537     kdate=`uname -v | $AWK '{for(i=1;i<NF;i++){if(index($i,":")){print $i;};};}' | $AWK '{print $NF;}'`
    2538     file $fname | grep -q gzip
    2539     if [ "$?" -eq "0" ] ; then
    2540         # Used by ia64
    2541         if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
    2542             LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it...\n"
    2543             duff_kernels="$fname $duff_kernels"
    2544         else
     2369        [ -f "$fname" ] || continue
     2370        [ -h "$fname" ] && continue
     2371        kdate=`uname -v | $AWK '{for(i=1;i<NF;i++){if(index($i,":")){print $i;};};}' | $AWK '{print $NF;}'`
     2372        file $fname | grep -q gzip
     2373        if [ "$?" -eq "0" ] ; then
     2374            # Used by ia64
     2375            if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
     2376                LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it...\n"
     2377                duff_kernels="$fname $duff_kernels"
     2378            else
    25452379                [ "`echo "$fname" | grep -F "vmlinux"`" ] && continue
    25462380                possible_kernels="$fname $possible_kernels"
    2547         fi
    2548     else
    2549         if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
    2550             LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it...\n"
    2551             duff_kernels="$fname $duff_kernels"
     2381            fi
    25522382        else
     2383            if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
     2384                LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it...\n"
     2385                duff_kernels="$fname $duff_kernels"
     2386            else
    25532387                [ "`echo "$fname" | grep -F "vmlinux"`" ] && continue
    25542388                possible_kernels="$fname $possible_kernels"
    2555         fi
    2556     fi
     2389            fi
     2390        fi
    25572391    done
    25582392    if [ ! "$possible_kernels" ] && uname -a | grep Knoppix > /dev/null ; then
    2559     possible_kernels=`find /boot/vmlinuz-2.* | tail -n1`
     2393        possible_kernels=`find /boot/vmlinuz-2.* | tail -n1`
    25602394    fi
    25612395    if [ ! "$possible_kernels" ] ; then
     
    25732407    if [ "$noof_kernels" -eq "0" ] ; then
    25742408        LogIt "Could not find your kernel.\n"
    2575     if [ -e "/boot/vmlinuz" ] ; then
    2576         LogIt "Using /boot/vmlinuz as a last resort.\n"
    2577         output=/boot/vmlinuz
     2409        if [ -e "/boot/vmlinuz" ] ; then
     2410            LogIt "Using /boot/vmlinuz as a last resort.\n"
     2411            output=/boot/vmlinuz
    25782412        else
    2579         output=""
    2580     fi
     2413            output=""
     2414        fi
    25812415    elif [ "$noof_kernels" -eq "1" ] ; then
    25822416        kernelpath=`echo "$possible_kernels" | sed s/' '//`
     
    25862420        for i in $possible_kernels ; do
    25872421            if echo $i | grep "`uname -r`" ; then
    2588         LogIt "OK, I used my initiative and found that "
     2422                LogIt "OK, I used my initiative and found that "
    25892423                LogIt "$i is probably your kernel.\n "
    2590         output="$i"
    2591         return
    2592         fi
     2424                output="$i"
     2425                return
     2426            fi
    25932427        done
    2594     if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null ; then
    2595         output=/boot/vmlinuz
    2596         echo "Schlomo, this one's for you." >> $LOGFILE
    2597     else
     2428        if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null ; then
     2429            output=/boot/vmlinuz
     2430            echo "Schlomo, this one's for you." >> $LOGFILE
     2431        else
    25982432            LogIt "Two or more possible kernels found. You may specify any one of them and the \n"
    2599         LogIt "boot disks will still work, probably. If one does not work, try another.\n"
     2433            LogIt "boot disks will still work, probably. If one does not work, try another.\n"
    26002434            LogIt "$possible_kernels\n"
    26012435            echo ""
    2602     fi
     2436        fi
    26032437    fi
    26042438    echo "$output" | tr -s ' ' '\n' | sort -u | tr '\n' ' '
    26052439}
    2606 
    2607 
    2608 
    26092440
    26102441
     
    26122443    local bigdir minidir_root noof_disks diskno list_of_files filename old_pwd progress
    26132444    local i retval noof_disks total_files list_of_devs
     2445
    26142446    bigdir=$1
    26152447    minidir_root=$2
     
    26352467    for filename in $list_of_files ; do
    26362468        AddFileToDir $filename $minidir_root $noof_disks
    2637     i=$?
    2638     if [ "$i" -gt "$noof_disks" ] ; then
    2639         noof_disks=$i
    2640         echo -en "\r\t\t\t\t\t\t($noof_disks disks)"
    2641     fi
    2642     if [ "$i" -eq "0" ] ; then
    2643         LogIt "Cannot add file $filename to minidir $minidir_root\n"
    2644         retval=$(($retval+1))
    2645     fi
     2469        i=$?
     2470        if [ "$i" -gt "$noof_disks" ] ; then
     2471            noof_disks=$i
     2472            echo -en "\r\t\t\t\t\t\t($noof_disks disks)"
     2473        fi
     2474        if [ "$i" -eq "0" ] ; then
     2475            LogIt "Cannot add file $filename to minidir $minidir_root\n"
     2476            retval=$(($retval+1))
     2477        fi
    26462478        progress=$(($progress+1))
    2647     echo -en "\r\t\t\t\t\t\t\t\t$(($progress*100/$total_files))% complete\r"
     2479        echo -en "\r\t\t\t\t\t\t\t\t$(($progress*100/$total_files))% complete\r"
    26482480    done
    26492481    cd $old_pwd
     
    26512483    rm -Rf $minidir_root/compressed
    26522484    if [ "$retval" -gt "0" ] ; then
    2653     return 0
    2654     else
    2655     return $noof_disks
    2656     fi
    2657 }
    2658 
     2485        return 0
     2486    else
     2487        return $noof_disks
     2488    fi
     2489}
    26592490
    26602491
    26612492TurnTgzIntoRdz() {
    26622493    local tgz_dir_fname rdz_fname ramdisksize tempfile mountpoint old_pwd nodes disksize kernelsize maxsize res currsize not_copied j k floppy_modules s w
     2494
    26632495    tgz_dir_fname=$1
    26642496    rdz_fname=$2
     
    26682500    maxsize=$(($disksize-$kernelsize))
    26692501    maxsize=$(($maxsize*2)); # to allow for compression of 50%
    2670     tempfile=$TMP_ROOT/temp.rd
    2671     mountpoint=$TMP_ROOT/mnt1
     2502    tempfile=$MONDOTMP/temp.rd
     2503    mountpoint=$MONDOTMP/mnt1
    26722504    res=0
    26732505    echo -en "..."
     
    26762508    mke2fs -b 1024 -m 1 -i 2048 -F $tempfile >> $LOGFILE 2>> $LOGFILE
    26772509
    2678     [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$
    2679     rm -f /tmp/mke2fs.$$
     2510    [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.log
     2511    rm -f $MONDOTMP/mke2fs.log
    26802512    echo -en "..."
    26812513    mkdir -p $mountpoint
     
    26842516    old_pwd=`pwd`
    26852517    cd $mountpoint
    2686 #    [ -e "$MINDI_LIB/memtest.img" ] && echo "Yep, this is a multi-function CD" > MULTIFUNC
    26872518    cp -Rdf $tgz_dir_fname/* . 2>> $LOGFILE >> $LOGFILE
    26882519    tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz"
     
    26922523    cd ..
    26932524
    2694 # add insmod.static and insmod.static.old if (a) they exist and (b) this is a 64-bit distro
    2695 #    if [ "`uname -a | grep x86`" ] || [ "`uname -a | grep amd64`" ] ; then
    2696 
    26972525    for w in insmod.static insmod.static.old ; do
    2698     s=`which $w 2> /dev/null`
    2699     if [ -e "$s" ] ; then
    2700         cp --parents -af $s .
    2701 #       LogIt "Copying $s to initrd"
    2702     fi
    2703     done
    2704 
    2705 #    fi
     2526        s=`which $w 2> /dev/null`
     2527        if [ -e "$s" ] ; then
     2528            cp --parents -af $s .
     2529        fi
     2530    done
    27062531
    27072532    mkdir -p tmp
     
    27102535        mkdir -p mnt/$w
    27112536    done
    2712     if [ "$RUN_AFTER_INITIAL_BOOT_PHASE" ] ; then
    2713     ReplaceIndividualLine sbin/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" sbin/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"
    2714     fi
     2537    #if [ "$RUN_AFTER_INITIAL_BOOT_PHASE" ] ; then
     2538        #ReplaceIndividualLine sbin/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" sbin/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"
     2539    #fi
    27152540    if [ "$RUN_AFTER_BOOT_PHASE_COMPLETE" ] ; then
    2716     ReplaceIndividualLine sbin/init `grep -n "#ABSORBENTANDYELLOWANDPOROUSISHE#" sbin/init | cut -d':' -f1` "$RUN_AFTER_BOOT_PHASE_COMPLETE"
     2541        ReplaceIndividualLine sbin/init `grep -n "#ABSORBENTANDYELLOWANDPOROUSISHE#" sbin/init | cut -d':' -f1` "$RUN_AFTER_BOOT_PHASE_COMPLETE"
    27172542    fi
    27182543
     
    27262551    old_pwd=`pwd`
    27272552    if [ "$YOUR_KERNEL_SUCKS" ] ; then
    2728         cd $TMP_ROOT
     2553        cd $MONDOTMP
    27292554        floppy_modules_path=lib/modules/$FAILSAFE_KVER
    27302555    else
     
    27502575        list_of_groovy_mods="$CDROM_MODS `WhichOfTheseModulesAreLoaded "$SCSI_MODS"`"
    27512576    fi
    2752     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     2577    if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    27532578        # For PXE boot
    27542579        list_of_groovy_mods="$list_of_groovy_mods $NET_MODS"
     
    27602585    for i in $floppy_modules ; do
    27612586        [ -e "$i" ] && s=`du -sk $i | cut -f1` || s=""
    2762         [ "$YOUR_KERNEL_SUCKS" ] && i=$TMP_ROOT/$i
     2587        [ "$YOUR_KERNEL_SUCKS" ] && i=$MONDOTMP/$i
    27632588        echo "Adding $i ($s KB) to the rootfs" >> $LOGFILE
    27642589        cp -df $i $mountpoint/ || LogIt "Unable to copy $i to $mountpoint\n"
    27652590        [ "`echo "$i" | grep -F ".gz"`" ] && gunzip -f $mountpoint/`basename $i`
    27662591    done
    2767 #    if [ -e "/dev/.devfsd" ] ; then
    2768 #   echo "Copying devfs stuff to ramdisk" >> $LOGFILE
    2769 #   for i in /dev /etc/devfsd.conf /etc/modules.devfs /lib/dev-state ; do
    2770 #       cp --parents -pRdf $i $mountpoint/ 2>> $LOGFILE
    2771 #   done
    2772 #    fi
    27732592    if [ ! -e "/sbin/devfsd" ] || [ "$disksize" -lt "2880" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then
    27742593        echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE
     
    27762595        [ "$disksize" -lt "2880" ] && echo "...because disksize = $disksize" >> $LOGFILE
    27772596        [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] && echo "...because kernel is failsafe" >> $LOGFILE
    2778 #        ls -l $mountpoint/sbin/devfsd &> /dev/null || Die "Can't find devfsd daemon on ramdisk"
    27792597        rm -f $mountpoint/sbin/devfsd
    27802598    fi
     
    27852603    if [ "`DidMondoCallMe`" ] ; then
    27862604        MakeMondoConfigFile $mountpoint/tmp/mondo-restore.cfg
    2787         cp -f $mountpoint/tmp/mondo-restore.cfg $MONDO_TMP &> /dev/null
    2788         cp -f $TMP_ROOT/mountlist.txt $mountpoint/tmp/ || Die "Cannot copy mountlist to ramdisk"
     2605        cp -f $mountpoint/tmp/mondo-restore.cfg $MONDOTMP &> /dev/null
     2606        cp -f $MONDOTMP/mountlist.txt $mountpoint/tmp/ || Die "Cannot copy mountlist to ramdisk"
    27892607        echo -en "$FILES_IN_FILELIST" > $mountpoint/tmp/FILES-IN-FILELIST
    27902608        echo -en "$LAST_FILELIST_NUMBER" > $mountpoint/tmp/LAST-FILELIST-NUMBER
     
    28102628
    28112629
    2812 
    28132630WhichOfTheseModulesAreLoaded() {
    28142631    local modname loaded_modules
    28152632    loaded_modules=" `lsmod | tr -s ' ' '\t' | cut -f1 | grep -Fvx "Modules" | tr '\n' ' '` "
    28162633    for modname in $1 ; do
    2817     [ "`echo "$loaded_modules" | grep -F " $modname "`" ] && echo "$modname"
    2818     done
    2819 }
    2820 
    2821 
     2634        [ "`echo "$loaded_modules" | grep -F " $modname "`" ] && echo "$modname"
     2635    done
     2636}
    28222637
    28232638
     
    28382653        diskno=$(($diskno+1))
    28392654        echo -n "..."
    2840     cp -pRdf * $minidir_root/all
     2655        cp -pRdf * $minidir_root/all
    28412656    done
    28422657    mkdir -p $minidir_root/all/tmp
     
    28452660    if [ "`DidMondoCallMe`" ] ; then
    28462661        for q in filelist.full.gz biggielist.txt ; do
    2847             [ ! -e "$MONDO_TMP/$q" ] && Die "Cannot find $MONDO_TMP/$q"
    2848             cp -pRdf $MONDO_TMP/$q tmp/
     2662            [ ! -e "$MONDOTMP/$q" ] && Die "Cannot find $MONDOTMP/$q"
     2663            cp -pRdf $MONDOTMP/$q tmp/
    28492664        done
    28502665        mkdir -p $minidir_root/all/tmp
     
    28612676
    28622677
    2863 
    2864 # BERLIOS: This function is wrong
    2865 # Should be recoded. Desactivated in between
    2866 
    2867 #ListUnsavedKernelModules() {
    2868     #local fname modules
    2869     #fname=/tmp/$RANDOM.$$.$RANDOM
    2870     #lsmod | sed -n '2,$s/ .*//p' > $fname
    2871     #modules=`sort $fname | uniq -d2 | tr '\n' ' '`
    2872     #rm -f $fname
    2873     #[ "$modules" ] && echo "Unsaved kernel modules: $modules" >> $LOGFILE
    2874 #}
    2875 
    2876 
    2877 
    2878 
    2879 
    28802678##############################################################################
    28812679#----------------------------------- main -----------------------------------#
    28822680##############################################################################
    28832681
    2884 
    2885 if [ "$1" = "-V" ] || [ "$1" = "-v" ] || [ "$1" = "--version" ] || [ "$1" = "-version" ] ; then
    2886     echo "mindi v$MINDI_VERSION"
    2887     exit 0
    2888 fi
    28892682
    28902683if [ "$1" = "-printvar" ] ; then
     
    29212714# modprobe.conf file is created in MakeModuleLoadingScript. AL041128.
    29222715if [ -d "/etc/modprobe.d" ] && [ `uname -r | cut -c1-3` == "2.6" ] ; then
    2923   TMPMODPROBE_FLAG="Y"
     2716    TMPMODPROBE_FLAG="Y"
    29242717else
    29252718    TMPMODPROBE_FLAG="N"
     
    29302723[ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep -E "2\.[46]" | cut -d' ' -f1`
    29312724AbortIfMkfsVfatMissing
    2932 ### BCO
     2725### BERLIOS
    29332726### Fix as it's not mandatory on ia64
    29342727if [ "$ARCH" = "ia64" ] ; then
     
    29382731    FindLiloBinary
    29392732fi
    2940 grep -F " $TMP_ROOT " /proc/mounts | grep -F tmpfs > /dev/null 2> /dev/null && TMP_ROOT=/home && LogIt "Changing TMP_ROOT to $TMP_ROOT because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason
    2941 rm -f /tmp/mindi_lo
     2733# BERLIOS: Remove as too dangerous and now useless
     2734#grep -F " $MONDOTMP " /proc/mounts | grep -F tmpfs > /dev/null 2> /dev/null && MONDOTMP=/home/tmpmondo && mkdir -p $MONDOTMP && LogIt "Changing MONDOTMP to $MONDOTMP because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason
    29422735trap "Aborted" SIGTERM
    29432736DONE="\r\t\t\t\t\t\t\t\tDone.         "
     
    29452738BIGNO=0
    29462739MAX_COMPRESSED_SIZE=1300
    2947 imagesdir=$CACHEDIR
    29482740kernelpath=""
    2949 MONDO_ROOT=/tmp/mindilinux/mondo-root
     2741MONDO_ROOT=$TMPMONDO/mondo-root
    29502742mkdir -p $MONDO_ROOT
    29512743
     
    29802772    if [ "$1" = "--findkernel" ] ; then
    29812773        res=`TryToFindKernelPath`
    2982 #    2> /dev/null`
    29832774        if [ "$res" = "" ] ; then
    2984             exit 1
     2775            MindiExit -1
    29852776        else
    29862777            echo "$res"
    2987             exit 0
     2778            MindiExit 0
    29882779        fi
    29892780    elif [ "$1" = "--makemountlist" ] ; then
    29902781        [ ! "$2" ] && Die "Please specify the output file"
    29912782        MakeMountlist $2
    2992         exit $?
    2993     elif [ "$1" = " --version" ] || [ "$1" = "-v" ] ; then
     2783        MindiExit $?
     2784    elif [ "$1" = "-V" ] || [ "$1" = "-v" ] || [ "$1" = "--version" ] || [ "$1" = "-version" ] ; then
    29942785        echo "Mindi v$MINDI_VERSION"
    2995         exit 0
     2786        MindiExit 0
    29962787    elif [ "$#" -ge "9" ] && [ "$1" = "--custom" ] ; then
    2997         TMP_ROOT=$2
    2998         MONDO_TMP=$2
    2999         imagesdir=$3
     2788        MONDOTMP=$2
     2789        BIDON=$3
    30002790        kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath=""
    30012791###
     
    30302820        if [ "${11}" ] ; then
    30312821            LILO_OPTIONS=""
    3032 #       LogIt "LILO will use conservative settings, to be compatible with older BIOSes."
     2822    #       LogIt "LILO will use conservative settings, to be compatible with older BIOSes."
    30332823        fi
    30342824        LAST_FILELIST_NUMBER=${12}
     
    30552845        fi
    30562846        [ "$CDRECOVERY" = "yes" ] && [ "$TAPEDEV" != "" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"
    3057         MONDO_ROOT=`echo $imagesdir | sed 's/\(.*\)\/.*/\1/'`
     2847        MONDO_ROOT=`echo $CACHEDIR | sed 's/\(.*\)\/.*/\1/'`
    30582848        [ "$MONDO_ROOT" = "" ] && Die "MONDO_ROOT is undefined"
    30592849    else
    30602850        echo "Syntax: mindi (--custom ....)" >> /dev/stderr
    3061         exit 1
     2851        MindiExit -1
    30622852    fi
    30632853fi
     
    30742864
    30752865[ -e "$iso_cfg_file" ] || Die "Cannot find $iso_cfg_file"
    3076 rm -Rf $TMP_ROOT/mindilinux/*
    3077 TMP_ROOT=$TMP_ROOT/mindilinux/$$
    3078 mkdir -p $TMP_ROOT
    30792866if [ ! "`DidMondoCallMe`" ] ; then
    30802867    LogIt "Mindi Linux mini-distro generator v$MINDI_VERSION\n"
     
    30992886if [ "$NOT_BOOT" != "" ] && [ "$NOT_BOOT" != "0" ] && [ "$NOT_BOOT" != "no" ] ; then
    31002887    LogIt "Just creating mondo-restore.cfg and a small all.tar.gz for Mondo. Nothing else.\n"
    3101     MakeMondoConfigFile $MONDO_TMP/mondo-restore.cfg
    3102     MakeMountlist $MONDO_TMP/mountlist.txt
    3103     mkdir -p $MONDO_TMP/small-all/tmp
    3104     cd $MONDO_TMP/small-all
    3105     cp -f $MONDO_TMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp || Die "Cannot copy small all.tar.gz"
    3106     tar -cv tmp | gzip -9 > $MONDO_TMP/all.tar.gz || Die "Cannot make small all.tar.gz"
     2888    MakeMondoConfigFile $MONDOTMP/mondo-restore.cfg
     2889    MakeMountlist $MONDOTMP/mountlist.txt
     2890    mkdir -p $MONDOTMP/small-all/tmp
     2891    cd $MONDOTMP/small-all
     2892    cp -f $MONDOTMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp || Die "Cannot copy small all.tar.gz"
     2893    tar -cv tmp | gzip -9 > $MONDOTMP/all.tar.gz || Die "Cannot make small all.tar.gz"
    31072894    sleep 2
    31082895    LogIt "Done. Exiting.\n"
    3109     exit 0
     2896    MindiExit 0
    31102897fi
    31112898
     
    31452932    LogIt "disks then it may still be a result of a problem with your kernel.\n"
    31462933    pwd=`pwd`
    3147     cd $TMP_ROOT
     2934    cd $MONDOTMP
    31482935    bzip2 -dc $MINDI_LIB/lib.tar.bz2 | tar -x || Die "Cannot unzip lib.tar.bz2"
    31492936    cd $pwd
    31502937    YOUR_KERNEL_SUCKS="Your kernel sucks"
    31512938fi
    3152 echo -e "Mindi's temp dir = $TMP_ROOT \nMindi's output dir=$imagesdir" >> $LOGFILE
     2939echo -e "Mindi's temp dir = $MONDOTMP \nMindi's output dir=$CACHE_LOC" >> $LOGFILE
    31532940[ "$(($RANDOM%64))" -eq "0" ] && LogIt "Dude, I've looked inside your computer and it's really dusty...\n"
    3154 rm -f /tmp/mindi.err.*.tgz
    31552941
    31562942[ "$YOUR_KERNEL_SUCKS" ] && [ ! "$FAILSAFE_KVER" ] && Die "Please install mindi-kernel package. You need it. Go to http://www.mondorescue.org and download it, then install it."
     
    31582944rm -f $CACHEDIR/{*img,*gz,*iso}
    31592945
    3160 rm -f $imagesdir/mindi-*.img $imagesdir/[0-9]*.tar.gz $imagesdir/mindi.iso
    3161 needlist=$TMP_ROOT/what-we-need.txt
    3162 bigdir=$TMP_ROOT/bigdir
    3163 minidir_root=$TMP_ROOT/minidir
    3164 mkdir -p $minidir_root
    3165 mkdir -p $bigdir/usr/bin
    3166 tardir=$TMP_ROOT/tardir
    3167 
    3168 lines=`grep -vx " *#.*" $MINDI_CONF/deplist.txt $DEPLIST_DIR/* | grep -vx "" | wc -l`
    3169 cat $MINDI_CONF/deplist.txt $DEPLIST_DIR/* | GenerateGiantDependencyList $needlist $lines
    3170 res=$?
    3171 if [ "$YOUR_KERNEL_SUCKS" ]; then
    3172     pwd=`pwd`
    3173     cd $TMP_ROOT
    3174     for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do
    3175         cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir"
    3176         if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
    3177             cp --parents -pRdf $i $bigdir
    3178         else
    3179             ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
    3180             BIGNO=$(($BIGNO+1))
    3181         fi
    3182     done
    3183     for i in $EXTRA_MODS ; do
    3184         j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null`
    3185         [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE
    3186         for k in $j ; do
    3187             if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
    3188                     cp --parents -pRdf $k $bigdir
    3189         else
    3190                 ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
    3191                 BIGNO=$(($BIGNO+1))
    3192             fi
    3193             echo "Added failsafe module $k to ramdisk" >> $LOGFILE
    3194         done
    3195     done
    3196     cd $pwd
    3197 else
    3198     ListKernelModulePaths >> $needlist
    3199 fi
    3200 if [ "$res" -ne "0" ] ; then
    3201     Die "You have $res file`PluralOrNot $res` present in dependency list\nbut absent from filesystem."
    3202 fi
    3203 FindAndAddUserKeyboardMappingFile
    3204 mkdir -p $bigdir/tmp
    3205 if [ "`DidMondoCallMe`" ] ; then
    3206     MakeMondoConfigFile $TMP_ROOT/mondo-restore.cfg
    3207     cp -f $TMP_ROOT/mondo-restore.cfg $bigdir/tmp &> /dev/null
    3208     cp -f $TMP_ROOT/mondo-restore.cfg $CACHEDIR &> /dev/null
    3209 fi
    3210 [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO
    3211 DropOptimizedLibraries $needlist $bigdir
    3212 echo -en "Assembling dependency files"
    3213 CopyDependenciesToDirectory < $needlist $bigdir
    3214 
    3215 # also copy io.sys and msdos.sys, if we can find them
    3216 for i in `mount | cut -d' ' -f3` ; do
    3217     for j in io.sys msdos.sys ; do
    3218         [ -e "$i/$j" ] && cp -f $i/$j $bigdir
    3219     done
    3220 done
    3221 
    3222 # master boot record, too
    3223 i=`cat $MONDO_TMP/BOOTLOADER.DEVICE 2> /dev/null`
    3224 if [ "$i" ] ; then
    3225     LogIt "Backing up $i's MBR\n"
    3226     dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
    3227 # < < E O F
    3228     sleep 1
    3229     sync
    3230 #        [ "$?" -ne "0" ] && echo "Failed to save $i's MBR to bigdir" >> $LOGFILE
    3231     j=$i
    3232     [ -h "$j" ] && j=`ResolveSoftlink $j`
    3233     LogIt "Creating /dev/boot_device ($j)\n"
    3234     mkdir -p $bigdir/dev
    3235     cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk"
    3236 fi
    3237 
    3238 # more stuff
    3239 #    cp -f $MINDI_LIB/embleer* $bigdir
    3240 old_pwd=`pwd`
    3241 cd $bigdir
    3242 
    3243 [ -e "$MINDI_LIB/aux-tools" ] || Die "aux-tools not found in Mindi's home dir. Do you have multiple copies of Mindi lying around? Please delete them. No, don't e-mail me and ask how. ;) Use 'rm'."
    3244 cp -Rdf $MINDI_LIB/aux-tools/* . 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping aux-tools\n"
    3245 if [ -e "$MINDI_LIB/x11-tools.tgz" ] ; then
    3246     tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
    3247 fi
    3248 if [ -e "$MONDO_SHARE/restore-scripts" ] ; then
    3249     cp -Rdf $MONDO_SHARE/restore-scripts/* . 2>> $LOGFILE
    3250     [ "$?" -ne "0" ] && [ "`DidMondoCallMe`" ] && Die "Cannot find/install $MONDO_SHARE/restore-scripts"
    3251 fi
    3252 [ -d "/lib/dev-state" ] && cp --parents -pRdf /lib/dev-state .
    3253 cd $old_pwd
    3254 echo -e "$DONE"
    3255 TOTAL_BIGDIR_SIZE=`du -sk $bigdir | cut -f1`
    3256 SplitDirectoryIntoMinidirs $bigdir $minidir_root
     2946PrepareDataDiskImages $CACHEDIR
    32572947noof_disks=$?
    32582948[ "$noof_disks" -eq "0" ] && Die "Too much stuff!"
     
    32662956cat $minidir_root/$noof_disks/tmp/mountlist.txt >> $LOGFILE
    32672957ZipMinidirsIntoTarballs $minidir_root $tardir $noof_disks
    3268 CreateDataDiskImagesFromTarballs $tardir $imagesdir $noof_disks
     2958CreateDataDiskImagesFromTarballs $tardir $CACHEDIR $noof_disks
    32692959FRIENDLY_OUTSTRING="Boot and data disk images were created."
    32702960# One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images
     
    32802970if [ "$USE_LILO" = "yes" ] ; then
    32812971    if [ "$ARCH" = "ia64" ] ; then
    3282         PrepareBootDiskImage_LILO $imagesdir $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
    3283     else
    3284         if ! PrepareBootDiskImage_LILO $imagesdir 1722 $kernelpath $ramdisk_size ; then
     2972        PrepareBootDiskImage_LILO $CACHE_LOC $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
     2973    else
     2974        if ! PrepareBootDiskImage_LILO $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
    32852975            LogIt "Warning - failed to create 1.72MB boot image. Please reduce your kernel's size\n"
    32862976            LogIt "if you want to make a 1.72MB floppy disk.\n"
    32872977        fi
    3288         if ! PrepareBootDiskImage_LILO $imagesdir 2880 $kernelpath $ramdisk_size ;  then
     2978        if ! PrepareBootDiskImage_LILO $CACHE_LOC 2880 $kernelpath $ramdisk_size ;  then
    32892979            LogIt "Warning - failed to create 2.88MB floppy disk image.\n"
    32902980            LogIt "Please reduce your kernel's size\n"
    32912981            LogIt "if you want to make a 2.88MB floppy disk.\n"
    3292             PrepareBootDiskImage_LILO $imagesdir 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
     2982            PrepareBootDiskImage_LILO $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
    32932983        fi
    32942984    fi
    32952985else
    3296     if ! PrepareBootDiskImage_SYSLINUX $imagesdir 1722 $kernelpath $ramdisk_size ; then
     2986    if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
    32972987        LogIt "Warning - failed to create 1.72MB boot image. Please reduce your kernel's size\n"
    32982988        LogIt "if you want to make a 1.72MB floppy disk.\n"
    3299         if ! PrepareBootDiskImage_SYSLINUX $imagesdir 2880 $kernelpath $ramdisk_size ; then
     2989        if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 2880 $kernelpath $ramdisk_size ; then
    33002990            LogIt "Warning - failed to create 2.88MB floppy disk image.\n"
    33012991            LogIt "Please reduce your kernel's size\n"
    33022992            LogIt "if you want to make a 2.88MB floppy disk.\n"
    3303             PrepareBootDiskImage_SYSLINUX $imagesdir 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
     2993            PrepareBootDiskImage_SYSLINUX $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
    33042994        fi
    33052995    fi
    33062996fi
    3307 
    3308 
    33092997
    33102998[ -e "$MINDI_LIB/memtest.img" ] && BOOT_MEDIA_MESSAGE="$BOOT_MEDIA_MESSAGE\n\
    33112999...Or type 'memtest' to test your PC's RAM thoroughly.\n"
    33123000
    3313 
    33143001if [ ! "`DidMondoCallMe`" ] ; then
    3315     ListImagesForUser $imagesdir
     3002    ListImagesForUser $CACHE_LOC
    33163003    boot_dev=/dev/fd0u1722
    33173004    [ ! -e "$boot_dev" ] && mknod $boot_dev b 2 60
     
    33193006    [ ! -e "$boot_dev" ] && Die "Will you PLEASE tell your distribution maker to create the 1.72MB devices in /dev?"
    33203007    if [ "$PROMPT_WRITE_BOOT_FLOPPIES" = "yes" ]; then
    3321         echo -en "Would you like to create boot+data floppy disks now (y/n) ?"
    3322         read i
    3323         [ "$i" != "y" ] && [ "$i" != "Y" ] && return
    3324         mount | fgrep /dev/fd > /dev/null && Die "Please unmount your floppies first."
    3325         echo "WARNING! THIS WILL ERASE YOUR FLOPPY DISKS."
    3326         [ ! -e "$boot_dev" ] && Die "Cannot find $boot_dev - is your Linux distro broken?"
    3327         [ ! -e "$FDDEVICE" ] && Die "Cannot find $FDDEVICE - is your Linux distro broken?"
    3328         i=`find $imagesdir -type f | fgrep "/mindi-root.1" 2> /dev/null`
    3329         j=`find $imagesdir -type f | fgrep "/mindi-boot" | egrep -v '2880|5760'`
    3330         if [ "$i" ] ; then
    3331             CopyImageToDisk $j $FDDEVICE "boot disk"
    3332             CopyImageToDisk $i $FDDEVICE "root disk"
    3333         else
    3334             CopyImageToDisk $j $boot_dev "boot/root disk"
    3335         fi
    3336         count=1
    3337         for i in `find $imagesdir | fgrep mindi-data` ; do
    3338             CopyImageToDisk $i $FDDEVICE "data disk #$count"
    3339             count=$(($count+1))
    3340         done
    3341     fi
    3342     OfferToMakeBootableISO $imagesdir
     3008        OfferToCopyImagesToDisks $CACHEDIR $boot_dev $FDDEVICE
     3009    fi
     3010    OfferToMakeBootableISO $CACHE_LOC
    33433011    LogIt "Finished.\n"
    33443012elif [ "$TAPEDEV" ] ; then
    33453013    rm -f $CACHEDIR/{*img,*gz,*iso}
    3346     OfferToMakeBootableISO $imagesdir
    3347     if [ -e "$imagesdir/all.tar.gz" ] ; then
    3348         cp -f $imagesdir/all.tar.gz $MONDO_TMP/
    3349     else
    3350     Die "Cannot find all.tar.gz, to be written to tape"
     3014    OfferToMakeBootableISO $CACHE_LOC
     3015    if [ -e "$CACHE_LOC/all.tar.gz" ] ; then
     3016        cp -f $CACHE_LOC/all.tar.gz $MONDOTMP/
     3017    else
     3018        Die "Cannot find all.tar.gz, to be written to tape"
    33513019    fi
    33523020else
    3353     OfferToMakeBootableISO $imagesdir
     3021    OfferToMakeBootableISO $CACHE_LOC
    33543022fi
    3355 [ "$TMP_ROOT" != "/tmp" ] && rm -Rf $TMP_ROOT
    33563023# cleanup
    3357 rm -f /tmp/mountlist.txt.$$ $FDISKLOG /tmp/mindilinux
     3024rm -Rf $MONDOTMP $FDISKLOG
    33583025LogIt "$FRIENDLY_OUTSTRING\n"
    3359 #ListUnsavedKernelModules
    33603026for mtpt in $FLOPPY_WAS_MOUNTED ; do
    33613027    mount $mtpt
    33623028done
    3363 echo "Mindi is exiting" >> $LOGFILE
    3364 echo "End date : `date`" >> $LOGFILE
    3365 exit 0
     3029MindiExit 0
Note: See TracChangeset for help on using the changeset viewer.