Changeset 1043 in MondoRescue for trunk/mindi/mindi


Ignore:
Timestamp:
Jan 8, 2007, 11:31:22 PM (14 years ago)
Author:
Bruno Cornec
Message:

merge -r978:1042 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mindi/mindi

    r979 r1043  
    9393TAPE_MODS="ht st osst ide-tape ide_tape"
    9494SCSI_MODS="3w-xxxx 53c7,8xx a100u2w a320raid aacraid advansys aha152x aha1542 aha1740 aic79xx aic79xx_mod aic7xxx aic7xxx_mod aic7xxx_old AM53C974 atp870u BusLogic cciss cpqfc dmx3191d dpt_i2o dtc eata eata_dma eata_pio fdomain gdth g_NCR5380 i2o_block i2o_core ide-scsi ieee1394 imm in2000 initio ips iscsi isp megaraid mptbase mptscsih NCR53c406a ncr53c8xx nsp32 pas16 pci2000 pci2220i pcmcia ppa psi240i qla1280 qla2200 qla2300 qlogicfas qlogicfc qlogicisp raw1394 scsi_debug scsi_mod sd_mod seagate sg sim710 sr_mod sym53c416 sym53c8xx sym53c8xx_2 t128 tmscsim u14-34f ultrastor wd7000 vmhgfs"
    95 IDE_MODS="ide ide-generic ide-detect ide-mod ide-disk ide-cd ide_cd ide-cs ide-core ide_core libata edd paride ata_piix libata via82cxxx generic"
     95IDE_MODS="ide ide-generic ide-detect ide-mod ide-disk ide-cd ide_cd ide-cs ide-core ide_core libata edd paride ata_piix libata via82cxxx generic nvidia ahci"
    9696PCMCIA_MODS="pcmcia_core ds yenta_socket"
    9797USB_MODS="usb-storage usb-ohci usb-uhci usbcore usb_storage hid uhci_hcd ehci_hcd uhci-hcd ehci-hcd usbkbd usbhid"
    9898CDROM_MODS="$TAPE_MODS $FLOPPY_MODS $IDE_MODS af_packet cdrom isocd isofs inflate_fs nls_iso8859-1 nls_cp437 sg sr_mod zlib_inflate $USB_MODS $PCMCIA_MODS"
    99 NET_MODS="sunrpc nfs nfs_acl lockd loop mii 3c59x e100 bcm5700 bnx2 e1000 eepro100 ne2k-pci tg3 pcnet32 8139cp 8139too 8390 vmxnet"
    100 EXTRA_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"
     99NET_MODS="sunrpc nfs nfs_acl lockd loop mii 3c59x e100 bcm5700 bnx2 e1000 eepro100 ne2k-pci tg3 pcnet32 8139cp 8139too 8390 vmxnet vmnet"
     100NET_MODS="sunrpc nfs nfs_acl lockd loop mii 3c59x e100 bcm5700 bnx2 e1000 eepro100 ne2k-pci tg3 pcnet32 8139cp 8139too 8390 vmxnet vmnet"
     101EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 lvm-mod dm-mod dm-snapshot dm-zero dm-mirror jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache"
    101102
    102103BOOT_MEDIA_MESSAGE="$mindi_boot_msg"
     
    139140        echo -en "label memtest\n  kernel memdisk\n  append initrd=memtest.img\n\n"
    140141    fi
    141 }
    142 
    143 
    144 AbortIfYourDistroIsAPieceOfStercus() {
    145     which which > /dev/null 2> /dev/null || Die "Please install 'which'."
    146     which strings > /dev/null 2> /dev/null || Die "Please install binutils and libbinutils; you have no 'strings' executable."
    147     which gawk > /dev/null 2> /dev/null || Die "Gawk is missing from your computer. Please install gawk. You may find the package on Debian's website. How did I know you're running Debian? Because only Debian would be stupid enough not to include gawk in your distribution."
    148     which gawk > /dev/null 2> /dev/null && AWK=`which gawk 2>/dev/null` || AWK="`which awk 2>/dev/null`"
    149     if which awk &> /dev/null ; then
    150         if ! which gawk &> /dev/null ; then
    151             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"
    152         fi
    153     fi
    154     which mke2fs > /dev/null 2> /dev/null || Die "Please put mke2fs in system path"
    155     [ ! -e "$FDISK" ] && Die "Cannot find (s)fdisk"
    156 }
    157 
    158 
    159 AbortIfMkfsVfatMissing() {
    160     #if grep -F "vfat" /etc/fstab &> /dev/null ; then
    161         if ! which mkfs.vfat &> /dev/null ; then
    162             Die "mkfs.vfat missing from your filesystem - please install your dosfstools RPM or DEB package. Perhaps your PATH environmental variable is broken, too?"
    163         fi
    164     #fi
    165142}
    166143
     
    610587
    611588
    612 FindHomeOfMindiAndMondo() {
    613     [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
    614     echo "MINDI_LIB = $MINDI_LIB" >> $LOGFILE
    615     echo "MINDI_SBIN = $MINDI_SBIN" >> $LOGFILE
    616     [ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
    617     echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    618     echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
    619 }
    620 
    621 
    622589FindIsolinuxBinary() {
    623590    ISOLINUX=/usr/lib/isolinux.bin
     
    642609    else
    643610        LILO_EXE=`which false`
    644     fi
    645 }
    646 
    647 
    648 FindELiloBinary() {
    649     if which elilo &> /dev/null ; then
    650         LILO_EXE=elilo
    651     else
    652         LILO_EXE=`which false`
    653     fi
    654 }
    655 
    656 
    657 FixPathIfBroken() {
    658     if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then
    659         PATH=$PATH:/sbin:/usr/sbin
    660         export PATH
    661         echo "Your PATH did not include /sbin or /usr/sbin. I have fixed that, temporarily." >> $LOGFILE
    662         echo "However, you may wish to ask your vendor to provide a permanent fix..." >> $LOGFILE
    663         echo "You might like to call 'su -' instead of 'su', for example." >> $LOGFILE
    664611    fi
    665612}
     
    1010957    fi
    1011958
    1012     link=`readlink $file`
     959    link=`readlink -f $file`
    1013960    d=`dirname $file`
    1014961    if [ ! -e "$link" -a ! -e "$d/$link" ]; then
     
    10761023    [ "$INTERNAL_TAPE_BLOCK_SIZE" ] && echo "internal-tape-block-size $INTERNAL_TAPE_BLOCK_SIZE" >> $outfile
    10771024    use_lzo=$USE_LZO; [ "$use_lzo" = "" ] && use_lzo="no"
     1025    use_gzip=$USE_GZIP; [ "$use_gzip" = "" ] && use_gzip="no"
    10781026    use_comp=$USE_COMP; [ "$use_comp" = "" ] && use_comp="yes"
    10791027    use_star=$USE_STAR; [ "$use_star" = "" ] && use_star="no"
    10801028    echo "use-lzo $use_lzo" >> $outfile
     1029    echo "use-gzip $use_gzip" >> $outfile
    10811030    echo "use-star $use_star" >> $outfile
    10821031    echo "use-comp $use_comp" >> $outfile
     
    12391188        if [ "`echo "$current_partition" | /bin/grep -i "LABEL="`" != "" ]; then
    12401189            str_to_find_fmt_with=$current_partition
    1241             redhat_label=`echo "$current_partition" | /bin/cut -d'=' -f2`
     1190            redhat_label=`echo "$current_partition" | cut -d'=' -f2`
    12421191            actual_dev=""
    12431192
     
    12491198            # 2nd try : blkid, the good way for all LABEL except swap
    12501199            if [ "x$actual_dev" = "x" -a -x "/sbin/blkid" ]; then
    1251                 actual_dev=`/sbin/blkid | /bin/grep "$redhat_label" | grep LABEL= | /bin/cut -d':' -f1`
     1200                actual_dev=`/sbin/blkid | /bin/grep "$redhat_label" | grep LABEL= | cut -d':' -f1`
    12521201                # For LVM FS it will give a /dev/dm-# which should then be converted
    12531202                if [ $LVM = "v2" ] && [ "`echo $actual_dev | grep '/dev/dm'`" ]; then
     
    12681217            # For LVM gives a /dev/mapper entry
    12691218            if [ "x$actual_dev" = "x" ]; then
    1270                 actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | /bin/cut -d' ' -f1`
     1219                actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | cut -d' ' -f1`
    12711220            fi
    12721221   
     
    12921241                    do
    12931242                        # Location of the swap label for kernel 2.6
    1294                         try_dev_label=`dd bs=1 count=16 skip=1052 if=$try_dev &> /dev/null`
     1243                        try_dev_label=`dd bs=1 count=16 skip=1052 if=$try_dev 2> /dev/null`
    12951244                        if [ "x$try_dev_label" = "x$redhat_label" ]; then
    12961245                            actual_dev=$try_dev
     
    12981247                    done
    12991248            fi
    1300         fi
    1301 
     1249
     1250            # Check if one of all those tries has known success
     1251            if [ "x$actual_dev" != "x" ]; then
     1252                current_partition=$actual_dev
     1253            else
     1254                Die "Your system uses a LABEL 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"
     1255            fi
    13021256        # This part tries to retrieve the correct device from a UUID line in /etc/fstab
    13031257        # current_partition contains only first column of /etc/fstab
    1304         if [ "`echo "$current_partition" | /bin/grep -i "UUID="`" != "" ]; then
     1258        elif [ "`echo "$current_partition" | /bin/grep -i "UUID="`" != "" ]; then
    13051259            str_to_find_fmt_with=$current_partition
    1306             uuid=`echo "$current_partition" | /bin/cut -d'=' -f2`
     1260            uuid=`echo "$current_partition" | cut -d'=' -f2`
    13071261            actual_dev=""
    13081262
     
    13141268            # 2nd try : blkid, the good way for all LABEL except swap
    13151269            if [ "x$actual_dev" = "x" -a -x "/sbin/blkid" ]; then
    1316                 actual_dev=`/sbin/blkid | /bin/grep "$uuid" | grep UUID= | /bin/cut -d':' -f1`
     1270                actual_dev=`/sbin/blkid | /bin/grep "$uuid" | grep UUID= | cut -d':' -f1`
    13171271                # For LVM FS it will give a /dev/dm-# which should then be converted
    13181272                if [ $LVM = "v2" ] && [ "`echo $actual_dev | grep '/dev/dm'`" ]; then
     
    15901544    old_pwd=`pwd`
    15911545    cd $MINDI_TMP/iso
    1592     mkdir -p $MONDO_ROOT/iso/isolinux
    15931546    echo "mindi_lib = $MINDI_LIB" >> $LOGFILE
    15941547    for i in memdisk memtest.bin memtest.img ; do
     
    16031556    done
    16041557    MakeSyslinuxMessageFile $MINDI_TMP/iso/isolinux/message.txt
    1605     cp $kernelpath $MINDI_TMP/iso/isolinux/vmlinuz 2> /dev/null || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/isolinux/vmlinuz). Did you run out of disk space?"
     1558    cp $kernelpath $MINDI_TMP/iso/isolinux/vmlinuz 2> /dev/null || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MINDI_TMP/iso/isolinux/vmlinuz). Did you run out of disk space?"
     1559    cp $kernelpath $MONDO_ROOT/vmlinuz 2> /dev/null || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/vmlinuz). Did you run out of disk space?"
    16061560    cp $MINDI_TMP/mindi.rdz $MINDI_TMP/iso/isolinux/initrd.img 2>> $LOGFILE
    1607     cp $MINDI_TMP/mindi.rdz $CACHE_LOC/initrd.img 2>> $LOGFILE
     1561    cp $MINDI_TMP/mindi.rdz $MONDO_ROOT/initrd.img 2>> $LOGFILE
    16081562    [ -e "$iso_cfg_file" ] || Die "FIXME - unable to find $iso_cfg_file - this should never occur"
    16091563    cd $MINDI_TMP/iso/isolinux
     
    26432597        echo -en "$LAST_FILELIST_NUMBER" > $mountpoint/tmp/LAST-FILELIST-NUMBER
    26442598        [ "$USE_LZO" = "yes" ] && echo -en "Pras 4 Pres 2004" >> $mountpoint/tmp/USING-LZO
     2599        [ "$USE_GZIP" = "yes" ] && echo -en "YES" >> $mountpoint/tmp/USING-GZIP
    26452600        [ "$USE_COMP" = "yes" ] && echo -en "Compression, yep" >> $mountpoint/tmp/USING-COMP
    26462601        [ "$USE_STAR" = "yes" ] && echo -en "Using star. Hooray." >> $mountpoint/tmp/USING-STAR
     
    27122667
    27132668##############################################################################
    2714 #----------------------------------- main -----------------------------------#
     2669#----------------------------------- Main -----------------------------------#
    27152670##############################################################################
    27162671
     
    27372692[ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && ln -sf /sbin/mkdosfs /sbin/mkfs.vfat
    27382693
    2739 FindHomeOfMindiAndMondo
     2694# Log some capital variables
     2695[ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     2696echo "MINDI_LIB = $MINDI_LIB" >> $LOGFILE
     2697echo "MINDI_SBIN = $MINDI_SBIN" >> $LOGFILE
     2698[ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
     2699echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
     2700echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
     2701
    27402702trap AbortHere SIGTERM SIGHUP SIGQUIT SIGKILL SIGABRT SIGINT
    2741 AbortIfYourDistroIsAPieceOfStercus
     2703
     2704# Sanity checks
     2705which which > /dev/null 2> /dev/null || Die "Please install 'which'."
     2706which strings > /dev/null 2> /dev/null || Die "Please install binutils and libbinutils; you have no 'strings' executable."
     2707which gawk > /dev/null 2> /dev/null || Die "Gawk is missing from your computer. Please install gawk. You may find the package on Debian's website. How did I know you're running Debian? Because only Debian would be stupid enough not to include gawk in your distribution."
     2708which gawk > /dev/null 2> /dev/null && AWK=`which gawk 2>/dev/null` || AWK="`which awk 2>/dev/null`"
     2709if which awk &> /dev/null ; then
     2710    if ! which gawk &> /dev/null ; then
     2711        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"
     2712    fi
     2713fi
     2714which mke2fs > /dev/null 2> /dev/null || Die "Please put mke2fs in system path"
     2715[ ! -e "$FDISK" ] && Die "Cannot find (s)fdisk"
     2716
    27422717[ "`uname -r | grep "2.4.[0-6]" | grep -v "2.4.[0-9][0-9]"`" != "" ] &&  echo "WARNING! Your kernel may have buggy loopfs code. Consider upgrading to 2.4.7"
    27432718# If we have a 2.6 kernel, the system uses module-init-tools which means that we
     
    27552730    [ ! -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..."
    27562731fi
    2757 FixPathIfBroken
     2732
     2733# Update the PATH variable if incomplete
     2734if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then
     2735    PATH=$PATH:/sbin:/usr/sbin
     2736    export PATH
     2737    echo "Your PATH did not include /sbin or /usr/sbin. I have fixed that, temporarily." >> $LOGFILE
     2738    echo "However, you may wish to ask your vendor to provide a permanent fix..." >> $LOGFILE
     2739    echo " Or you might like to call 'su -' instead of 'su', for example." >> $LOGFILE
     2740fi
     2741
    27582742[ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep -E "2\.[46]" | cut -d' ' -f1`
    2759 AbortIfMkfsVfatMissing
     2743
     2744if ! which mkfs.vfat &> /dev/null ; then
     2745    Die "mkfs.vfat missing from your filesystem - please install your dosfstools RPM or DEB package. Perhaps your PATH environmental variable is broken, too?"
     2746fi
     2747
    27602748### BERLIOS
    27612749### Fix as it's not mandatory on ia64
    27622750if [ "$ARCH" = "ia64" ] ; then
    2763     FindELiloBinary
     2751    if which elilo &> /dev/null ; then
     2752        LILO_EXE=elilo
     2753    else
     2754        LILO_EXE=`which false`
     2755    fi
    27642756else
    27652757    FindIsolinuxBinary
     
    27742766MAX_COMPRESSED_SIZE=1300
    27752767kernelpath=""
    2776 MONDO_ROOT=$TMPMONDO/mondo-root
     2768MONDO_ROOT=/var/cache/mondo
    27772769mkdir -p $MONDO_ROOT
    27782770
     
    27882780    LVM="false"
    27892781fi
     2782echo "LVM set to $LVM" >> $LOGFILE
     2783echo "----------" >> $LOGFILE
     2784echo "df result:" >> $LOGFILE
     2785echo "----------" >> $LOGFILE
     2786df -T >> $LOGFILE
     2787echo "-------------" >> $LOGFILE
     2788echo "lsmod result:" >> $LOGFILE
     2789echo "-------------" >> $LOGFILE
     2790lsmod >> $LOGFILE
     2791echo "-------------" >> $LOGFILE
    27902792
    27912793if [ "$#" -ge "2" ] ; then
     
    28242826        # Change MINDI_TMP for the one provided by mondo
    28252827        # So that it can get back the built files
    2826         rm -rf $MINDI_TMP
     2828        mv $MINDI_TMP/* $MINDI_TMP/.??* $MONDO_TMP 2> /dev/null
     2829        rmdir $MINDI_TMP
    28272830        MINDI_TMP=$MONDO_TMP
    28282831        mkdir -p $MINDI_TMP
     2832        # This is the scratch dir in mondo
    28292833        CACHE_LOC=$3
    28302834        if [ _"$CACHE_LOC" != _"" ]; then
     
    28732877        INTERNAL_TAPE_BLOCK_SIZE="${18}"
    28742878        DIFFERENTIAL="${19}"
    2875         NOT_BOOT="${20}"
     2879        USE_GZIP="${20}"
     2880        NOT_BOOT="${21}"
    28762881        [ "$USE_COMP" = "" ] && USE_COMP=yes
     2882        [ "$USE_GZIP" = "" ] && USE_GZIP=no
    28772883        [ "$NOT_BOOT" = "" ] && NOT_BOOT=no
    28782884        [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine."
     
    29172923else
    29182924    echo "You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks" >> /var/log/mondo-archive.log
     2925fi
     2926if [ -f $MINDI_LIB/rootfs/bin/busybox ]; then
     2927    LogIt "Mindi-`$MINDI_LIB/rootfs/bin/busybox 2>&1 | head -1`"
     2928else
     2929    LogIt "Unable to find mindi-busybox, please install it"
     2930    MindiExit -1
    29192931fi
    29202932
Note: See TracChangeset for help on using the changeset viewer.