Changeset 925


Ignore:
Timestamp:
Nov 13, 2006, 10:14:22 AM (11 years ago)
Author:
bruno
Message:
  • tabs nor correct in mindi
  • MONDOTMP used everywhere in mindi (TMP_ROOT removed) for temp files
  • Images now created under /var/cache/mindi - CACHE_LOC var
  • new MindiExit? function added and used everywhere
  • HackMountlist? and HackAwk? removed
Location:
branches/stable/mindi
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/deplist.txt

    r872 r925  
    4646lvmiopversion lvchange lvcreate lvdisplay lvextend lvmchange lvmcreate_initrd lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvscan pvchange pvcreate pvdata pvdisplay pvmove pvscan vgcfgbackup vgcfgrestore vgchange vgck vgcreate vgdisplay vgexport vgextend vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgscan vgsplit liblvm lvm lvm-10 /etc/lvm/lvm.conf
    4747#------------------------------------------------------------------------------
     48#
     49# Proliant extended support if available
     50# Look at http://www.hp.com/servers/sstoolkit
     51conrep cpqacuxe hponcfg
     52lshw
  • branches/stable/mindi/mindi

    r884 r925  
    1414
    1515### Which arch are we on (useful for ia64 port)
    16 export ARCH=`/bin/arch`
     16ARCH=`/bin/arch`
    1717
    1818ADDITIONAL_BOOT_PARAMS="acpi=off apm=off devfs=nomount noresume selinux=0 barrier=off"
    1919
    20 RUN_AFTER_INITIAL_BOOT_PHASE="echo \"Who lives in a pineapple under the sea?\" > /tmp/spongebob.squarepants.txt"
     20#RUN_AFTER_INITIAL_BOOT_PHASE="echo \"Who lives in a pineapple under the sea?\" > /tmp/spongebob.squarepants.txt"
    2121    # after booting from floppy/CD image but before
    2222    # accessing auxiliary data disks (or the rest of
     
    4343fi
    4444
     45# Temporary directory for mindi
     46TMPDIR=/tmp
     47
    4548EXTRA_SPACE=24576         ; # increase if you run out of ramdisk space
    4649IA64_BOOT_SIZE=8192       ; # size of the ia64 boot disk
    47 TMP_ROOT=/tmp
    4850WRITE_BOOT_FLOPPIES="yes" ; # do you want to be propted to write floppy images
    4951PROMPT_WRITE_BOOT_FLOPPIES="yes"
     
    6062    # you want to use your own kernel, or the supplied default.
    6163    # If "yes" mindi will automatically use your own kernel.
    62 MINDI_CONFIG="$MINDI_CONF/mindi.conf"
    63 if [ -f $MINDI_CONFIG ]; then
    64     . $MINDI_CONFIG
    65 fi
     64
    6665MY_FSTAB=/etc/fstab
    6766FLOPPY_MODS="ide-floppy floppy"
     
    7675NET_MODS="sunrpc nfs nfs_acl lockd loop mii 3c59x e100 bcm5700 bnx2 e1000 eepro100 ne2k-pci tg3 pcnet32 8139cp 8139too 8390 vmxnet"
    7776EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 lvm-mod dm-mod jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd"
     77
    7878LOGFILE=/var/log/mindi.log
    7979FDDEVICE=/dev/fd0             ; # 1.44MB floppy #0
    80 CACHE_LOC=/var/cache/mondo-archive
     80CACHE_LOC=/var/cache/mindi
    8181FORCE_DUAL_FLOPPIES=no
    82 
    8382BOOT_MEDIA_MESSAGE="\
    8483To format and restore all files automatically, type 'nuke' <enter>.\n\
     
    9695a PC whose CD-ROM drive tray would be damaged if it unexpectedly ejected.\n\
    9796"
    98 
     97FDISK=$MINDI_SBIN/parted2fdisk
     98FDISKLOG=$MONDOTMP/parted2fdisk.log
     99touch $FDISKLOG
     100
     101# Using a config file allow to overwrite some values
     102MINDI_CONFIG="$MINDI_CONF/mindi.conf"
     103if [ -f $MINDI_CONFIG ]; then
     104    . $MINDI_CONFIG
     105fi
     106
     107# Now we can create what we nedd
     108MONDOTMP=`mktemp -d $TMPDIR/mondobuild.XXXXXXXXXX`
     109mkdir -p $MONDOTMP
     110mkdir -p $CACHE_LOC
    99111# ----------------------------------------------------------------------------
    100 
    101 
    102 
    103112
    104113
     
    107116    Die "Program is terminating in response to signal received from OS/user"
    108117}
    109 
    110118
    111119
     
    122130    done
    123131    if [ -e "$MINDI_LIB/memtest.img" ] ; then
    124 #        echo -en "label memtest\n  kernel memtest.bin\n\n"
    125132        echo -en "label memtest\n  kernel memdisk\n  append initrd=memtest.img\n\n"
    126 #        echo "Yep, this is a multi-function CD" > $2/MULTIFUNC
    127     fi
    128 }
    129 
     133    fi
     134}
    130135
    131136
     
    136141    which gawk > /dev/null 2> /dev/null && AWK=`which gawk 2>/dev/null` || AWK="`which awk 2>/dev/null`"
    137142    if which awk &> /dev/null ; then
    138     if ! which gawk &> /dev/null ; then
    139         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"
    140     fi
     143        if ! which gawk &> /dev/null ; then
     144            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"
     145        fi
    141146    fi
    142147    which mke2fs > /dev/null 2> /dev/null || Die "Please put mke2fs in system path"
    143     which afio > /dev/null 2> /dev/null || LogIt "afio not found... mindi doesn't need afio but Mondo does... Be aware...\n"
    144     [ ! -e "/etc/issue.net" ] && > /etc/issue.net
    145     FDISK=$MINDI_SBIN/parted2fdisk
    146     FDISKLOG=/tmp/parted2fdisk.log
    147     touch $FDISKLOG
    148148    [ ! -e "$FDISK" ] && Die "Cannot find (s)fdisk"
    149149}
    150 
    151150
    152151
     
    160159
    161160
    162 
    163 
    164 
    165161Aborted() {
    166162    trap SIGHUP SIGTERM SIGTRAP SIGINT
    167     [ "$imagesdir" != "" ] && rm -f $imagesdir/mindi*img $imagesdir/*gz $imagesdir/mindi.iso
     163    [ "$CACHE_LOC" != "" ] && rm -f $CACHE_LOC/mindi*img $CACHE_LOC/*gz $CACHE_LOC/mindi.iso
    168164    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/*
    169165    Die "User abort."
     
    174170    [ -e "$1" ] && echo -en "$2 `cat $1`\n" >> $3
    175171}
    176 
    177172
    178173
     
    183178    noof_disks=$3
    184179
    185 #    diskno=1
    186180    diskno=$noof_disks
    187181    mkdir -p $minidir_root/$diskno
    188182    [ "$LAST_COMPRESSED_SIZE" = "" ] && LAST_COMPRESSED_SIZE=0
    189183    if [ ! -e "$filename" ] ; then
    190     if [ -h "$filename" ] ; then
    191         cp --parents -pRdf $filename $minidir_root/$diskno
    192         return $noof_disks
    193     else
    194         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?"
    195     fi
    196     fi
    197 # move to the disk that has room on it (or end up using the last, if all full)
     184        if [ -h "$filename" ] ; then
     185            cp --parents -pRdf $filename $minidir_root/$diskno
     186            return $noof_disks
     187        else
     188            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?"
     189        fi
     190    fi
     191
     192    # move to the disk that has room on it (or end up using the last, if all full)
    198193    while [ "$diskno" -lt "40" ] ; do
    199     mkdir -p $minidir_root/$diskno
     194        mkdir -p $minidir_root/$diskno
    200195        filesize=`du -sk $filename | cut -f1`
    201     cp --parents -Rdf $filename $minidir_root/$diskno
     196        cp --parents -Rdf $filename $minidir_root/$diskno
    202197        if [ "$filesize" -le "4" ] ; then
    203198            siz=$filesize
     
    209204            siz=$(($siz-2));# to allow for sectors & the fact that they round up
    210205        fi
    211     [ ! "$siz" ] && siz=4
    212     [ "$siz" -lt "0" ] && siz=0
     206        [ ! "$siz" ] && siz=4
     207        [ "$siz" -lt "0" ] && siz=0
    213208        LAST_COMPRESSED_SIZE=$(($LAST_COMPRESSED_SIZE+$siz))
    214     [ "$LAST_COMPRESSED_SIZE" -le "$MAX_COMPRESSED_SIZE" ] &&return $diskno
    215     echo "disk=$diskno siz=$LAST_COMPRESSED_SIZE" >> $LOGFILE
    216     LAST_COMPRESSED_SIZE=0
    217     rm -f $minidir_root/$diskno/$filename
     209        [ "$LAST_COMPRESSED_SIZE" -le "$MAX_COMPRESSED_SIZE" ] &&return $diskno
     210        echo "disk=$diskno siz=$LAST_COMPRESSED_SIZE" >> $LOGFILE
     211        LAST_COMPRESSED_SIZE=0
     212        rm -f $minidir_root/$diskno/$filename
    218213        diskno=$(($diskno+1))
    219214    done
    220215    return 0 ; # failed
    221216}
    222 
    223 
    224217
    225218
     
    255248    fi
    256249    for included_item in $included_list ; do
    257     if [ ! -e "$included_item" ] ; then
     250        if [ ! -e "$included_item" ] ; then
    258251            sss=`find $KEYDIR/keymaps | grep -F "${included_item}.inc"`
    259         [ "$sss" = "" ] && sss=`find $KEYDIR/keymaps | grep -F "$included_item"`
    260         for ii in $sss ; do
     252            [ "$sss" = "" ] && sss=`find $KEYDIR/keymaps | grep -F "$included_item"`
     253            for ii in $sss ; do
    261254                [ -e "$ii" ] && AddKeyboardMappingFile $ii
    262         done
    263     else
    264         AddKeyboardMappingFile $included_item
    265     fi
    266     done
    267 }
    268 
    269 
    270 
    271 
    272 
     255            done
     256        else
     257            AddKeyboardMappingFile $included_item
     258        fi
     259    done
     260}
    273261
    274262
     
    284272
    285273    sliceno=0
    286     scratchfile=$TMP_ROOT/blah.$$.dat
     274    scratchfile=$MONDOTMP/blah.$$.dat
    287275    cp -f $filename $scratchfile || Die "CUACF -- cannot copy $filename to $scratchfile - did you run out of disk space?"
    288276    [ "`head $scratchfile -n1 | grep -F "bin/sh"`" != "" ] && StripComments $scratchfile "-$filename-"
    289277    [ "`echo "$filename" | grep -F "etc/termcap"`" != "" ] && StripComments $scratchfile "-$filename-"
    290278    if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] ; then
    291     mv $scratchfile $scratchfile.gz
    292     gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz\n"
    293     filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'`
     279        mv $scratchfile $scratchfile.gz
     280        gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz\n"
     281        filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'`
    294282    fi
    295283    filesize=`du -sk $scratchfile | cut -f1`
     
    332320
    333321
    334 
    335 
    336322CopyDependenciesToDirectory() {
    337323    local outdir incoming fname filesize counter
     
    341327    counter=0
    342328    while [ "$incoming" != "" ] ; do
    343     if [ -d "$incoming" ] ; then
     329        if [ -d "$incoming" ] ; then
    344330            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir
    345331        elif [ -e "$incoming" ] ; then
     
    350336            else
    351337                cp --parents -Rdf $incoming $outdir || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
    352         if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then
    353             gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming\n"
    354         fi
    355         [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
    356             fi
    357         counter=$(($counter+1))
    358         if [ "$counter" -ge "5" ] ; then
    359         counter=0
    360             echo -en "."
    361         fi
     338                if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then
     339                    gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming\n"
     340                fi
     341                [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
     342            fi
     343            counter=$(($counter+1))
     344            if [ "$counter" -ge "5" ] ; then
     345                counter=0
     346                echo -en "."
     347            fi
    362348        fi
    363349        incoming=`ReadLine`
    364350    done
    365351}
    366 
    367352
    368353
     
    376361    echo -en "Formatting disk..."
    377362    if which fdformat > /dev/null ; then
    378     fdformat -n $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
     363        fdformat -n $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
    379364    elif which superformat > /dev/null ; then
    380     superformat $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
    381     else
    382     Die "Please install either fdformat or superformat."
     365        superformat $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"
     366    else
     367        Die "Please install either fdformat or superformat."
    383368    fi
    384369    echo -en "\rWriting $comment"
    385370    if echo $image | grep "mindi-[r|b]oot\.1440" &> /dev/null ; then
    386     cat $image > $dev &
    387     else
    388     dd if=$image of=$dev &> /dev/null &
     371        cat $image > $dev &
     372    else
     373        dd if=$image of=$dev &> /dev/null &
    389374    fi
    390375    procno=$!
     
    400385
    401386
    402 
    403 
    404 
    405387CountItemsIn() {
    406388    local r
     
    413395
    414396
    415 
    416 
    417 
    418 
    419397CreateDataDiskImagesFromTarballs() {
    420398    local tardir outdir diskno noof_disks kp
     
    427405    echo -en "Creating data disk "
    428406    while [ "$diskno" -le "$noof_disks" ] ; do
    429     echo -en "#$diskno..."
    430     cp -f $tardir/$diskno.tar.gz $outdir || LogIt "[line 424] Cannot copy $tardir/$diskno.tar.gz to $outdir\n"
     407        echo -en "#$diskno..."
     408        cp -f $tardir/$diskno.tar.gz $outdir || LogIt "[line 424] Cannot copy $tardir/$diskno.tar.gz to $outdir\n"
    431409        CreateOneDataDiskImage $tardir/$diskno.tar.gz $outdir/mindi-data-$diskno.img $diskno $noof_disks
    432410        diskno=$(($diskno+1))
     
    446424    noof_disks=$4
    447425
    448     mountpoint=$TMP_ROOT/mountpoint.$$
     426    mountpoint=$MONDOTMP/mountpoint.$$
    449427    mkdir -p $mountpoint
    450428    dd if=/dev/zero of=$imagefile bs=1k count=1440 &> /dev/null || LogIt "Cannot dd (CODI)\n"
    451     mke2fs -N 12 -F $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$
    452     [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$
    453     rm -f /tmp/mke2fs.$$
     429    mke2fs -N 12 -F $imagefile > $MONDOTMP/mke2fs.$$ 2>> $MONDOTMP/mke2fs.$$
     430    [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.$$
     431    rm -f $MONDOTMP/mke2fs.$$
    454432    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."
    455433    mv $tarball $mountpoint/
    456434    if [ "$?" -ne "0" ] ; then
    457     umount $mountpoint
    458     Die "Tarball $tarball is too big for disk! (CODI)\nTell Dev Team to adjust MAX_COMPRESSED_SIZE"
     435        umount $mountpoint
     436        Die "Tarball $tarball is too big for disk! (CODI)\nTell Dev Team to adjust MAX_COMPRESSED_SIZE"
    459437    fi
    460438    [ "$diskno" -eq "$noof_disks" ] && echo "This is the last disk ($diskno=$noof_disks)" >> $mountpoint/LAST-DISK
     
    462440    rmdir $mountpoint || LogIt "Cannot rmdir (CODI)\n"
    463441}
    464 
    465442
    466443
     
    474451}
    475452
    476 
    477 
     453# Last function called before exiting
     454# Parameter is exit code value
     455MindiExit  {
     456    local my_partitions
     457
     458    echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE
     459    echo "End date : `date`" >> $LOGFILE
     460
     461    sync
     462    cd /
     463
     464    # Unmount whtat could remain mounted
     465    my_partitions=`mount | grep -F $$ | cut -f1 -d' '`
     466    [ "$my_partitions" != "" ] && umount $my_partitions
     467    # Clean temporary files
     468    rm -Rf $MONDOTMP $FDISKLOG
     469    exit $1
     470}
    478471
    479472Die() {
    480     local my_partitions i
    481     echo "MINDI_VERSION is $MINDI_VERSION" >> $LOGFILE
    482     echo "End date : `date`" >> $LOGFILE
     473    local i
    483474    if [ "$1" = "" ] ; then
    484475        LogIt "Fatal error\n"
     
    486477        LogIt "Fatal error. $1\n"
    487478    fi
    488     sync
    489     cd /
    490 
    491     my_partitions=`mount | grep -F $$ | cut -f1 -d' '`
    492     [ "$my_partitions" != "" ] && umount $my_partitions
    493     [ "$TMP_ROOT" != "/tmp" ] && rm -Rf $TMP_ROOT
    494     cd /tmp
    495     mkdir -p mindi.err
    496     for i in /etc/fstab /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log /tmp/mountlist.txt.$$ $FDISKLOG ; do
    497         [ -e "$i" ] && cp -f $i mindi.err/
    498     done
    499     rm -f mindi.err.*.tgz
    500     tar -cf - mindi.err | gzip -9 > mindi.err.$$.tgz
    501     rm -Rf mindi.err /tmp/mountlist.txt.$$ mindilinux $FDISKLOG
    502     LogIt "Please e-mail a copy of /tmp/mindi.err.$$.tgz to the mailing list.\n"
     479
     480    # Creates a tar file containing all required files
     481    for i in /etc/fstab /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log $FDISKLOG ; do
     482        [ -e "$i" ] && cp -f $i $MONDOTMP
     483    done
     484    rm -f $TMPDIR/mindi.err.*.tgz
     485    tar -cf - $MONDOTMP | gzip -9 > $TMPDIR/mindi.err.$$.tgz
     486    LogIt "Please e-mail a copy of $TMPDIR/mindi.err.$$.tgz to the mailing list.\n"
    503487    LogIt "See http://www.mondorescue.org for more information.\n"
    504488    LogIt "WE CANNOT HELP unless you enclose that file.\n"
    505     exit 1
    506 }
    507 
    508 
     489    MindiExit -1
     490}
    509491
    510492
     
    537519        mv -f $filelist.tmp $filelist
    538520    done
    539     sort $filelist | $AWK '{ print $1; }' | uniq > $filelist.tmp
     521    $AWK '{ print $1; }' $filelist | sort -u > $filelist.tmp
    540522    mv -f $filelist.tmp $filelist
    541523    echo -e "$DONE"
    542524}
    543 
    544 
    545525
    546526
     
    623603
    624604
    625 
    626 
    627 
    628605FindHomeOfMindiAndMondo() {
    629606    [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     
    633610    echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    634611    echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
    635     mkdir -p $CACHE_LOC
    636 }
    637 
    638 
    639 
     612}
    640613
    641614
     
    651624
    652625
    653 
    654626FindLiloBinary() {
    655627    if which lilo &> /dev/null ; then
    656     if which lilo.real > /dev/null 2> /dev/null ; then
    657         LILO_EXE=lilo.real
    658         LogIt "lilo.real found; will be used instead of lilo (*grumble* *mutter*)\n"
    659     else
    660         LILO_EXE=lilo
    661     fi
    662     $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. :)"
    663     else
    664     LILO_EXE=`which false`
    665     fi
    666 }
     628        if which lilo.real > /dev/null 2> /dev/null ; then
     629            LILO_EXE=lilo.real
     630            LogIt "lilo.real found; will be used instead of lilo (*grumble* *mutter*)\n"
     631        else
     632            LILO_EXE=lilo
     633        fi
     634        $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. :)"
     635    else
     636        LILO_EXE=`which false`
     637    fi
     638}
     639
    667640
    668641FindELiloBinary() {
    669642    if which elilo &> /dev/null ; then
    670     LILO_EXE=elilo
    671     else
    672     LILO_EXE=`which false`
     643        LILO_EXE=elilo
     644    else
     645        LILO_EXE=`which false`
    673646    fi
    674647}
     
    676649
    677650FixPathIfBroken() {
    678         if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then
     651    if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then
    679652        PATH=$PATH:/sbin:/usr/sbin
    680653        export PATH
     
    684657    fi
    685658}
    686 
    687659
    688660
     
    694666    if [ "`strings $i 2> /dev/null | head -n1`" = "LILO" ] ; then
    695667        out="$out $i"
    696             last="$i"
     668        last="$i"
    697669    fi
    698670    done
    699671    echo "$last"
    700672}
    701 
    702673
    703674
     
    706677    pwd=`pwd`
    707678    if [ "$YOUR_KERNEL_SUCKS" ] ; then
    708         cd $TMP_ROOT
     679        cd $MONDOTMP
    709680    else
    710681        cd /
     
    724695
    725696
    726 
    727697GenerateGiantDependencyList() {
    728698    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
     
    730700    echo -en "Analyzing dependency requirements"
    731701    outfile=$1
    732     tempfile=$TMP_ROOT/$$.txt
     702    tempfile=$MONDOTMP/$$.txt
    733703    incoming=`ReadLine`
    734704
     
    739709    while [ "$incoming" != "" ] ; do
    740710        if echo "$incoming" | grep -x " *#.*" &> /dev/null ; then
    741 #           echo "Skipping '$incoming'"
    742711            incoming=`ReadLine`
    743712            continue
     
    746715            break
    747716        fi
    748 #       echo "Processing '$incoming'."
    749 #       sleep 1
    750717        filelist=`GenerateListForFile "$incoming"`
    751718        r=$?
     
    838805    noof_lines=`cat $tempfile | wc -l`
    839806    for fname in `cat $tempfile` ; do
    840         tempdepfile=`mktemp /tmp/mindilinux/tempdepfile.XXXXXX`
    841         LocateDeps $fname > $tempdepfile
    842     echo "$fname" >> $outfile.pre
    843         cat $tempdepfile >> $outfile.pre
    844 #        echo "$fname ----> dependencies:-" >> $LOGFILE
    845 #        cat $tempdepfile | tr -s '/' '/' | sort -u >> $LOGFILE
    846 #        echo -en "(end of deplist of $fname)\n\n" >> $LOGFILE
    847         rm -f $tempdepfile
    848     progress=$(($progress+1))
     807        echo "$fname" >> $outfile.pre
     808        LocateDeps $fname >> $outfile.pre
     809        progress=$(($progress+1))
    849810        echo -en "\r\t\t\t\t\t\t\t\t"
    850811        i=$(($progress*100))
     
    852813        echo -en "$i"
    853814        echo -en "%"
    854     modres=$(($progress%4))
     815        modres=$(($progress%4))
    855816        [ "$modres" -eq "0" ] && echo -en "\t/"
    856817        [ "$modres" -eq "1" ] && echo -en "\t-"
     
    859820    done
    860821    if [ "`DidMondoCallMe`" ] ; then
    861     mkdir -p $bigdir/tmp
    862     mkdir -p $bigdir/sbin
    863     mkdir -p $bigdir/bin
    864     if [ -e "$MONDO_TMP/post-nuke.tgz" ] ; then
    865         LogIt "\nIncorporating post-nuke tarball\n"
    866         old_pwd=`pwd`
    867         cd $bigdir
    868         tar -zxf $MONDO_TMP/post-nuke.tgz || LogIt "Error occurred when untarring post-nuke tarball\n"
    869         cd $old_pwd
    870     fi
    871     if cp -f $MONDO_TMP/mondo*restore $bigdir/usr/bin ; then
    872             LocateDeps $bigdir/usr/bin/mondo*restore >> $outfile.pre
    873     else
    874         LogIt "Cannot find mondo*restore in mondo's tempdir, $MONDO_TMP\n"
    875         LogIt "I bet you've got a spare copy of Mondo or Mindi floating around on your system.\n"
    876             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."
    877             Die "Odd."
    878         fi
    879         cp -f $MONDO_TMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW.\n"
    880     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
    881         LogIt "Incorporating NFS-related settings\n"
    882         for r in NFS-* ISO-PREFIX ; do
    883             cp -f $MONDO_TMP/$r $bigdir/tmp || Die "Cannot copy $r - did you run out of disk space?"
    884             echo "Copying $r to ramdisk" >> $LOGFILE
    885         done
    886     fi
    887     fi
    888      tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile
     822        mkdir -p $bigdir/tmp
     823        mkdir -p $bigdir/sbin
     824        mkdir -p $bigdir/bin
     825        if [ -e "$MONDOTMP/post-nuke.tgz" ] ; then
     826            LogIt "\nIncorporating post-nuke tarball\n"
     827            old_pwd=`pwd`
     828            cd $bigdir
     829            tar -zxf $MONDOTMP/post-nuke.tgz || LogIt "Error occurred when untarring post-nuke tarball\n"
     830            cd $old_pwd
     831        fi
     832        if cp -f $MONDOTMP/mondo*restore $bigdir/usr/bin ; then
     833            LocateDeps $bigdir/usr/bin/mondo*restore >> $outfile.pre
     834        else
     835            LogIt "Cannot find mondo*restore in mondo's tempdir, $MONDOTMP\n"
     836            LogIt "I bet you've got a spare copy of Mondo or Mindi floating around on your system.\n"
     837            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."
     838            Die "Odd."
     839        fi
     840        cp -f $MONDOTMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW.\n"
     841        if [ -e "$MONDOTMP/NFS-DEV" ] ; then
     842            LogIt "Incorporating NFS-related settings\n"
     843            for r in NFS-* ISO-PREFIX ; do
     844                cp -f $MONDOTMP/$r $bigdir/tmp || Die "Cannot copy $r - did you run out of disk space?"
     845                echo "Copying $r to ramdisk" >> $LOGFILE
     846            done
     847        fi
     848    fi
     849    tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile
    889850    rm -f $tempfile $outfile.pre
    890851    [ "$res" -eq "0" ] && echo -e "\r\t\t\t\t\t\t\t\t$DONE" || echo "\nFailed."
    891852    return $res
    892853}
    893 
    894 
    895 
    896854
    897855
     
    910868
    911869
    912 
    913870# Returns all disk devices which are part of a raid array
    914 
    915871GetAllRaidMembers() {
    916872    $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*device/ if(\$2) {print \$2}" < /etc/raidtab
     
    924880    done
    925881}
    926 
    927882
    928883
     
    935890
    936891
    937 
    938 
    939 
    940892# Searches parent raid device of given disk device
    941893# $1: disk device (i.e. /dev/hda1)
    942 
    943894GetParentRaidDev() {
    944895    $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {dev=\$2} /^[[:space:]]*device/ {if(\$2==\"$1\") {print dev; exit}}" < /etc/raidtab
     
    946897
    947898
    948 
    949899# Searches members of raid device
    950900# $1: raid device (/dev/md...)
    951 
    952901GetRaidDevMembers() {
    953902    $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {if(dev) exit; if(\$2 == \"$1\") dev=\$2} /^[[:space:]]*device/ {if(dev) {print \$2}}" < /etc/raidtab
    954903}
    955 
    956 
    957 HackAwk() {
    958     local pathname filename dir old_pwd new_fname
    959     pathname=$1
    960     filename=$2
    961     dir=`echo "$pathname" | sed s/$filename//`
    962     old_pwd=`pwd`
    963     cd $dir
    964     [ -f "$filename" ] || Die "Can't find $filename at $dir"
    965     new_fname="an.icky.icky.spider.ewww"
    966     [ "$filename" = "gawk" ] && new_fname="awk"
    967     [ "$filename" = "awk" ] && new_fname="gawk"
    968     ln -s $filename $new_fname
    969     cd $old_pwd
    970 }
    971 
    972 
    973 
    974 
    975 HackMountlist() {
    976     local scratchdir outfile partlist pst partstr \
    977 res partition swapsize
    978     scratchdir=$TMP_ROOT
    979     outfile=$1
    980 
    981     mkdir -p $outfile
    982     rm -Rf $outfile
    983     > $outfile
    984     partlist=$(mount | cut -d' ' -f1,3,5 \
    985     | grep -Ev "((none|/tmp|/ISOs|/proc|/dev/root) )|/mnt/" \
    986     | tr ' ' '|')
    987 
    988     echo -n "Modifying mountlist..."
    989 
    990     if [ ! -f "/mountlist.hacked" ] ; then
    991         Die "Can't find modified mountlist.hacked!"
    992     else
    993         cp /mountlist.hacked "$outfile"
    994         LogIt "Done. (Created by auto-archive, I assume?)\n"
    995     fi
    996 }
    997 
    998 
    999904
    1000905
     
    1004909    incoming=`ReadLine`
    1005910    pwd=`pwd`
    1006     cd $TMP_ROOT
     911    cd $MONDOTMP
    1007912    while [ "$incoming" != "" ] ; do
    1008     stub=`basename $incoming`
    1009     newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`
    1010     for i in $newpath ; do
    1011         echo "$i"
    1012     done
    1013     read incoming
     913        stub=`basename $incoming`
     914        newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`
     915        for i in $newpath ; do
     916            echo "$i"
     917        done
     918        read incoming
    1014919    done
    1015920    cd $pwd
    1016921}
    1017 
    1018922
    1019923
     
    1022926
    1023927    grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
    1024 #    for partition in `$FDISK -l | tr -s ' ' '\n' | grep /dev` ; do
    1025 #        [ -e "$i" ] && all_partitions=echo "$i"
    1026 #    done
    1027928    [ -e "/etc/raidtab" ] && $AWK '/^ *device/ {print $2}' /etc/raidtab
    1028929    return
    1029930}
    1030 
    1031 
    1032 
    1033931
    1034932
     
    1042940    echo " "
    1043941}
    1044 
    1045942
    1046943
     
    1071968    [ -f "$oss" ] && find $oss.* 2> /dev/null
    1072969}
    1073 
    1074 
    1075 #ListKernelModules() {
    1076     #local output q
    1077     #output=""
    1078     #for q in `lsmod | sed -n '2,$s/ .*//p'` ; do
    1079         #output="$q $output"
    1080     #done
    1081     #echo "`lsmod | sed -n '2,$s/ .*//p'`"
    1082 #}
    1083 
    1084970
    1085971
     
    1107993}
    1108994
     995
    1109996# Give all symlinks recursively of a full path name
    1110997ReadAllLink() {
     
    11281015    fi 
    11291016}
     1017
    11301018
    11311019LocateFile() {
     
    11601048
    11611049
    1162 
    11631050LogIt() {
    11641051    if [ -e /dev/stderr ] ; then
    1165     echo -e "$1" >> /dev/stderr
     1052        echo -e "$1" >> /dev/stderr
    11661053    elif [ -e /usr/bin/logger ] ; then
    1167     /usr/bin/logger -s $1
     1054        /usr/bin/logger -s $1
    11681055    fi
    11691056    echo -en "$1" >> $LOGFILE
     
    11711058
    11721059
    1173 
    1174 
    1175 
    1176 
    1177 
    11781060# Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg
    1179 
    11801061MakeMondoConfigFile() {
    11811062    local outfile use_lzo use_comp use_star
     
    11951076    echo "datestamp `date`" >> $outfile
    11961077    [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile
    1197    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
    1198    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
    1199    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
    1200    AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
    1201    AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
    1202    AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-PATH   nfs-server-path   $outfile
    1203    AddFileToCfgIfExists $MONDO_TMP/NFS-DEV           nfs-dev           $outfile
    1204    AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
    1205    AddFileToCfgIfExists $MONDO_TMP/ISO-DEV           iso-dev           $outfile
    1206    AddFileToCfgIfExists $MONDO_TMP/ISO-MNT           iso-mnt           $outfile
    1207    AddFileToCfgIfExists $MONDO_TMP/ISO-PREFIX        iso-prefix        $outfile
    1208    AddFileToCfgIfExists $MONDO_TMP/ISODIR            isodir            $outfile
    1209    AddFileToCfgIfExists $MONDO_TMP/BOOTLOADER.DEVICE bootloader.device $outfile
    1210    AddFileToCfgIfExists $MONDO_TMP/BOOTLOADER.NAME   bootloader.name   $outfile
    1211    AddFileToCfgIfExists $MONDO_TMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile
    1212    AddFileToCfgIfExists $MONDO_TMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile
    1213    AddFileToCfgIfExists $MONDO_TMP/BACKUP-MEDIA-TYPE backup-media-type $outfile
    1214    AddFileToCfgIfExists $MONDO_TMP/DIFFERENTIAL      differential      $outfile
    1215 }
    1216 
    1217 
     1078    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
     1079    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
     1080    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
     1081    AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
     1082    AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
     1083    AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-PATH   nfs-server-path   $outfile
     1084    AddFileToCfgIfExists $MONDOTMP/NFS-DEV           nfs-dev           $outfile
     1085    AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
     1086    AddFileToCfgIfExists $MONDOTMP/ISO-DEV           iso-dev           $outfile
     1087    AddFileToCfgIfExists $MONDOTMP/ISO-MNT           iso-mnt           $outfile
     1088    AddFileToCfgIfExists $MONDOTMP/ISO-PREFIX        iso-prefix        $outfile
     1089    AddFileToCfgIfExists $MONDOTMP/ISODIR            isodir            $outfile
     1090    AddFileToCfgIfExists $MONDOTMP/BOOTLOADER.DEVICE bootloader.device $outfile
     1091    AddFileToCfgIfExists $MONDOTMP/BOOTLOADER.NAME   bootloader.name   $outfile
     1092    AddFileToCfgIfExists $MONDOTMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile
     1093    AddFileToCfgIfExists $MONDOTMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile
     1094    AddFileToCfgIfExists $MONDOTMP/BACKUP-MEDIA-TYPE backup-media-type $outfile
     1095    AddFileToCfgIfExists $MONDOTMP/DIFFERENTIAL      differential      $outfile
     1096}
    12181097
    12191098
     
    12271106    if [ "$YOUR_KERNEL_SUCKS" ] ; then
    12281107        kver=$FAILSAFE_KVER
    1229         cd $TMP_ROOT
     1108        cd $MONDOTMP
    12301109        searchpath=lib/modules/$kver
    12311110    else
     
    12361115        if [ "${kernelname}" != "" ]
    12371116        then
    1238           kver=${kernelname}
     1117            kver=${kernelname}
    12391118        else
    1240           kver=`uname -r`
     1119            kver=`uname -r`
    12411120        fi
    12421121###
     
    12481127    echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile
    12491128    list_to_echo="`lsmod | sed -n '2,$s/ .*//p'`"
    1250 #    LTE=`echo "$list_to_echo" | tr ' ' '\n' | grep -n "" | cut -d':' -f2,3,4 | tr '\n' ' '`
    1251 #    lte_old="$LTE"
    1252 #    LTE=""
    1253 #    for q in $lte_old ; do
    1254 #   LTE="$q $LTE"
    1255 #    done
    1256 #echo "LTE = '$LTE'" >> $LOGFILE
     1129
    12571130    # Make temporary modprobe.conf file if we are told so
    12581131    if [ $tmpmodprobe_flag == "Y" ] ; then
    1259         infile="/tmp/modprobe.conf.mindi.$$"
     1132        infile="$MONDOTMP/modprobe.conf.mindi"
    12601133        find /etc/modprobe.d -maxdepth 1 -name "*" -xtype f -print0 | xargs -0 cat > $infile
    12611134    else
     
    12791152    echo "echo \"Done.\"" >> $outfile
    12801153    chmod +x $outfile
    1281 #    cp $outfile /tmp/out.txt
    12821154    cd /
    12831155    # Remove temporary modprobe.conf file if we have created one
     
    12861158    fi
    12871159}
    1288 
    1289 
    1290 
    12911160
    12921161
     
    13021171
    13031172# scratchdir, mountlist(OUT)
    1304     scratchdir=$TMP_ROOT
     1173    scratchdir=$MONDOTMP
    13051174    mountlist=$1
    13061175
     
    13301199    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"
    13311200    for c_p in $all_partitions ; do
    1332 #        echo "c_p = $c_p" > /dev/stderr
    13331201        [ "`echo "$useless_dev" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] && continue
    13341202        [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue
     
    14191287                current_partition=$actual_dev
    14201288            else
    1421                     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"
     1289                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"
    14221290            fi
    14231291        else
     
    15561424
    15571425
    1558 
    1559 
    1560 
    1561 
    15621426MakeSureNumberIsInteger() {
    15631427    res=`echo "$1" | tr -s '\-[0-9]' ' '`
     
    15671431    fi
    15681432}
    1569 
    1570 
    1571 
    15721433
    15731434
     
    15841445    rm -f $1.tmp
    15851446    if [ "$CDRECOVERY" != "yes" ] ; then
    1586         if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1447        if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    15871448            echo -en "Press <enter> to continue.\n" >> $1
    1588         elif [ ! "$MONDO_TMP" ] ; then
     1449        elif [ ! "$MONDOTMP" ] ; then
    15891450            echo -en "FYI, this is _not_ a Mondo Rescue CD.\n" >> $1
    15901451            if [ -e "$MINDI_LIB/memtest.img" ] ; then
     
    16001461    fi
    16011462}
    1602 
    1603 
    16041463
    16051464
     
    16381497    boot_dev=$2
    16391498    data_dev=$3
     1499
    16401500    echo -en "Would you like to create boot+data floppy disks now (y/n) ?"
    16411501    read i
     
    16471507    i=`find $imagesdir -type f | grep -F "/mindi-root.1" 2> /dev/null`
    16481508    j=`find $imagesdir -type f | grep -F "/mindi-boot" | grep -Ev '2880|5760'`
    1649 #    echo "i=$i"
    1650 #    echo "j=$j"
    16511509    if [ "$i" ] ; then
    16521510        CopyImageToDisk $j $data_dev "boot disk"
     
    16611519    done
    16621520}
    1663 
    16641521
    16651522
     
    16711528        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
    16721529    fi
    1673     if [ ! "$MONDO_TMP" ] ; then
     1530    if [ ! "$MONDOTMP" ] ; then
    16741531        LogIt "NB: Mindi's bootable CD always uses isolinux.\n"
    16751532        LogIt "For a bootable CD w/LILO, please use Mondo.\n"
    16761533    fi
    1677     rm -Rf $TMP_ROOT/iso
    1678     mkdir -p $TMP_ROOT/iso/{images,archives,isolinux}
    1679     cp -f $1/*.img $1/*.gz $TMP_ROOT/iso/images || LogIt "OfferToMakeBootableISO: Cannot copy $i to $TMP_ROOT/iso/images\n"
     1534    rm -Rf $MONDOTMP/iso
     1535    mkdir -p $MONDOTMP/iso/{images,archives,isolinux}
     1536    cp -f $1/*.img $1/*.gz $MONDOTMP/iso/images || LogIt "OfferToMakeBootableISO: Cannot copy $i to $MONDOTMP/iso/images\n"
    16801537    old_pwd=`pwd`
    1681     cd $TMP_ROOT/iso
     1538    cd $MONDOTMP/iso
    16821539    mkdir -p $MONDO_ROOT/iso/isolinux
    16831540    echo "mindi_lib = $MINDI_LIB" >> $LOGFILE
     
    16851542    for i in memdisk memtest.bin memtest.img ; do
    16861543    j=$MINDI_LIB/$i
    1687     k=$TMP_ROOT/iso/isolinux
     1544    k=$MONDOTMP/iso/isolinux
    16881545    if [ -e "$j" ] ; then
    16891546        LogIt "Copying $j to $k\n"
    16901547        cp -f $j $k || Die "Failed to copy $j to $k"
    1691         cp -f $j $TMP_ROOT || Die "Failed to copy $j to $k"
    1692     fi
    1693     done
    1694     MakeSyslinuxMessageFile $TMP_ROOT/iso/isolinux/message.txt
    1695     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?"
    1696     cp $TMP_ROOT/mindi.rdz $TMP_ROOT/iso/isolinux/initrd.img
    1697     cp $TMP_ROOT/mindi.rdz $imagesdir/initrd.img
     1548        cp -f $j $MONDOTMP || Die "Failed to copy $j to $k"
     1549    fi
     1550    done
     1551    MakeSyslinuxMessageFile $MONDOTMP/iso/isolinux/message.txt
     1552    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?"
     1553    cp $MONDOTMP/mindi.rdz $MONDOTMP/iso/isolinux/initrd.img
     1554    cp $MONDOTMP/mindi.rdz $CACHE_LOC/initrd.img
    16981555    [ -e "$iso_cfg_file" ] || Die "FIXME - unable to find $iso_cfg_file - this should never occur"
    1699     cd $TMP_ROOT/iso/isolinux
    1700     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?"
    1701     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1556    cd $MONDOTMP/iso/isolinux
     1557    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?"
     1558    if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    17021559        mv isolinux.cfg isolinux.cfg.old
    17031560        sed s/interactive/iso/ isolinux.cfg.old > isolinux.cfg
     
    17071564        cp $ISOLINUX ../
    17081565    fi
    1709     cd $TMP_ROOT/iso
     1566    cd $MONDOTMP/iso
    17101567    if [ "$ARCH" != "ia64" ] ; then
    1711         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?"
     1568        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?"
    17121569    fi
    17131570    [ "$MONDO_SHARE" ] && cp -f $MONDO_SHARE/autorun .   
    1714     if [ -d "/home/MondoCD" ] ; then
    1715         cp -pRdu /home/MondoCD/* .
    1716     fi
    17171571    if [ "$ARCH" != "ia64" ] ; then
    1718         mkisofs -U -J -r -o $imagesdir/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
    1719     else
    1720         mkisofs -J -r -o $imagesdir/mindi.iso -b images/mindi-bootroot.$IA64_BOOT_SIZE.img -c isolinux/boot.cat -no-emul-boot . > /dev/null 2> /tmp/$$.mk
     1572        mkisofs -U -J -r -o $CACHE_LOC/mindi.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table . > /dev/null 2> $MONDOTMP/mkisofs.log
     1573    else
     1574        mkisofs -J -r -o $CACHE_LOC/mindi.iso -b images/mindi-bootroot.$IA64_BOOT_SIZE.img -c isolinux/boot.cat -no-emul-boot . > /dev/null 2> $MONDOTMP/mkisofs.log
    17211575    fi
    17221576    if [ "$?" -ne "0" ] ; then
    1723     echo "----------- mkisofs's errors --------------" >> $LOGFILE
    1724     cat /tmp/$$.mk >> $LOGFILE
    1725     echo "mkisofs returned the following errors:-"
    1726     cat /tmp/$$.mk
    1727     LogIt "Failed to create ISO image.\n"
    1728     else
    1729     echo "Created bootable ISO image at $imagesdir/mindi.iso" >> $LOGFILE
    1730     fi
    1731     rm -f /tmp/$$.mk
     1577        echo "----------- mkisofs's errors --------------" >> $LOGFILE
     1578        cat $MONDOTMP/mkisofs.log >> $LOGFILE
     1579        echo "mkisofs returned the following errors:-"
     1580        cat $MONDOTMP/mkisofs.log
     1581        LogIt "Failed to create ISO image.\n"
     1582    else
     1583        echo "Created bootable ISO image at $CACHE_LOC/mindi.iso" >> $LOGFILE
     1584    fi
     1585    rm -f $MONDOTMP/mkisofs.log
    17321586    cd $old_pwd
    17331587}
    1734 
    17351588
    17361589
     
    17381591    [ "$1" -gt "1" ] && echo -en "s"
    17391592}
    1740 
    1741 
    17421593
    17431594
     
    17511602    fi
    17521603    if [ "$disksize" -gt "2880" ] ; then
    1753     if [ "`DidMondoCallMe`" ] ; then
    1754         if [ "$CDRECOVERY" != "yes" ] ; then
    1755             if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
    1756                 echo -en "Press <enter> to continue.\n"
    1757             elif [ ! "$MONDO_TMP" ] ; then
    1758                 echo -en "FYI, this is _not_ a Mondo Rescue CD.\n"
    1759             else
    1760                 echo -en "$BOOT_MEDIA_MESSAGE"
     1604        if [ "`DidMondoCallMe`" ] ; then
     1605            if [ "$CDRECOVERY" != "yes" ] ; then
     1606                if [ -e "$MONDOTMP/NFS-DEV" ] ; then
     1607                    echo -en "Press <enter> to continue.\n"
     1608                elif [ ! "$MONDOTMP" ] ; then
     1609                    echo -en "FYI, this is _not_ a Mondo Rescue CD.\n"
     1610                else
     1611                    echo -en "$BOOT_MEDIA_MESSAGE"
     1612                fi
    17611613            fi
    17621614        fi
    1763     fi
    17641615    fi
    17651616    if [ "$CDRECOVERY" = "yes" ] ; then
     
    17701621    echo -en "\n\n\n"
    17711622}
    1772 
    1773 
    17741623
    17751624
     
    17831632    rand1=$RANDOM
    17841633    rand2=$RANDOM
    1785     image=/tmp/$rand1.$rand2.img
    1786     mtpt=/tmp/$rand1.$rand2.mtpt
     1634    image=$MONDOTMP/$rand1.$rand2.img
     1635    mtpt=$MONDOTMP/$rand1.$rand2.mtpt
    17871636    dd if=/dev/zero of=$image bs=1k count=$disksize
    17881637    mke2fs -N 26 -F $image > /dev/null
     
    18101659    CopyBootBFile $mtpt/boot.b
    18111660
    1812 #    echo "root=/dev/loop0" > bdlilo.conf
    18131661    MakeLiloConfFile $disksize >> bdlilo.conf
    1814 
    1815 #    cat bdlilo.conf > /tmp/bdlilo.conf
    1816 
    1817 #    cat /home/mondostuff/bdlc > bdlilo.conf
    18181662
    18191663    chmod 644 bdlilo.conf
     
    18221666    res=$?
    18231667
    1824 #echo "lilo -v -C bdlilo.conf -r $mtpt"
    1825 #echo -en "Press enter"; read line
    1826 
    18271668    cd $old_pwd
    18281669    umount $mtpt
     
    18311672
    18321673    return $res
    1833 
    1834 # --- the kernel-only method NO LONGER WORKS. Not since Apr 2002.
    1835 # It should work, according to the Boot Disk HOWTO, but it doesn't.
    1836 # It works for my failsafe kernel & for RH7.2 but not RH7.3, 8.0, etc.
    1837 # -Hugo, Apr 19th 2004
    1838 #   dd if=$1 of=$2 bs=1k &> /dev/null || Die "Cannot dd blank file"
    1839 #   dd if=/dev/zero bs=1k count=$3 >> $2 2> /dev/null || Die "Cannot dd blank file"
    1840 #   mv -f $2 $2.old
    1841 #   dd if=$2.old bs=1k count=$3 of=$2 &> /dev/null || Die "Cannot dd blank file"
    1842 #   rm -f $2.old
    1843 #   if [ "$3" = "1440" ] ; then
    1844 #       rdev $2 "/dev/fd0H"$3
    1845 #   else
    1846 #       rdev $2 "/dev/fd0u"$3
    1847 #   fi
    1848 #   rdev -R $2 0
    1849 #   rdev -r $2 49152
    1850 }
    1851 
    1852 
    1853 
    1854 
     1674}
    18551675
    18561676
     
    18591679    disksize=$1
    18601680    options=""
    1861         if [ "$ARCH" != "ia64" ] ; then
    1862             echo -en "boot=/dev/loop0\ndisk=/dev/loop0\n"
    1863         fi
    1864         if [ "$disksize" -eq "2880" ] ; then
    1865             echo -en "bios=0x00\nsectors=36\nheads=2\ncylinders=80\n"
    1866         elif [ "$disksize" -eq "1722" ] ; then
    1867             echo -en "bios=0x00\nsectors=21\nheads=2\ncylinders=82\n"
    1868         elif [ "$disksize" -gt "2880" ] ; then
    1869             /bin/true
    1870         else
    1871             echo -en "bios=0x00\nsectors=18\nheads=2\ncylinders=80\n"
    1872         fi
    1873         if [ "$ARCH" != "ia64" ] ; then
    1874             echo -en "install=/boot.b\nmap=/boot.map\n"
    1875         fi
     1681
     1682    if [ "$ARCH" != "ia64" ] ; then
     1683        echo -en "boot=/dev/loop0\ndisk=/dev/loop0\n"
     1684    fi
     1685    if [ "$disksize" -eq "2880" ] ; then
     1686        echo -en "bios=0x00\nsectors=36\nheads=2\ncylinders=80\n"
     1687    elif [ "$disksize" -eq "1722" ] ; then
     1688        echo -en "bios=0x00\nsectors=21\nheads=2\ncylinders=82\n"
     1689    elif [ "$disksize" -gt "2880" ] ; then
     1690        /bin/true
     1691    else
     1692        echo -en "bios=0x00\nsectors=18\nheads=2\ncylinders=80\n"
     1693    fi
     1694    if [ "$ARCH" != "ia64" ] ; then
     1695        echo -en "install=/boot.b\nmap=/boot.map\n"
     1696    fi
    18761697    if [ "$CDRECOVERY" = "yes" ] ; then
    18771698        echo -en "default=RESTORE\n"
    18781699    elif [ "$disksize" -gt "2880" ] && [ "`DidMondoCallMe`" ] ; then
    1879         if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1700        if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    18801701            echo -en "default=iso\n"
    18811702        else
     
    18911712    fi
    18921713    if [ "$CDRECOVERY" != "yes" ] ; then
    1893     echo -en "timeout=300\n"
     1714        echo -en "timeout=300\n"
    18941715    fi
    18951716    echo -en "\n"
    18961717    if [ "$CDRECOVERY" = "yes" ] ; then
    1897     options="RESTORE expert"
     1718        options="RESTORE expert"
    18981719    elif [ "$disksize" -gt "2880" ] ; then
    18991720        if [ "`DidMondoCallMe`" ] ; then
    1900             if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1721            if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    19011722                options="iso"
    19021723            else
     
    19061727        else
    19071728            options="expert"
    1908     fi
     1729        fi
    19091730    else
    19101731        options="expert"
    19111732    fi
    19121733    for i in $options ; do
    1913     ooo=$i
    1914     [ "$ooo" = "RESTORE" ] && ooo="nuke"
    1915     if [ "$ARCH" = "ia64" ] ; then
    1916         rootpart="root=/dev/ram0\n\t"
    1917     else
    1918         rootpart=""
    1919     fi
    1920     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"
     1734        ooo=$i
     1735        [ "$ooo" = "RESTORE" ] && ooo="nuke"
     1736        if [ "$ARCH" = "ia64" ] ; then
     1737            rootpart="root=/dev/ram0\n\t"
     1738        else
     1739            rootpart=""
     1740        fi
     1741        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"
    19211742   
    1922     outstr=$outstr" $ooo_mode"
    1923     outstr=$outstr"\"\n"
    1924     if [ "$disksize" = "1440" ] ; then
    1925         echo -en "$outstr" | sed s/initrd=.*// | grep -v root=
    1926     else
    1927         echo -en "$outstr"
    1928     fi
    1929     done
    1930 }
    1931 
    1932 
     1743        outstr=$outstr" $ooo_mode"
     1744        outstr=$outstr"\"\n"
     1745        if [ "$disksize" = "1440" ] ; then
     1746            echo -en "$outstr" | sed s/initrd=.*// | grep -v root=
     1747        else
     1748            echo -en "$outstr"
     1749        fi
     1750    done
     1751}
    19331752
    19341753
     
    19431762    [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"
    19441763    echo -en "Making "$disksize"KB boot disk..."
    1945     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?"
     1764    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?"
    19461765    if [ "$ARCH" != "ia64" ] ; then
    19471766        [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size"
     
    19491768    echo -en "..."
    19501769    imagefile=$imagesdir/mindi-bootroot.$disksize.img
    1951     mountpoint=$TMP_ROOT/mountpoint.$$
     1770    mountpoint=$MONDOTMP/mountpoint.$$
    19521771    mkdir -p $mountpoint
    19531772    dd if=/dev/zero of=$imagefile bs=1k count=$disksize &> /dev/null || Die "Cannot dd blank file"
    19541773    if [ "$ARCH" = "ia64" ] ; then
    1955         mkdosfs $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$
     1774        mkdosfs $imagefile > $MONDOTMP/mke2fs.log 2>> $MONDOTMP/mke2fs.log
    19561775    t=vfat
    19571776    else
    1958         mke2fs -N 26 -m 0 -F $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$
     1777        mke2fs -N 26 -m 0 -F $imagefile > $MONDOTMP/mke2fs.log 2>> $MONDOTMP/mke2fs.log
    19591778    t=ext2
    19601779    fi
    1961     [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$
    1962     rm -f /tmp/mke2fs.$$
     1780    [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.log
     1781    rm -f $MONDOTMP/mke2fs.log
    19631782    mount -t $t -o loop $imagefile $mountpoint || LogIt "Cannot mount (PBDI)\n\n"
    19641783# copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
     
    19671786        liloconf=$mountpoint/etc/lilo.conf
    19681787    else
    1969     liloconf=$mountpoint/elilo.conf
     1788        liloconf=$mountpoint/elilo.conf
    19701789    fi
    19711790    old_pwd=`pwd`
     
    19811800    MakeLiloConfFile $disksize > $liloconf
    19821801
    1983     echo "Copying $TMP_ROOT/mindi.rdz to $mountpoint..." >> $LOGFILE
    1984     cp -f $TMP_ROOT/mindi.rdz $mountpoint 2>> $LOGFILE
     1802    echo "Copying $MONDOTMP/mindi.rdz to $mountpoint..." >> $LOGFILE
     1803    cp -f $MONDOTMP/mindi.rdz $mountpoint 2>> $LOGFILE
    19851804    if [ "$?" -ne "0" ] ; then
    1986     LogIt "Failed to copy $TMP_ROOT/mindi.rdz to $mountpoint\n"
    1987     cat $TMP_ROOT/mtpt.$$ >> $LOGFILE
    1988     LogIt "Please unload some of your modules and try again.\n"
    1989     rm -f $TMP_ROOT/mtpt.$$
    1990     LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"
     1805        LogIt "Failed to copy $MONDOTMP/mindi.rdz to $mountpoint\n"
     1806        cat $MONDOTMP/mtpt.$$ >> $LOGFILE
     1807        LogIt "Please unload some of your modules and try again.\n"
     1808        rm -f $MONDOTMP/mtpt.$$
     1809        LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"
    19911810        retval=$(($retval+1))
    19921811    fi
     
    19941813
    19951814    mkdir -p $mountpoint/tmp
    1996     cp -f $TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null
     1815    cp -f $MONDOTMP/mondo-restore.cfg $mountpoint/tmp &> /dev/null
    19971816    if [ -e "$MINDI_LIB/memtest.img" ] ; then
    19981817        echo -en "image=/memtest.bin\nlabel=memtest\nn" >> $liloconf
     
    20001819#        echo "Yep, this is a multi-function CD" > $mountpoint/MULTIFUNC
    20011820    fi
    2002     if [ -d "/home/MondoCD" ] ; then
    2003     cp -pRdu /home/MondoCD/* . || Die "Cannot do kung pow"
    2004     fi
    2005 
    2006 # copy the kernel across
     1821
     1822    # copy the kernel across
    20071823    rm -Rf $mountpoint/lost+found
    20081824    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
     
    20101826    cp -f $kernelpath $mountpoint/vmlinuz > /dev/null 2> /dev/null
    20111827    if [ "$?" -ne "0" ] || [ "$FORCE_DUAL_FLOPPIES" = "yes" ] ; then
    2012     echo "Files at mountpoint ($mountpoint) :-" >> $LOGFILE
    2013     du -sk $mountpoint/* >> $LOGFILE
    2014     echo "--- end of list of files ---" >> $LOGFILE
    2015     echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n\
     1828        echo "Files at mountpoint ($mountpoint) :-" >> $LOGFILE
     1829        du -sk $mountpoint/* >> $LOGFILE
     1830        echo "--- end of list of files ---" >> $LOGFILE
     1831        echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n\
    20161832Sorry, your kernel is too big for a boot/root floppy.\nI'll try the new boot/root two-disk thingy.\n" >> $LOGFILE
    20171833        rm -f $mountpoint/vmlinuz
    2018     cd $old_pwd
     1834        cd $old_pwd
    20191835        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    20201836        rmdir $mountpoint || LogIt "Cannot rmdir (PBDI)\n"
    2021 #   losetup /dev/loop0 -d
    2022     res=0
     1837    #   losetup /dev/loop0 -d
     1838        res=0
    20231839        write_full_floppy_of_kernel $kernelpath $imagesdir/mindi-boot.1440.img 1440
    2024     res=$(($res+$?))
    2025         cp -f $TMP_ROOT/mindi.rdz $imagesdir/mindi-root.1440.img
    2026     res=$(($res+$?))
    2027     rm -f $imagefile
    2028     if [ "$res" -ne "0" ]; then
    2029         LogIt "Warning - failed to create 1.44MB boot/root floppies\n"
    2030         rm -f $imagesdir/mindi-*.1440.img
    2031     fi
    2032     return $res
     1840        res=$(($res+$?))
     1841        cp -f $MONDOTMP/mindi.rdz $imagesdir/mindi-root.1440.img
     1842        res=$(($res+$?))
     1843        rm -f $imagefile
     1844        if [ "$res" -ne "0" ]; then
     1845            LogIt "Warning - failed to create 1.44MB boot/root floppies\n"
     1846            rm -f $imagesdir/mindi-*.1440.img
     1847        fi
     1848        return $res
    20331849    fi
    20341850    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     
    20471863    elif [ ! "$KERN_DISK_MADE" ] ; then
    20481864# 12/28/2001 - if 1.72MB floppy then don't use LILO's optimizations at all
    2049     $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE
    2050     else
    2051     echo "Not running LILO. It's not that kind of disk." >> $LOGFILE
    2052     fi
     1865        $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE
     1866    else
     1867        echo "Not running LILO. It's not that kind of disk." >> $LOGFILE
     1868    fi
     1869
     1870    # BERLIOS  does not test necessarily what it expects
    20531871    if [ $? -ne "0" ] ; then
    2054     if [ "`grep -F "/tmp/dev.0" $LOGFILE`" ] ; then
    2055         LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"
    2056         LogIt "Please reboot your PC as a workaround.\n"
    2057         Die "LILO sneezed and Mindi caught a cold. Please read the README / FAQ.\n"
    2058     fi
    2059     echo "$LILO_EXE -r $mountpoint ...failed."
    2060     echo -en "Press ENTER to continue."; read line
    2061     LogIt "Cannot run lilo on $mountpoint\nPlease upgrade/downgrade your version of LILO. It has a bug.\n"
    2062     retval=$(($retval+1))
    2063     fi
    2064     cp -f $liloconf /tmp/lilo.conf
     1872        if [ "`grep -F "/tmp/dev.0" $LOGFILE`" ] ; then
     1873            LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"
     1874            LogIt "Please reboot your PC as a workaround.\n"
     1875            Die "LILO sneezed and Mindi caught a cold. Please read the README / FAQ.\n"
     1876        fi
     1877        echo "$LILO_EXE -r $mountpoint ...failed."
     1878        echo -en "Press ENTER to continue."; read line
     1879        LogIt "Cannot run lilo on $mountpoint\nPlease upgrade/downgrade your version of LILO. It has a bug.\n"
     1880        retval=$(($retval+1))
     1881    fi
     1882    cp -f $liloconf $MONDOTMP/lilo.conf
    20651883    if [ "$ARCH" = "ia64" ] ; then
    20661884        cp `dirname $kernelpath`/*.efi $mountpoint
     
    20821900    return $retval
    20831901}
    2084 
    2085 
    20861902
    20871903
     
    20951911    local retval old_pwd
    20961912    retval=0
     1913
    20971914    [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"
    20981915    echo -en "Making "$disksize"KB boot disk..."
    2099     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?"
     1916    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?"
    21001917    [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size"
    21011918    echo -en "..."
    21021919    imagefile=$imagesdir/mindi-bootroot.$disksize.img
    2103     mountpoint=$TMP_ROOT/mountpoint.$$
     1920    mountpoint=$MONDOTMP/mountpoint.$$
    21041921    mkdir -p $mountpoint
    21051922# If I format a 1722KB data file & run syslinux on it, the resultant image
     
    21171934    fi
    21181935    mount -t vfat -o loop $imagefile $mountpoint || LogIt "Cannot mount (PBDI)\n\n"
    2119 # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
     1936
     1937    # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it
    21201938    old_pwd=`pwd`
    21211939    MakeSyslinuxMessageFile $mountpoint/message.txt
    21221940    cd $mountpoint
    21231941    [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?"
    2124 #    tar -zxf $MINDI_LIB/dev.tgz || LogIt "Cannot untar dev.tgz\n" <--- present for LILO; is it nec. for SYSLINUX too?
    21251942    cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $mountpoint > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to tmp_root"
    2126     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     1943    if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    21271944        mv syslinux.cfg syslinux.cfg.orig
    21281945        sed s/interactive/iso/ syslinux.cfg.orig > syslinux.cfg
    21291946    fi
    21301947    cd $old_pwd
    2131     echo "Copying $TMP_ROOT/mindi.rdz to $mountpoint/initrd.img..." >> $LOGFILE
    2132     cp -f $TMP_ROOT/mindi.rdz $mountpoint/initrd.img 2>> $LOGFILE
     1948    echo "Copying $MONDOTMP/mindi.rdz to $mountpoint/initrd.img..." >> $LOGFILE
     1949    cp -f $MONDOTMP/mindi.rdz $mountpoint/initrd.img 2>> $LOGFILE
    21331950    if [ "$?" -ne "0" ] ; then
    2134         LogIt "Failed to copy $TMP_ROOT/mindi.rdz to $mountpoint\n"
    2135         cat $TMP_ROOT/mtpt.$$ >> $LOGFILE
     1951        LogIt "Failed to copy $MONDOTMP/mindi.rdz to $mountpoint\n"
     1952        cat $MONDOTMP/mtpt.$$ >> $LOGFILE
    21361953        LogIt "Please unload some of your modules and try again.\n"
    2137         rm -f $TMP_ROOT/mtpt.$$
     1954        rm -f $MONDOTMP/mtpt.$$
    21381955        LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"
    21391956        retval=$(($retval+1))
     
    21411958
    21421959    mkdir -p $mountpoint/tmp
    2143     cp -f $TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null
    2144 
    2145 # copy the kernel across
     1960    cp -f $MONDOTMP/mondo-restore.cfg $mountpoint/tmp &> /dev/null
     1961
     1962    # copy the kernel across
    21461963    rm -Rf $mountpoint/lost+found
    21471964    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
     
    21581975        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    21591976        rmdir $mountpoint || LogIt "Cannot rmdir (PBDI)\n"
    2160 #   losetup /dev/loop0 -d
    21611977
    21621978        res=0
    21631979        write_full_floppy_of_kernel $kernelpath $imagesdir/mindi-boot.1440.img 1440
    21641980        res=$(($res+$?))
    2165         cp -f $TMP_ROOT/mindi.rdz $imagesdir/mindi-root.1440.img
     1981        cp -f $MONDOTMP/mindi.rdz $imagesdir/mindi-root.1440.img
    21661982        res=$(($res+$?))
    21671983        rm -f $imagefile
     
    21761992    echo "Free space left on floppy = $free_space KB" >> $LOGFILE
    21771993    echo "Max kernel size on $disksize KB floppy (est'd) = $max_kernel_size K" >> $LOGFILE
    2178 # make it bootable
     1994
     1995    # make it bootable
    21791996    rm -f $mountpoint/zero
    21801997    mkdir -p $mountpoint/etc
     
    22002017
    22012018
    2202 
    2203 
    22042019PrepareDataDiskImages() {
    22052020    local needlist bigdir minidir_root tardir diskdir imagesdir res i j k old_pwd lines
     
    22072022    imagesdir=$1
    22082023    rm -f $imagesdir/mindi-*.img $imagesdir/[0-9]*.tar.gz $imagesdir/mindi.iso
    2209     needlist=$TMP_ROOT/what-we-need.txt
    2210     bigdir=$TMP_ROOT/bigdir
    2211     minidir_root=$TMP_ROOT/minidir
     2024    needlist=$MONDOTMP/what-we-need.txt
     2025    bigdir=$MONDOTMP/bigdir
     2026    minidir_root=$MONDOTMP/minidir
    22122027    mkdir -p $minidir_root
    22132028    mkdir -p $bigdir/usr/bin
    2214     tardir=$TMP_ROOT/tardir
     2029    tardir=$MONDOTMP/tardir
    22152030
    22162031    lines=`grep -vx " *#.*" $MINDI_CONF/deplist.txt | grep -vx "" | wc -l`
     
    22182033    res=$?
    22192034    if [ "$YOUR_KERNEL_SUCKS" ]; then
    2220     pwd=`pwd`
    2221     cd $TMP_ROOT
     2035        pwd=`pwd`
     2036        cd $MONDOTMP
    22222037        for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do
    2223         cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir"
    2224         if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
    2225         cp --parents -pRdf $i $bigdir
    2226         else
    2227         ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
    2228         BIGNO=$(($BIGNO+1))
    2229         fi
    2230     done
    2231     for i in $EXTRA_MODS ; do
    2232         j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null`
    2233         [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE
    2234         for k in $j ; do
    2235         if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
    2236             cp --parents -pRdf $k $bigdir
    2237         else
    2238             ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
    2239             BIGNO=$(($BIGNO+1))
    2240         fi
    2241         echo "Added failsafe module $k to ramdisk" >> $LOGFILE
     2038            cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir"
     2039            if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
     2040                cp --parents -pRdf $i $bigdir
     2041            else
     2042                ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
     2043                BIGNO=$(($BIGNO+1))
     2044            fi
    22422045        done
    2243     done
    2244     cd $pwd
    2245     else
    2246     ListKernelModulePaths >> $needlist
     2046        for i in $EXTRA_MODS ; do
     2047            j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null`
     2048            [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE
     2049            for k in $j ; do
     2050                if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
     2051                    cp --parents -pRdf $k $bigdir
     2052                else
     2053                    ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
     2054                    BIGNO=$(($BIGNO+1))
     2055                fi
     2056                echo "Added failsafe module $k to ramdisk" >> $LOGFILE
     2057            done
     2058        done
     2059        cd $pwd
     2060    else
     2061        ListKernelModulePaths >> $needlist
    22472062    fi
    22482063    if [ "$res" -ne "0" ] ; then
     
    22522067    mkdir -p $bigdir/tmp
    22532068    if [ "`DidMondoCallMe`" ] ; then
    2254         MakeMondoConfigFile $TMP_ROOT/mondo-restore.cfg
    2255         cp -f $TMP_ROOT/mondo-restore.cfg $bigdir/tmp &> /dev/null
    2256         cp -f $TMP_ROOT/mondo-restore.cfg $CACHE_LOC &> /dev/null
     2069        MakeMondoConfigFile $MONDOTMP/mondo-restore.cfg
     2070        cp -f $MONDOTMP/mondo-restore.cfg $bigdir/tmp &> /dev/null
    22572071    fi
    22582072    [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO
     
    22612075    CopyDependenciesToDirectory < $needlist $bigdir
    22622076
    2263 # also copy io.sys and msdos.sys, if we can find them
     2077    # also copy io.sys and msdos.sys, if we can find them
    22642078    for i in `mount | cut -d' ' -f3` ; do
    2265     for j in io.sys msdos.sys ; do
    2266         [ -e "$i/$j" ] && cp -f $i/$j $bigdir
    2267     done
    2268     done
    2269 
    2270 # master boot record, too
    2271     i=`cat $MONDO_TMP/BOOTLOADER.DEVICE 2> /dev/null`
     2079        for j in io.sys msdos.sys ; do
     2080            [ -e "$i/$j" ] && cp -f $i/$j $bigdir
     2081        done
     2082    done
     2083
     2084    # master boot record, too
     2085    i=`cat $MONDOTMP/BOOTLOADER.DEVICE 2> /dev/null`
    22722086    if [ "$i" ] ; then
    2273     LogIt "Backing up $i's MBR\n"
    2274     dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
    2275 # < < E O F
    2276     sleep 1
    2277     sync
    2278 #        [ "$?" -ne "0" ] && echo "Failed to save $i's MBR to bigdir" >> $LOGFILE
    2279     j=$i
    2280     [ -h "$j" ] && j=`readlink -f $j`
    2281     LogIt "Creating /dev/boot_device ($j)\n"
    2282     mkdir -p $bigdir/dev
    2283     cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk"
    2284     fi
    2285 
    2286 # more stuff
    2287 #    cp -f $MINDI_LIB/embleer* $bigdir
     2087        LogIt "Backing up $i's MBR\n"
     2088        dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE
     2089        sleep 1
     2090        sync
     2091        j=$i
     2092        [ -h "$j" ] && j=`readlink -f $j`
     2093        LogIt "Creating /dev/boot_device ($j)\n"
     2094        mkdir -p $bigdir/dev
     2095        cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk"
     2096    fi
     2097
    22882098    old_pwd=`pwd`
    22892099    cd $bigdir
     
    22922102    cp -Rdf $MINDI_LIB/aux-tools/* . 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping aux-tools\n"
    22932103    if [ -e "$MINDI_LIB/x11-tools.tgz" ] ; then
    2294     tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
     2104        tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
    22952105    fi
    22962106    if [ -e "$MONDO_SHARE/restore-scripts" ] ; then
     
    23102120#        EXTRA_SPACE=$(($EXTRA_SPACE*2))
    23112121#    fi
    2312     MakeMountlist $TMP_ROOT/mountlist.txt
     2122    MakeMountlist $MONDOTMP/mountlist.txt
    23132123    mkdir -p $minidir_root/$noof_disks/tmp
    2314     cp -f $TMP_ROOT/mountlist.txt $minidir_root/$noof_disks/tmp/mountlist.txt || Die "Cannot copy mountlist.txt from $TMP_ROOT to data disk"
    2315     cp -f $TMP_ROOT/mountlist.txt $CACHE_LOC
    2316     [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDO_TMP/.
     2124    cp -f $MONDOTMP/mountlist.txt $minidir_root/$noof_disks/tmp/mountlist.txt || Die "Cannot copy mountlist.txt from $MONDOTMP to data disk"
     2125    [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDOTMP/.
    23172126    [ $LVM != "false" ] && $MINDI_LIB/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm
    23182127    cat $minidir_root/$noof_disks/tmp/mountlist.txt >> $LOGFILE
     
    23202129    CreateDataDiskImagesFromTarballs $tardir $imagesdir $noof_disks
    23212130    FRIENDLY_OUTSTRING="Boot and data disk images were created."
    2322 # One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images
     2131    # One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images
    23232132    rmdir $tardir $bigdir
    23242133    rm -f $needlist
     
    23422151
    23432152
    2344 
    23452153Prompt() {
    23462154    echo -en "$1"
    23472155    read line
    23482156}
    2349 
    23502157
    23512158
     
    23552162    i=0
    23562163    while [ "$i" -le "32" ] && [ "$incoming" = "" ] ; do
    2357     i=$(($i+1))
    2358     read incoming
     2164        i=$(($i+1))
     2165        read incoming
    23592166    done
    23602167    echo "$incoming"
    23612168}
    2362 
    23632169
    23642170
     
    23762182            [ -h "$minidir_root/$diskno/$fname" ] && MoveHyperlinkSensibly $fname $minidir_root $diskno $noof_disks
    23772183        done
    2378     diskno=$(($diskno+1))
    2379     done
    2380 
     2184        diskno=$(($diskno+1))
     2185    done
    23812186
    23822187    cd $old_pwd
    23832188    return
    2384 
    2385 
    2386 
    2387 # do some awk/gawk stuff
    2388     cd $minidir_root
    2389     awk_loc=`find -name awk`
    2390     gawk_loc=`find -name gawk`
    2391     if [ "$awk_loc" = "" ] && [ "$gawk_loc" != "" ] ; then
    2392         for i in $gawk_loc ; do HackAwk $i gawk ; done
    2393     elif [ "$gawk_loc" = "" ] && [ "$awk_loc" != "" ] ; then
    2394         for i in $awk_loc ; do HackAwk $i awk ; done
    2395     elif [ "$gawk_loc" != "" ] && [ "$awk_loc" != "" ] ; then
    2396         echo -en "Gawk/awk found. Good.\r"
    2397     else
    2398         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? :-)"
    2399     fi
    2400     cd $old_pwd
    24012189}
    24022190
     
    24042192ReplaceIndividualLine() {
    24052193    local orig_file new_file lino newstring lines_total lines_remaining
     2194
    24062195    orig_file=$1.orig
    24072196    mv -f $1 $orig_file || Die "Cannot move $1 to $orig_file"
     
    24102199    newstring="$3"
    24112200    if [ "$lino" = "" ] || [ "$lino" -lt "1" ] ; then
    2412     echo "Can't find string" >> $LOGFILE
    2413     return 1
     2201        echo "Can't find string" >> $LOGFILE
     2202        return 1
    24142203    fi
    24152204    lines_total=`wc -l $orig_file | gawk '{print $1;}'`
     
    24202209    tail -n$lines_remaining $orig_file >> $new_file
    24212210    echo "Replace line $lino of $new_file with user-specified line, '$newstring'" >> $LOGFILE
    2422 #    cp -f $new_file /tmp/init.new
    24232211    [ -x "$orig_file" ] && chmod +x $new_file
    24242212    rm -f $orig_file
     
    24342222    done
    24352223}
    2436 
    24372224
    24382225
     
    24412228    device=$1
    24422229    if [ "`echo "$device" | grep -F "/dev/md"`" != "" ] ; then
    2443     res=`SizeOfRaidPartition $device`
    2444     [ "$res" = "" ] && Die "Cannot find $device's size - is your /etc/raidtab sane?"
    2445     echo "$res"
    2446     return 0
    2447     fi
    2448 #    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/-//`
    2449 # patch from Bill <bill@iwizard.biz> - 2003/08/25
     2230        res=`SizeOfRaidPartition $device`
     2231        [ "$res" = "" ] && Die "Cannot find $device's size - is your /etc/raidtab sane?"
     2232        echo "$res"
     2233        return 0
     2234    fi
     2235    # patch from Bill <bill@iwizard.biz> - 2003/08/25
    24502236    res=`$FDISK -s $device`
    24512237    echo "------- $FDISK -l $device log ------------" >> $LOGFILE
    24522238    cat $FDISKLOG >> $LOGFILE
    24532239    echo "------- $FDISK log end ------------" >> $LOGFILE
    2454 # end patch
     2240    # end patch
    24552241    [ "$res" = "" ] && res=`df -k -P -x supermount | tr -s '\t' ' ' | grep -F "$device " | cut -d' ' -f2`
    24562242    [ "$res" = "" ] && res="-1"
     
    24672253
    24682254    for real_dev in `GetRaidDevMembers $1` ; do
    2469     tmp=`SizeOfPartition $real_dev`
    2470     [ "$tmp" -lt "$smallest_size" ] && smallest_size=$tmp
     2255        tmp=`SizeOfPartition $real_dev`
     2256        [ "$tmp" -lt "$smallest_size" ] && smallest_size=$tmp
    24712257    done
    24722258
    24732259    if [ "$smallest_size" = "$silly" ] ; then
    2474     echo "-1"
    2475     return 1
    2476     else
    2477     echo "$smallest_size"
    2478     return 0
    2479     fi
    2480 }
    2481 
    2482 
    2483 
    2484 
     2260        echo "-1"
     2261        return 1
     2262    else
     2263        echo "$smallest_size"
     2264        return 0
     2265    fi
     2266}
    24852267
    24862268
     
    24882270{
    24892271    local tempfile
    2490     tempfile=$TMP_ROOT/$$.strip.txt
     2272
     2273    tempfile=$MONDOTMP/$$.strip.txt
    24912274    cp -f $1 $tempfile
    24922275    $AWK '{if (substr($0,0,1)!="#" || substr($0,0,3)=="#!/") {print $0;};}' $tempfile > $1
     
    24962279
    24972280
    2498 
    2499 
    2500 
    2501 
    25022281SplitDirectoryIntoMinidirs() {
    25032282    local bigdir minidir_root i noof_disks old_pwd res
     2283
    25042284    bigdir=$1
    25052285    minidir_root=$2
     
    25092289    noof_disks=$?
    25102290    if [ "$noof_disks" -eq "0" ] ; then
    2511     echo "Failed to fit data into several dirs."
     2291        echo "Failed to fit data into several dirs."
    25122292        return 0
    25132293    fi
    25142294    RejigHyperlinks $minidir_root $noof_disks
    25152295    rm -Rf $bigdir/*
    2516    return $noof_disks
    2517 }
    2518 
     2296    return $noof_disks
     2297}
    25192298
    25202299
     
    25222301{
    25232302    local tmpfile
    2524     tmpfile=$TMP_ROOT/stripped.$$.dat
     2303
     2304    tmpfile=$MONDOTMP/stripped.$$.dat
    25252305    [ -d "$1" ] || [ -h "$1" ] && return
    25262306    cp -f $1 $tmpfile
    25272307    strip $tmpfile 2> /dev/null
    25282308    if [ "$?" -eq "0" ] ; then
    2529     cp -f $tmpfile $1
    2530     echo "Stripped binary $2" >> $LOGFILE
     2309        cp -f $tmpfile $1
     2310        echo "Stripped binary $2" >> $LOGFILE
    25312311    fi
    25322312    rm -f $tmpfile
     
    25532333
    25542334
    2555 
    25562335TryToFindKernelPath() {
    25572336    local fname incoming res fkern_ver we_want_version possible_kernels noof_kernels kernelpath kdate duff_kernels
     2337
    25582338    we_want_version=`uname -r`
    25592339    possible_kernels=""
     
    25662346    fi
    25672347    for fname in `find $root -maxdepth 2 -type f | grep -F lin | grep -Ev '^/proc/|^/net/'` ; do
    2568     [ ! -e "$fname" ] && continue
     2348        [ ! -e "$fname" ] && continue
    25692349        [ "$fname" = "/boot/vmlinuz.shipped" ] && [ -f "/boot/vmlinuz" ] && continue; # ignore SuSE's extra kernel
    2570     file $fname | grep -q gzip
    2571     if [ "$?" -eq "0" ] ; then
    2572         # Used by ia64
     2350        file $fname | grep -q gzip
     2351        if [ "$?" -eq "0" ] ; then
     2352            # Used by ia64
    25732353            fkern_ver=`gzip -cd $fname | strings 2> /dev/null | grep "[2-9]+*[.][0-9]+*[.][0-9]+*[^\@]*@"`
    2574     else
     2354        else
    25752355            fkern_ver=`strings $fname 2> /dev/null | grep "[2-9]+*[.][0-9]+*[.][0-9]+*[^\@]*@"`
    2576     fi
     2356        fi
    25772357        [ "$fkern_ver" = "" ] && continue
    2578 #   echo "$fname --> $fkern_ver (but we want $we_want_version)" >> /dev/stderr
    25792358        [ "`echo "$fkern_ver" |grep -F "$we_want_version "`" = "" ] && continue
    2580     [ -f "$fname" ] || continue
    2581     [ -h "$fname" ] && continue
    2582     kdate=`uname -v | $AWK '{for(i=1;i<NF;i++){if(index($i,":")){print $i;};};}' | $AWK '{print $NF;}'`
    2583     file $fname | grep -q gzip
    2584     if [ "$?" -eq "0" ] ; then
    2585         # Used by ia64
    2586         if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
    2587             LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it...\n"
    2588             duff_kernels="$fname $duff_kernels"
    2589         else
     2359        [ -f "$fname" ] || continue
     2360        [ -h "$fname" ] && continue
     2361        kdate=`uname -v | $AWK '{for(i=1;i<NF;i++){if(index($i,":")){print $i;};};}' | $AWK '{print $NF;}'`
     2362        file $fname | grep -q gzip
     2363        if [ "$?" -eq "0" ] ; then
     2364            # Used by ia64
     2365            if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
     2366                LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it...\n"
     2367                duff_kernels="$fname $duff_kernels"
     2368            else
    25902369                [ "`echo "$fname" | grep -F "vmlinux"`" ] && continue
    25912370                possible_kernels="$fname $possible_kernels"
    2592         fi
    2593     else
    2594         if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
    2595             LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it...\n"
    2596             duff_kernels="$fname $duff_kernels"
     2371            fi
    25972372        else
     2373            if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then
     2374                LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it...\n"
     2375                duff_kernels="$fname $duff_kernels"
     2376            else
    25982377                [ "`echo "$fname" | grep -F "vmlinux"`" ] && continue
    25992378                possible_kernels="$fname $possible_kernels"
    2600         fi
    2601     fi
     2379            fi
     2380        fi
    26022381    done
    26032382    if [ ! "$possible_kernels" ] && uname -a | grep Knoppix > /dev/null ; then
    2604     possible_kernels=`find /boot/vmlinuz-2.* | tail -n1`
     2383        possible_kernels=`find /boot/vmlinuz-2.* | tail -n1`
    26052384    fi
    26062385    if [ ! "$possible_kernels" ] ; then
     
    26182397    if [ "$noof_kernels" -eq "0" ] ; then
    26192398        LogIt "Could not find your kernel.\n"
    2620     if [ -e "/boot/vmlinuz" ] ; then
    2621         LogIt "Using /boot/vmlinuz as a last resort.\n"
    2622         output=/boot/vmlinuz
     2399        if [ -e "/boot/vmlinuz" ] ; then
     2400            LogIt "Using /boot/vmlinuz as a last resort.\n"
     2401            output=/boot/vmlinuz
    26232402        else
    2624         output=""
    2625     fi
     2403            output=""
     2404        fi
    26262405    elif [ "$noof_kernels" -eq "1" ] ; then
    26272406        kernelpath=`echo "$possible_kernels" | sed s/' '//`
     
    26312410        for i in $possible_kernels ; do
    26322411            if echo $i | grep "`uname -r`" ; then
    2633         LogIt "OK, I used my initiative and found that "
     2412                LogIt "OK, I used my initiative and found that "
    26342413                LogIt "$i is probably your kernel.\n "
    2635         output="$i"
    2636         return
    2637         fi
     2414                output="$i"
     2415                return
     2416            fi
    26382417        done
    2639     if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null ; then
    2640         output=/boot/vmlinuz
    2641         echo "Schlomo, this one's for you." >> $LOGFILE
    2642     else
     2418        if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null ; then
     2419            output=/boot/vmlinuz
     2420            echo "Schlomo, this one's for you." >> $LOGFILE
     2421        else
    26432422            LogIt "Two or more possible kernels found. You may specify any one of them and the \n"
    2644         LogIt "boot disks will still work, probably. If one does not work, try another.\n"
     2423            LogIt "boot disks will still work, probably. If one does not work, try another.\n"
    26452424            LogIt "$possible_kernels\n"
    26462425            echo ""
    2647     fi
     2426        fi
    26482427    fi
    26492428    echo "$output" | tr -s ' ' '\n' | sort -u | tr '\n' ' '
    26502429}
    2651 
    2652 
    2653 
    26542430
    26552431
     
    26572433    local bigdir minidir_root noof_disks diskno list_of_files filename old_pwd progress
    26582434    local i retval noof_disks total_files list_of_devs
     2435
    26592436    bigdir=$1
    26602437    minidir_root=$2
     
    26802457    for filename in $list_of_files ; do
    26812458        AddFileToDir $filename $minidir_root $noof_disks
    2682     i=$?
    2683     if [ "$i" -gt "$noof_disks" ] ; then
    2684         noof_disks=$i
    2685         echo -en "\r\t\t\t\t\t\t($noof_disks disks)"
    2686     fi
    2687     if [ "$i" -eq "0" ] ; then
    2688         LogIt "Cannot add file $filename to minidir $minidir_root\n"
    2689         retval=$(($retval+1))
    2690     fi
     2459        i=$?
     2460        if [ "$i" -gt "$noof_disks" ] ; then
     2461            noof_disks=$i
     2462            echo -en "\r\t\t\t\t\t\t($noof_disks disks)"
     2463        fi
     2464        if [ "$i" -eq "0" ] ; then
     2465            LogIt "Cannot add file $filename to minidir $minidir_root\n"
     2466            retval=$(($retval+1))
     2467        fi
    26912468        progress=$(($progress+1))
    2692     echo -en "\r\t\t\t\t\t\t\t\t$(($progress*100/$total_files))% complete\r"
     2469        echo -en "\r\t\t\t\t\t\t\t\t$(($progress*100/$total_files))% complete\r"
    26932470    done
    26942471    cd $old_pwd
     
    26962473    rm -Rf $minidir_root/compressed
    26972474    if [ "$retval" -gt "0" ] ; then
    2698     return 0
    2699     else
    2700     return $noof_disks
    2701     fi
    2702 }
    2703 
     2475        return 0
     2476    else
     2477        return $noof_disks
     2478    fi
     2479}
    27042480
    27052481
    27062482TurnTgzIntoRdz() {
    27072483    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
     2484
    27082485    tgz_dir_fname=$1
    27092486    rdz_fname=$2
     
    27132490    maxsize=$(($disksize-$kernelsize))
    27142491    maxsize=$(($maxsize*2)); # to allow for compression of 50%
    2715     tempfile=$TMP_ROOT/temp.rd
    2716     mountpoint=$TMP_ROOT/mnt1
     2492    tempfile=$MONDOTMP/temp.rd
     2493    mountpoint=$MONDOTMP/mnt1
    27172494    res=0
    27182495    echo -en "..."
     
    27212498    mke2fs -b 1024 -m 1 -i 2048 -F $tempfile >> $LOGFILE 2>> $LOGFILE
    27222499
    2723     [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$
    2724     rm -f /tmp/mke2fs.$$
     2500    [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.log
     2501    rm -f $MONDOTMP/mke2fs.log
    27252502    echo -en "..."
    27262503    mkdir -p $mountpoint
     
    27292506    old_pwd=`pwd`
    27302507    cd $mountpoint
    2731 #    [ -e "$MINDI_LIB/memtest.img" ] && echo "Yep, this is a multi-function CD" > MULTIFUNC
    27322508    cp -Rdf $tgz_dir_fname/* . 2>> $LOGFILE >> $LOGFILE
    27332509    tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz"
     
    27372513    cd ..
    27382514
    2739 # add insmod.static and insmod.static.old if (a) they exist and (b) this is a 64-bit distro
    2740 #    if [ "`uname -a | grep x86`" ] || [ "`uname -a | grep amd64`" ] ; then
    2741 
    27422515    for w in insmod.static insmod.static.old ; do
    2743     s=`which $w 2> /dev/null`
    2744     if [ -e "$s" ] ; then
    2745         cp --parents -af $s .
    2746 #       LogIt "Copying $s to initrd"
    2747     fi
    2748     done
    2749 
    2750 #    fi
     2516        s=`which $w 2> /dev/null`
     2517        if [ -e "$s" ] ; then
     2518            cp --parents -af $s .
     2519        fi
     2520    done
    27512521
    27522522    mkdir -p tmp
     
    27552525        mkdir -p mnt/$w
    27562526    done
    2757     if [ "$RUN_AFTER_INITIAL_BOOT_PHASE" ] ; then
    2758     ReplaceIndividualLine sbin/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" sbin/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"
    2759     fi
     2527    #if [ "$RUN_AFTER_INITIAL_BOOT_PHASE" ] ; then
     2528        #ReplaceIndividualLine sbin/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" sbin/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"
     2529    #fi
    27602530    if [ "$RUN_AFTER_BOOT_PHASE_COMPLETE" ] ; then
    2761     ReplaceIndividualLine sbin/init `grep -n "#ABSORBENTANDYELLOWANDPOROUSISHE#" sbin/init | cut -d':' -f1` "$RUN_AFTER_BOOT_PHASE_COMPLETE"
     2531        ReplaceIndividualLine sbin/init `grep -n "#ABSORBENTANDYELLOWANDPOROUSISHE#" sbin/init | cut -d':' -f1` "$RUN_AFTER_BOOT_PHASE_COMPLETE"
    27622532    fi
    27632533
     
    27712541    old_pwd=`pwd`
    27722542    if [ "$YOUR_KERNEL_SUCKS" ] ; then
    2773         cd $TMP_ROOT
     2543        cd $MONDOTMP
    27742544        floppy_modules_path=lib/modules/$FAILSAFE_KVER
    27752545    else
     
    27952565        list_of_groovy_mods="$CDROM_MODS `WhichOfTheseModulesAreLoaded "$SCSI_MODS"`"
    27962566    fi
    2797     if [ -e "$MONDO_TMP/NFS-DEV" ] ; then
     2567    if [ -e "$MONDOTMP/NFS-DEV" ] ; then
    27982568        # For PXE boot
    27992569        list_of_groovy_mods="$list_of_groovy_mods $NET_MODS"
     
    28052575    for i in $floppy_modules ; do
    28062576        [ -e "$i" ] && s=`du -sk $i | cut -f1` || s=""
    2807         [ "$YOUR_KERNEL_SUCKS" ] && i=$TMP_ROOT/$i
     2577        [ "$YOUR_KERNEL_SUCKS" ] && i=$MONDOTMP/$i
    28082578        echo "Adding $i ($s KB) to the rootfs" >> $LOGFILE
    28092579        cp -df $i $mountpoint/ || LogIt "Unable to copy $i to $mountpoint\n"
    28102580        [ "`echo "$i" | grep -F ".gz"`" ] && gunzip -f $mountpoint/`basename $i`
    28112581    done
    2812 #    if [ -e "/dev/.devfsd" ] ; then
    2813 #   echo "Copying devfs stuff to ramdisk" >> $LOGFILE
    2814 #   for i in /dev /etc/devfsd.conf /etc/modules.devfs /lib/dev-state ; do
    2815 #       cp --parents -pRdf $i $mountpoint/ 2>> $LOGFILE
    2816 #   done
    2817 #    fi
    28182582    if [ ! -e "/sbin/devfsd" ] || [ "$disksize" -lt "2880" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then
    28192583        echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE
     
    28212585        [ "$disksize" -lt "2880" ] && echo "...because disksize = $disksize" >> $LOGFILE
    28222586        [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] && echo "...because kernel is failsafe" >> $LOGFILE
    2823 #        ls -l $mountpoint/sbin/devfsd &> /dev/null || Die "Can't find devfsd daemon on ramdisk"
    28242587        rm -f $mountpoint/sbin/devfsd
    28252588    fi
     
    28302593    if [ "`DidMondoCallMe`" ] ; then
    28312594        MakeMondoConfigFile $mountpoint/tmp/mondo-restore.cfg
    2832         cp -f $mountpoint/tmp/mondo-restore.cfg $MONDO_TMP &> /dev/null
    2833         cp -f $TMP_ROOT/mountlist.txt $mountpoint/tmp/ || Die "Cannot copy mountlist to ramdisk"
     2595        cp -f $mountpoint/tmp/mondo-restore.cfg $MONDOTMP &> /dev/null
     2596        cp -f $MONDOTMP/mountlist.txt $mountpoint/tmp/ || Die "Cannot copy mountlist to ramdisk"
    28342597        echo -en "$FILES_IN_FILELIST" > $mountpoint/tmp/FILES-IN-FILELIST
    28352598        echo -en "$LAST_FILELIST_NUMBER" > $mountpoint/tmp/LAST-FILELIST-NUMBER
     
    28552618
    28562619
    2857 
    28582620WhichOfTheseModulesAreLoaded() {
    28592621    local modname loaded_modules
    28602622    loaded_modules=" `lsmod | tr -s ' ' '\t' | cut -f1 | grep -Fvx "Modules" | tr '\n' ' '` "
    28612623    for modname in $1 ; do
    2862     [ "`echo "$loaded_modules" | grep -F " $modname "`" ] && echo "$modname"
    2863     done
    2864 }
    2865 
    2866 
     2624        [ "`echo "$loaded_modules" | grep -F " $modname "`" ] && echo "$modname"
     2625    done
     2626}
    28672627
    28682628
     
    28832643        diskno=$(($diskno+1))
    28842644        echo -n "..."
    2885     cp -pRdf * $minidir_root/all
     2645        cp -pRdf * $minidir_root/all
    28862646    done
    28872647    mkdir -p $minidir_root/all/tmp
     
    28902650    if [ "`DidMondoCallMe`" ] ; then
    28912651        for q in filelist.full.gz biggielist.txt ; do
    2892             [ ! -e "$MONDO_TMP/$q" ] && Die "Cannot find $MONDO_TMP/$q"
    2893             cp -pRdf $MONDO_TMP/$q tmp/
     2652            [ ! -e "$MONDOTMP/$q" ] && Die "Cannot find $MONDOTMP/$q"
     2653            cp -pRdf $MONDOTMP/$q tmp/
    28942654        done
    28952655        mkdir -p $minidir_root/all/tmp
     
    29062666
    29072667
    2908 
    2909 # BERLIOS: This function is wrong
    2910 # Should be recoded. Desactivated in between
    2911 
    2912 #ListUnsavedKernelModules() {
    2913     #local fname modules
    2914     #fname=/tmp/$RANDOM.$$.$RANDOM
    2915     #lsmod | sed -n '2,$s/ .*//p' > $fname
    2916     #modules=`sort $fname | uniq -d2 | tr '\n' ' '`
    2917     #rm -f $fname
    2918     #[ "$modules" ] && echo "Unsaved kernel modules: $modules" >> $LOGFILE
    2919 #}
    2920 
    2921 
    2922 
    2923 
    2924 
    29252668##############################################################################
    29262669#----------------------------------- main -----------------------------------#
    29272670##############################################################################
    29282671
    2929 
    2930 #AWK=`which gawk`
    2931 #LocateDeps $1
    2932 #MakeModuleLoadingScript /tmp/load-modules.sh
    2933 #exit 0
    2934 
    2935 
    2936 #cat /etc/mindi/deplist.txt | GenerateGiantDependencyList /tmp/deplist.old 200
    2937 #exit 0
    2938 
    2939 
    2940 
    2941 if [ "$1" = "-V" ] || [ "$1" = "-v" ] || [ "$1" = "--version" ] || [ "$1" = "-version" ] ; then
    2942     echo "mindi v$MINDI_VERSION"
    2943     exit 0
    2944 fi
    29452672
    29462673> $LOGFILE
     
    29692696# modprobe.conf file is created in MakeModuleLoadingScript. AL041128.
    29702697if [ -d "/etc/modprobe.d" ] && [ `uname -r | cut -c1-3` == "2.6" ] ; then
    2971   TMPMODPROBE_FLAG="Y"
     2698    TMPMODPROBE_FLAG="Y"
    29722699else
    2973   TMPMODPROBE_FLAG="N"
    2974   [ -e "/etc/modprobe.conf" ] && [ ! -e "/etc/modules.conf" ] && ln -sf /etc/modprobe.conf /etc/modules.conf
    2975   [ ! -e "/etc/modules.conf" ] && Die "/etc/modules.conf not found; you may have to create a softlink from /etc/conf.modules to /etc/modules.conf; of course, all good distros use modules.conf anyway..."
     2700    TMPMODPROBE_FLAG="N"
     2701    [ -e "/etc/modprobe.conf" ] && [ ! -e "/etc/modules.conf" ] && ln -sf /etc/modprobe.conf /etc/modules.conf
     2702    [ ! -e "/etc/modules.conf" ] && Die "/etc/modules.conf not found; you may have to create a softlink from /etc/conf.modules to /etc/modules.conf; of course, all good distros use modules.conf anyway..."
    29762703fi
    29772704FixPathIfBroken
    29782705[ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep -E "2\.[46]" | cut -d' ' -f1`
    29792706AbortIfMkfsVfatMissing
    2980 ### BCO
     2707### BERLIOS
    29812708### Fix as it's not mandatory on ia64
    29822709if [ "$ARCH" = "ia64" ] ; then
     
    29862713    FindLiloBinary
    29872714fi
    2988 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
    2989 rm -f /tmp/mindi_lo
     2715# BERLIOS: Remove as too dangerous and now useless
     2716#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
    29902717trap "Aborted" SIGTERM
    29912718DONE="\r\t\t\t\t\t\t\t\tDone.         "
     
    29932720BIGNO=0
    29942721MAX_COMPRESSED_SIZE=1300
    2995 imagesdir=/root/images/mindi
    2996 mkdir -p $imagesdir
    29972722kernelpath=""
    2998 MONDO_ROOT=/tmp/mindilinux/mondo-root
     2723MONDO_ROOT=$TMPMONDO/mondo-root
    29992724mkdir -p $MONDO_ROOT
    30002725
     
    30292754    if [ "$1" = "--findkernel" ] ; then
    30302755        res=`TryToFindKernelPath`
    3031 #    2> /dev/null`
    30322756        if [ "$res" = "" ] ; then
    3033             exit 1
     2757            MindiExit -1
    30342758        else
    30352759            echo "$res"
    3036             exit 0
     2760            MindiExit 0
    30372761        fi
    30382762    elif [ "$1" = "--makemountlist" ] ; then
    30392763        [ ! "$2" ] && Die "Please specify the output file"
    30402764        MakeMountlist $2
    3041         exit $?
    3042     elif [ "$1" = " --version" ] || [ "$1" = "-v" ] ; then
    3043     echo "Mindi v$MINDI_VERSION"
    3044         exit 0
     2765        MindiExit $?
     2766    elif [ "$1" = "-V" ] || [ "$1" = "-v" ] || [ "$1" = "--version" ] || [ "$1" = "-version" ] ; then
     2767        echo "Mindi v$MINDI_VERSION"
     2768        MindiExit 0
    30452769    elif [ "$#" -ge "9" ] && [ "$1" = "--custom" ] ; then
    3046     TMP_ROOT=$2
    3047     MONDO_TMP=$2
    3048     imagesdir=$3
    3049     kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath=""
     2770        MONDOTMP=$2
     2771        BIDON=$3
     2772        kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath=""
    30502773###
    30512774### Sq-Modification...
     
    30542777###
    30552778        kernelname=`echo $kernelpath | cut -d'-' -f2-`
    3056     LogIt "kernelname = $kernelname\n"
    3057     LogIt "kernelpath = $kernelpath\n"
     2779        LogIt "kernelname = $kernelname\n"
     2780        LogIt "kernelpath = $kernelpath\n"
    30582781        if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ]
    30592782        then
     
    30672790### end of Sq-Modification
    30682791###
    3069     TAPEDEV=$5
    3070     TAPESIZE=$6
    3071     FILES_IN_FILELIST=$7
    3072     USE_LZO=$8
    3073     CDRECOVERY=$9
     2792        TAPEDEV=$5
     2793        TAPESIZE=$6
     2794        FILES_IN_FILELIST=$7
     2795        USE_LZO=$8
     2796        CDRECOVERY=$9
    30742797        if [ "${10}" = "(null)" ] || [ "${10}" = "" ] ; then
    30752798            IMAGE_DEVS=""
     
    30772800            IMAGE_DEVS="`echo "${10}" | tr '|' ' '`"
    30782801        fi
    3079     if [ "${11}" ] ; then
    3080         LILO_OPTIONS=""
    3081 #       LogIt "LILO will use conservative settings, to be compatible with older BIOSes."
    3082     fi
    3083     LAST_FILELIST_NUMBER=${12}
     2802        if [ "${11}" ] ; then
     2803            LILO_OPTIONS=""
     2804    #       LogIt "LILO will use conservative settings, to be compatible with older BIOSes."
     2805        fi
     2806        LAST_FILELIST_NUMBER=${12}
    30842807        ESTIMATED_TOTAL_NOOF_SLICES=${13}
    30852808        EXCLUDE_DEVS="${14}"
    30862809        USE_COMP="${15}"
    30872810        USE_LILO="${16}"
    3088     USE_STAR="${17}"
    3089     INTERNAL_TAPE_BLOCK_SIZE="${18}"
     2811        USE_STAR="${17}"
     2812        INTERNAL_TAPE_BLOCK_SIZE="${18}"
    30902813        DIFFERENTIAL="${19}"
    30912814        NOT_BOOT="${20}"
    30922815        [ "$USE_COMP" = "" ] && USE_COMP=yes
    30932816        [ "$NOT_BOOT" = "" ] && NOT_BOOT=no
    3094     [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine.\n"
    3095     [ "$kernelpath" = "" ] && kernelpath=`TryToFindKernelPath`
     2817        [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine.\n"
     2818        [ "$kernelpath" = "" ] && kernelpath=`TryToFindKernelPath`
    30962819        kernelname=`echo $kernelpath | cut -d'-' -f2-`
    30972820        if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ]
     
    31032826           LogIt "Using modules for kernel: ${kernelname}\n"
    31042827        fi
    3105     [ "$CDRECOVERY" = "yes" ] && [ "$TAPEDEV" != "" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"
    3106         MONDO_ROOT=`echo $imagesdir | sed 's/\(.*\)\/.*/\1/'`
    3107     [ "$MONDO_ROOT" = "" ] && Die "MONDO_ROOT is undefined"
    3108     else
    3109     echo "Syntax: mindi (--custom ....)" >> /dev/stderr
    3110     exit 1
     2828        [ "$CDRECOVERY" = "yes" ] && [ "$TAPEDEV" != "" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"
     2829        MONDO_ROOT=`echo $CACHE_LOC | sed 's/\(.*\)\/.*/\1/'`
     2830        [ "$MONDO_ROOT" = "" ] && Die "MONDO_ROOT is undefined"
     2831    else
     2832        echo "Syntax: mindi (--custom ....)" >> /dev/stderr
     2833        MindiExit -1
    31112834    fi
    31122835fi
     
    31222845
    31232846
    3124 
    3125 
    3126 #ReplaceIndividualLine /tmp/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" /tmp/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"
    3127 #exit 0
    3128 
    3129 
    3130 #ListKernelModules
    3131 #exit 0
    3132 
    3133 
    3134 
    3135 
    31362847[ -e "$iso_cfg_file" ] || Die "Cannot find $iso_cfg_file"
    3137 rm -Rf $TMP_ROOT/mindilinux/*
    3138 TMP_ROOT=$TMP_ROOT/mindilinux/$$
    3139 mkdir -p $TMP_ROOT
    3140 mkdir -p $imagesdir
    31412848if [ ! "`DidMondoCallMe`" ] ; then
    31422849    LogIt "Mindi Linux mini-distro generator v$MINDI_VERSION\n"
     
    31612868if [ "$NOT_BOOT" != "" ] && [ "$NOT_BOOT" != "0" ] && [ "$NOT_BOOT" != "no" ] ; then
    31622869    LogIt "Just creating mondo-restore.cfg and a small all.tar.gz for Mondo. Nothing else.\n"
    3163     MakeMondoConfigFile $MONDO_TMP/mondo-restore.cfg
    3164     MakeMountlist $MONDO_TMP/mountlist.txt
    3165     mkdir -p $MONDO_TMP/small-all/tmp
    3166     cd $MONDO_TMP/small-all
    3167     cp -f $MONDO_TMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp || Die "Cannot copy small all.tar.gz"
    3168     tar -cv tmp | gzip -9 > $MONDO_TMP/all.tar.gz || Die "Cannot make small all.tar.gz"
     2870    MakeMondoConfigFile $MONDOTMP/mondo-restore.cfg
     2871    MakeMountlist $MONDOTMP/mountlist.txt
     2872    mkdir -p $MONDOTMP/small-all/tmp
     2873    cd $MONDOTMP/small-all
     2874    cp -f $MONDOTMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp || Die "Cannot copy small all.tar.gz"
     2875    tar -cv tmp | gzip -9 > $MONDOTMP/all.tar.gz || Die "Cannot make small all.tar.gz"
    31692876    sleep 2
    31702877    LogIt "Done. Exiting.\n"
    3171     exit 0
     2878    MindiExit 0
    31722879fi
    31732880
     
    31822889    fi
    31832890    if [ "$USE_OWN_KERNEL" = "yes" ]; then
    3184     YOUR_KERNEL_SUCKS=""
    3185     kernelpath=`TryToFindKernelPath`
    3186     if [ "$kernelpath" = "" ] ; then
    3187         echo -n "Please enter kernel path : "
    3188         read kernelpath
    3189     fi
    3190     else
    3191     YOUR_KERNEL_SUCKS="That's why you're using mine, dude. :-)"
     2891        YOUR_KERNEL_SUCKS=""
     2892        kernelpath=`TryToFindKernelPath`
     2893        if [ "$kernelpath" = "" ] ; then
     2894            echo -n "Please enter kernel path : "
     2895            read kernelpath
     2896        fi
     2897    else
     2898        YOUR_KERNEL_SUCKS="That's why you're using mine, dude. :-)"
    31922899    fi
    31932900fi
     
    32072914    LogIt "disks then it may still be a result of a problem with your kernel.\n"
    32082915    pwd=`pwd`
    3209     cd $TMP_ROOT
     2916    cd $MONDOTMP
    32102917    bzip2 -dc $MINDI_LIB/lib.tar.bz2 | tar -x || Die "Cannot unzip lib.tar.bz2"
    32112918    cd $pwd
    32122919    YOUR_KERNEL_SUCKS="Your kernel sucks"
    32132920fi
    3214 echo -e "Mindi's temp dir = $TMP_ROOT \nMindi's output dir=$imagesdir" >> $LOGFILE
     2921echo -e "Mindi's temp dir = $MONDOTMP \nMindi's output dir=$CACHE_LOC" >> $LOGFILE
    32152922[ "$(($RANDOM%64))" -eq "0" ] && LogIt "Dude, I've looked inside your computer and it's really dusty...\n"
    3216 rm -f /tmp/mindi.err.*.tgz
    32172923
    32182924[ "$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."
     
    32202926rm -f /root/images/mindi/{*img,*gz,*iso}
    32212927
    3222 PrepareDataDiskImages $imagesdir
     2928PrepareDataDiskImages $CACHE_LOC
    32232929noof_disks=$?
    32242930ramdisk_size=$(($size_of_all_tools+$EXTRA_SPACE))
     
    32292935if [ "$USE_LILO" = "yes" ] ; then
    32302936    if [ "$ARCH" = "ia64" ] ; then
    3231         PrepareBootDiskImage_LILO $imagesdir $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
    3232     else
    3233         if ! PrepareBootDiskImage_LILO $imagesdir 1722 $kernelpath $ramdisk_size ; then
     2937        PrepareBootDiskImage_LILO $CACHE_LOC $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
     2938    else
     2939        if ! PrepareBootDiskImage_LILO $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
    32342940            LogIt "Warning - failed to create 1.72MB boot image. Please reduce your kernel's size\n"
    32352941            LogIt "if you want to make a 1.72MB floppy disk.\n"
    32362942        fi
    3237         if ! PrepareBootDiskImage_LILO $imagesdir 2880 $kernelpath $ramdisk_size ;  then
     2943        if ! PrepareBootDiskImage_LILO $CACHE_LOC 2880 $kernelpath $ramdisk_size ;  then
    32382944            LogIt "Warning - failed to create 2.88MB floppy disk image.\n"
    32392945            LogIt "Please reduce your kernel's size\n"
    32402946            LogIt "if you want to make a 2.88MB floppy disk.\n"
    3241             PrepareBootDiskImage_LILO $imagesdir 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
     2947            PrepareBootDiskImage_LILO $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
    32422948        fi
    32432949    fi
    32442950else
    3245     if ! PrepareBootDiskImage_SYSLINUX $imagesdir 1722 $kernelpath $ramdisk_size ; then
     2951    if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
    32462952        LogIt "Warning - failed to create 1.72MB boot image. Please reduce your kernel's size\n"
    32472953        LogIt "if you want to make a 1.72MB floppy disk.\n"
    3248         if ! PrepareBootDiskImage_SYSLINUX $imagesdir 2880 $kernelpath $ramdisk_size ; then
     2954        if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 2880 $kernelpath $ramdisk_size ; then
    32492955            LogIt "Warning - failed to create 2.88MB floppy disk image.\n"
    32502956            LogIt "Please reduce your kernel's size\n"
    32512957            LogIt "if you want to make a 2.88MB floppy disk.\n"
    3252             PrepareBootDiskImage_SYSLINUX $imagesdir 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
     2958            PrepareBootDiskImage_SYSLINUX $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
    32532959        fi
    32542960    fi
    32552961fi
    3256 
    3257 
    32582962
    32592963[ -e "$MINDI_LIB/memtest.img" ] && BOOT_MEDIA_MESSAGE="$BOOT_MEDIA_MESSAGE\n\
    32602964...Or type 'memtest' to test your PC's RAM thoroughly.\n"
    32612965
    3262 
    32632966if [ ! "`DidMondoCallMe`" ] ; then
    3264     ListImagesForUser $imagesdir
     2967    ListImagesForUser $CACHE_LOC
    32652968    boot_dev=/dev/fd0u1722
    32662969    [ ! -e "$boot_dev" ] && mknod $boot_dev b 2 60
     
    32682971    [ ! -e "$boot_dev" ] && Die "Oh Lord, will you PLEASE tell the vendor to create the 1.72MB devices in /dev?"
    32692972    if [ "$PROMPT_WRITE_BOOT_FLOPPIES" = "yes" ]; then
    3270         OfferToCopyImagesToDisks $imagesdir $boot_dev $FDDEVICE
    3271     fi
    3272     OfferToMakeBootableISO $imagesdir
     2973        OfferToCopyImagesToDisks $CACHE_LOC $boot_dev $FDDEVICE
     2974    fi
     2975    OfferToMakeBootableISO $CACHE_LOC
    32732976    LogIt "Finished.\n"
    32742977elif [ "$TAPEDEV" ] ; then
    32752978    mkdir -p /root/images/mindi
    32762979    rm -f /root/images/mindi/{*img,*gz,*iso}
    3277     OfferToMakeBootableISO $imagesdir
    3278     if [ -e "$imagesdir/all.tar.gz" ] ; then
    3279         cp -f $imagesdir/all.tar.gz $MONDO_TMP/
    3280     else
    3281     Die "Cannot find all.tar.gz, to be written to tape"
     2980    OfferToMakeBootableISO $CACHE_LOC
     2981    if [ -e "$CACHE_LOC/all.tar.gz" ] ; then
     2982        cp -f $CACHE_LOC/all.tar.gz $MONDOTMP/
     2983    else
     2984        Die "Cannot find all.tar.gz, to be written to tape"
    32822985    fi
    32832986else
    3284     OfferToMakeBootableISO $imagesdir
     2987    OfferToMakeBootableISO $CACHE_LOC
    32852988fi
    3286 if [ "$imagesdir" != "/root/images/mindi" ] ; then
    3287     for i in `find $imagesdir -maxdepth 1 -name "*.iso" -o -name "*.img"` ; do
    3288     cp -f $i /root/images/mindi || LogIt "[line 3260] Cannot copy $i to /root/images/mindi\n"
    3289     done
    3290 fi
    3291 [ "$TMP_ROOT" != "/tmp" ] && rm -Rf $TMP_ROOT
    32922989# cleanup
    3293 rm -fR /tmp/mountlist.txt.$$ $FDISKLOG /tmp/mindilinux
     2990rm -Rf $MONDOTMP $FDISKLOG
    32942991LogIt "$FRIENDLY_OUTSTRING\n"
    3295 #ListUnsavedKernelModules
    32962992for mtpt in $FLOPPY_WAS_MOUNTED ; do
    32972993    mount $mtpt
    32982994done
    3299 echo "Mindi is exiting" >> $LOGFILE
    3300 echo "End date : `date`" >> $LOGFILE
    3301 exit 0
     2995MindiExit 0
Note: See TracChangeset for help on using the changeset viewer.