Changeset 1106 in MondoRescue


Ignore:
Timestamp:
Feb 7, 2007, 11:55:11 PM (17 years ago)
Author:
Bruno Cornec
Message:

merge -r1082:1105 $SVN_M/branches/stable

Location:
trunk
Files:
36 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/mindi/distributions/conf/mindi.conf.dist

    r1079 r1106  
    44#
    55# We tried to give sensible defaults in this file.
    6 # Changing some values may render mindi instable
    7 # or cause failures. Use with care.
     6# It will alwys be loaded by mindi before your own configuration files.
     7# DO NOT CHANGE THAT FILE IN ANYWAY AS ITS MD5 SUM IS USED AS A CHECK !!
     8# Anyway changing some values in your own configuration file may render
     9# mindi instable or cause failures. Use with care.
    810
    911#
     
    4850
    4951#
     52# Write mindi Tape (yes|no) ?
     53#
     54mindi_write_tape="no"
     55
     56#
    5057# If set to "no", you will be prompted for whether or not
    5158# you want to use your own kernel, or the supplied default.
     
    5764# Images creation dir
    5865# WARNING: This directory is erased before usage
     66# This is also the directory mondoarchive will use to find
     67# what it needs to create it rescue media
    5968#
    60 mindi_images_dir="/var/cache/mindi"
     69mindi_cache_dir="/var/cache/mindi"
    6170
    6271#
    6372# Temporary directory
     73# Under it a temporary directory will be created to host all
     74# temporary files for mindi. That subdirectory is erased at the end of mindi
    6475#
    6576mindi_tmp_dir="/tmp"
     
    6980#
    7081mindi_fd_device="/dev/fd0"
     82
     83#
     84# USB Disk Device
     85#
     86mindi_usb_device="/dev/sda1"
     87
     88#
     89# Tape Device
     90#
     91mindi_tape_device="/dev/st0"
    7192
    7293#
  • trunk/mindi/install.sh

    r1081 r1106  
    140140install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
    141141
    142 if [ "_$PREFIX" = "_" && ! -f $locallib/mindi/rootfs/bin/busybox ]; then
     142if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
    143143        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
    144144fi
  • trunk/mindi/mindi

    r1085 r1106  
    4848
    4949MINDI_CONFIG="$MINDI_CONF/mindi.conf"
    50 if [ ! -f $MINDI_CONFIG ]; then
     50if [ ! -f $MINDI_CONFIG ]  && [ "_$1" = "_" ]; then
    5151    echo "No $MINDI_CONFIG file found using sensible values"
    5252else
    53     echo "Using $MINDI_CONFIG as additional config file"
     53    if [ "_$1" = "_" ]; then
     54        echo "Using $MINDI_CONFIG as additional config file to $MINDI_CONFIG_DIST"
     55    fi
    5456    . $MINDI_CONFIG
    5557fi 
     
    8789PROMPT_MAKE_CD_IMAGE="$mindi_write_cd"
    8890PROMPT_MAKE_USB_IMAGE="$mindi_write_usb"
     91PROMPT_MAKE_TAPE_IMAGE="$mindi_write_tape"
    8992USE_OWN_KERNEL="$mindi_use_own_kernel"
    90 CACHE_LOC="$mindi_images_dir"
     93MINDI_CACHE="$mindi_cache_dir"
    9194FORCE_DUAL_FLOPPIES="$mindi_dual_floppies"
    9295TMPDIR="$mindi_tmp_dir"
    9396FDDEVICE="$mindi_fd_device"
     97USBDEVICE="$mindi_usb_device"
     98TAPEDEV="$mindi_tape_device"
    9499ADDITIONAL_BOOT_PARAMS="$mindi_boot_params"
    95100MY_FSTAB="$mindi_etc_fstab"
     
    107112BOOT_MEDIA_MESSAGE="$mindi_boot_msg"
    108113FDISK=$MINDI_SBIN/parted2fdisk
    109 
    110 # Now we can create what we nedd
    111114MINDI_TMP=`mktemp -d $TMPDIR/mindi.XXXXXXXXXX`
    112 mkdir -p $MINDI_TMP
    113 
    114 # Purge from potential old run
    115 rm -rf $CACHE_LOC/* 2> /dev/null
    116 mkdir -p $CACHE_LOC
     115
    117116# ----------------------------------------------------------------------------
    118117
     
    143142Aborted() {
    144143    trap SIGHUP SIGTERM SIGTRAP SIGINT
    145     [ "$CACHE_LOC" != "" ] && rm -f $CACHE_LOC/mindi*img $CACHE_LOC/*gz $CACHE_LOC/mindi.iso
     144    [ "$MINDI_CACHE" != "" ] && rm -f $MINDI_CACHE/mindi*img $MINDI_CACHE/*gz $MINDI_CACHE/mindi.iso
    146145    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/*
    147146    Die "User abort."
    148 }
    149 
    150 
    151 AddFileToCfgIfExists() {
    152     [ -e "$1" ] && echo -en "$2 `cat $1`\n" >> $3
    153147}
    154148
     
    415409    if [ "$?" -ne "0" ] ; then
    416410        umount $mountpoint
     411        rmdir $mountpoint
    417412        Die "Tarball $tarball is too big for disk! (CODI)\nAdjust mindi_max_compressed_size in your $MINDI_CONFIG"
    418413    fi
     
    522517        echo -en "Adding the following keyboard mapping tables: "
    523518        mkdir -p $bigdir/tmp
    524         echo "/etc/console/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE
     519        echo "keymap-lives-here /etc/console/boottime.kmap.gz" > $MINDI_TMP/mondo-restore.cfg
    525520        KBDEPTH=0
    526521        mkdir -p $bigdir/etc/console
     
    573568    echo -en "Adding the following keyboard mapping tables: "
    574569    mkdir -p $bigdir/tmp
    575     echo "$mappath" > $bigdir/tmp/KEYMAP-LIVES-HERE
     570    echo "keymap-lives-here $mappath" > $MINDI_TMP/mondo-restore.cfg
    576571    KBDEPTH=0
    577572    AddKeyboardMappingFile $mappath
     
    787782            Die "Odd."
    788783        fi
    789         cp -f $MINDI_TMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW."
    790         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
    791             LogIt "Incorporating NFS-related settings"
    792             for r in NFS-* ISO-PREFIX ; do
    793                 cp -f $MINDI_TMP/$r $bigdir/tmp 2>> $LOGFILE || Die "Cannot copy $r - did you run out of disk space?"
    794                 echo "Copying $r to ramdisk" >> $LOGFILE
    795             done
    796         fi
    797784    fi
    798785    tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile
     
    838825}
    839826
     827
     828# Check kernel filesystem capabilites for accessing initrd image
     829#
     830# Interface definition:
     831# param #1: absolute path to kernel image
     832GetInitrdFilesystemToUse() {
     833
     834    # interface test: make sure we have one parameter
     835    if [ $# -ne 1 ]; then
     836        Die "GetInitrdFilesystemToUse(): Expected 1 parameter, got $#."
     837    fi
     838
     839    # interface parameters
     840    local lvKernelImage=$1
     841
     842    # local constants (filesystem magic strings)
     843    local lcMagicCramfs="<3>cramfs: wrong magic"
     844    local lcMagicExt2fs="<3>EXT2-fs: blocksize too small for device."
     845    local lcMagicInitfs="<6>checking if image is initramfs..."
     846
     847    # local variables
     848    local lvOffset
     849    local lvScanRes
     850    local lvUseFilesystem
     851
     852    # say where we are.
     853    LogIt "  GetInitrdFilesystemToUse(): called with parameter: $lvKernelImage.\n"
     854
     855    # verify that file exists
     856    [ ! -f $lvKernelImage ] && Die "File $lvKernelImage not found. Terminating."
     857
     858    # get offet of gzip magic "1f8b0800" in file
     859    lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}'`
     860    [ $lvOffset -eq 0 ] && Die "gzip magic not found in file $lvKernelImage. Terminating."
     861    lvOffset=`expr $lvOffset / 2`
     862    LogIt "  GetInitrdFilesystemToUse(): gzip magic found at lvOffset $lvOffset.\n"
     863
     864    # scan kernel image for initrd filessystem support
     865    lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | gunzip -c | strings | grep -e "$lcMagicCramfs" -e "$lcMagicExt2fs" -e "$lcMagicInitfs"`
     866
     867    # determine which filesystem to use for initrd image: ext2fs, gzip'ed cpio (initramfs ) or cramfs
     868    if [ `echo $lvScanRes | grep -c "$lcMagicExt2fs"` -eq 1 ]; then
     869        lvUseFilesystem="ext2fs"
     870    elif [ `echo $lvScanRes | grep -c "$lcMagicInitfs"` -eq 1 ]; then
     871        lvUseFilesystem="initramfs"
     872    elif [ `echo $lvScanRes | grep -c "$lcMagicCramfs"` -eq 1 ]; then
     873        lvUseFilesystem="cramfs"
     874    else
     875        lvUseFilesystem="UNSUPPORTED"
     876    fi
     877
     878    # say what we are using
     879    LogIt "  GetInitrdFilesystemToUse(): Filesytem to use for initrd is $lvUseFilesystem.\n"
     880
     881    # return file system to use
     882    echo "$lvUseFilesystem"
     883
     884}
    840885
    841886# Searches parent raid device of given disk device
     
    10051050
    10061051
    1007 # Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg
    1008 MakeMondoConfigFile() {
    1009     local outfile use_lzo use_comp use_star
    1010     outfile=$1
    1011     > $outfile
    1012     [ "$TAPESIZE" ]     && echo "media-size $TAPESIZE" >> $outfile
    1013     [ "$TAPEDEV" ]          && echo "media-dev $TAPEDEV" >> $outfile
    1014     [ "$FILES_IN_FILELIST" ]    && echo "files-in-filelist $FILES_IN_FILELIST" >> $outfile
    1015     [ "$LAST_FILELIST_NUMBER" ] && echo "last-filelist-number $LAST_FILELIST_NUMBER" >> $outfile
    1016     [ "$INTERNAL_TAPE_BLOCK_SIZE" ] && echo "internal-tape-block-size $INTERNAL_TAPE_BLOCK_SIZE" >> $outfile
    1017     use_lzo=$USE_LZO; [ "$use_lzo" = "" ] && use_lzo="no"
    1018     use_gzip=$USE_GZIP; [ "$use_gzip" = "" ] && use_gzip="no"
    1019     use_comp=$USE_COMP; [ "$use_comp" = "" ] && use_comp="yes"
    1020     use_star=$USE_STAR; [ "$use_star" = "" ] && use_star="no"
    1021     echo "use-lzo $use_lzo" >> $outfile
    1022     echo "use-gzip $use_gzip" >> $outfile
    1023     echo "use-star $use_star" >> $outfile
    1024     echo "use-comp $use_comp" >> $outfile
    1025     echo "datestamp `date`" >> $outfile
    1026     [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile
    1027     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
    1028     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
    1029     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
    1030     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
    1031     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
    1032     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-PATH   nfs-server-path   $outfile
    1033     AddFileToCfgIfExists $MINDI_TMP/NFS-DEV           nfs-dev           $outfile
    1034     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
    1035     AddFileToCfgIfExists $MINDI_TMP/ISO-DEV           iso-dev           $outfile
    1036     AddFileToCfgIfExists $MINDI_TMP/ISO-MNT           iso-mnt           $outfile
    1037     AddFileToCfgIfExists $MINDI_TMP/ISO-PREFIX        iso-prefix        $outfile
    1038     AddFileToCfgIfExists $MINDI_TMP/ISODIR            isodir            $outfile
    1039     AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.DEVICE bootloader.device $outfile
    1040     AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.NAME   bootloader.name   $outfile
    1041     AddFileToCfgIfExists $MINDI_TMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile
    1042     AddFileToCfgIfExists $MINDI_TMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile
    1043     AddFileToCfgIfExists $MINDI_TMP/BACKUP-MEDIA-TYPE backup-media-type $outfile
    1044     AddFileToCfgIfExists $MINDI_TMP/DIFFERENTIAL      differential      $outfile
    1045     AddFileToCfgIfExists $MINDI_TMP/ACL      acl      $outfile
    1046     AddFileToCfgIfExists $MINDI_TMP/XATTR      xattr      $outfile
    1047 }
    1048 
    1049 
    10501052MakeModuleLoadingScript() {
    10511053    local module fname params modpath kver outerloop i modpaths kver searchpath list_to_echo j
     
    11321134    [ -e "$MY_FSTAB" ] || Die "Cannot find your fstab file ($MY_FSTAB)"
    11331135
    1134     rm -f $mountlist
    1135     mkdir -p $mountlist
    1136     rm -Rf $mountlist
     1136    [ "$mountlist" != "" ] && rm -Rf $mountlist
    11371137    > $mountlist
    11381138    echo -en "\rHang on...\r"
     
    14461446    rm -f $1.tmp
    14471447    if [ "$CDRECOVERY" != "yes" ] ; then
    1448         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1448        if [ "$NFS_DEV" != "" ] ; then
    14491449            echo -en "Press <enter> to continue.\n" >> $1
    14501450        elif [ ! "$MINDI_TMP" ] ; then
     
    15301530        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
    15311531    fi
    1532     if [ ! "$MINDI_TMP" ] ; then
    1533         LogIt "NB: Mindi's bootable CD always uses isolinux or elilo."
    1534         LogIt "For a bootable CD w/LILO, please use Mondo."
     1532    if [ _"$MINDI_TMP" = _"" ]; then
     1533        Die "MINDI_TMP undefined"
    15351534    fi
    15361535    rm -Rf $MINDI_TMP/iso
     
    15631562    cd $MINDI_TMP/iso/isolinux
    15641563    cat $iso_cfg_file | HackSyslinuxFile $ramdisk_size $MINDI_TMP/iso > isolinux.cfg || Die "Cannot copy isolinux.cfg to $MINDI_TMP/iso/isolinux - did you run out of disk space?"
    1565     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1564    if [ "$NFS_DEV" != "" ] ; then
    15661565        perl -pi -e 's/interactive/iso/' isolinux.cfg
    15671566    fi
     
    15761575            cp -f $MONDO_SHARE/autorun . 2>> $LOGFILE
    15771576        fi
    1578         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> $MINDI_TMP/mkisofs.log
    1579     else
    1580         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> $MINDI_TMP/mkisofs.log
     1577        mkisofs -U -J -r -o $MINDI_CACHE/mindi.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table . > /dev/null 2> $MINDI_TMP/mkisofs.log
     1578    else
     1579        mkisofs -J -r -o $MINDI_CACHE/mindi.iso -b images/mindi-bootroot.$IA64_BOOT_SIZE.img -c isolinux/boot.cat -no-emul-boot . > /dev/null 2> $MINDI_TMP/mkisofs.log
    15811580    fi
    15821581    if [ "$?" -ne "0" ] ; then
     
    15871586        LogIt "Failed to create ISO image."
    15881587    else
    1589         echo "Created bootable ISO image at $CACHE_LOC/mindi.iso" >> $LOGFILE
     1588        echo "Created bootable ISO image at $MINDI_CACHE/mindi.iso" >> $LOGFILE
    15901589    fi
    15911590    rm -f $MINDI_TMP/mkisofs.log
     
    15981597    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then
    15991598        echo "Shall I make a bootable USB image ?"
    1600         echo -en "WARNING: This will erase all content on $USBDEV (y/[n]) "
     1599        echo -en "WARNING: This will erase all content on $USBDEVICE (y/[n]) "
    16011600        read i
    16021601        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
    16031602    fi
     1603    if [ _"$MINDI_TMP" = _"" ]; then
     1604        Die "MINDI_TMP undefined"
     1605    fi
    16041606    rm -Rf $MINDI_TMP/usb
    16051607    mkdir -p $MINDI_TMP/usb
    1606     USBPART="${USBDEV}1"
    1607 
    1608     echo -en "Transforming $USBDEV in a Bootable device "
     1608    USBPART="${USBDEVICE}1"
     1609
     1610    echo -en "Transforming $USBDEVICE in a Bootable device "
    16091611    echo -en "."
    1610     echo "Transforming $USBDEV in a Bootable device"  >> $LOGFILE
    1611     echo "Checking $USBDEV" >> $LOGFILE
    1612     $FDISK -l $USBDEV 2>&1 >> $LOGFILE
     1612    echo "Transforming $USBDEVICE in a Bootable device"  >> $LOGFILE
     1613    echo "Checking $USBDEVICE" >> $LOGFILE
     1614    $FDISK -l $USBDEVICE 2>&1 >> $LOGFILE
    16131615    if [ $? -ne 0 ]; then
    1614         echo "Unable to access $USBDEV" | tee -a $LOGFILE
     1616        echo "Unable to access $USBDEVICE" | tee -a $LOGFILE
    16151617        echo "Make sure your USB device is pluged in" | tee -a $LOGFILE
    16161618        MindiExit -1
    16171619    fi
    16181620    echo -en "."
    1619     echo "Erasing $USBDEV" >> $LOGFILE
    1620     $FDISK $USBDEV 2>&1 >> $LOGFILE << EOF
     1621    echo "Erasing $USBDEVICE" >> $LOGFILE
     1622    $FDISK $USBDEVICE 2>&1 >> $LOGFILE << EOF
    16211623d
    16221624d
     
    16351637EOF
    16361638    if [ $? -ne 0 ]; then
    1637         echo "Unable to create a vfat Filesystem on $USBDEV" | tee -a $LOGFILE
     1639        echo "Unable to create a vfat Filesystem on $USBDEVICE" | tee -a $LOGFILE
    16381640        echo "Make sure your USB device is pluged in" | tee -a $LOGFILE
    1639         $FDISK -l $USBDEV 2>&1 | tee -a $LOGFILE
     1641        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
    16401642        MindiExit -1
    16411643    fi
     
    16461648        echo "Unable to create a vfat filesystem on $USBPART" | tee -a $LOGFILE
    16471649        echo "Make sure your USB device is pluged in and partitioned ($USBPART must exist on it)" | tee -a $LOGFILE
    1648         $FDISK -l $USBDEV 2>&1 | tee -a $LOGFILE
     1650        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
    16491651        MindiExit -1
    16501652    fi
     
    16551657        echo "Unable to mount $USBPART on $MINDI_TMP/usb" | tee -a $LOGFILE
    16561658        echo "Make sure your USB device is pluged in, partitioned and formated ($USBPART must exist on it)" | tee -a $LOGFILE
    1657         $FDISK -l $USBDEV 2>&1 | tee -a $LOGFILE
     1659        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
    16581660        MindiExit -1
    16591661    fi
     
    16931695    cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $MINDI_TMP/usb > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to $MINDI_TMP/usb - did you run out of disk space?"
    16941696    echo -en "."
    1695     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1697    if [ "$NFS_DEV" != "" ] ; then
    16961698        perl -pi -e 's/interactive/iso/' syslinux.cfg
    16971699    fi
     
    17171719    else
    17181720        echo -e "$DONE"
    1719         echo "Created bootable USB image on $USBDEV" >> $LOGFILE
     1721        echo "Created bootable USB image on $USBDEVICE" >> $LOGFILE
    17201722    fi
    17211723    rm -f $MINDI_TMP/syslinux.log
     1724    #
     1725    # If mondoarchive, then tranfer $MINDI_CACHE content to the USB device
     1726    # and mount that device under that mountpoint instead
     1727    # Has to be done at the end here.
     1728    #
     1729    if [ _"$MONDO_SHARE" != _"" ]; then
     1730        mount $USBPART $MINDI_TMP/usb 2>> $LOGFILE
     1731        mv $MINDI_CACHE/* $MINDI_TMP/usb
     1732        umount $MINDI_TMP/usb
     1733        mount $USBPART $MINDI_CACHE
     1734    fi
    17221735}
    17231736
     
    17391752        if [ _"$MONDO_SHARE" != _"" ]; then
    17401753            if [ "$CDRECOVERY" != "yes" ] ; then
    1741                 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1754                if [ "$NFS_DEV" != "" ] ; then
    17421755                    echo -en "Press <enter> to continue.\n"
    17431756                elif [ ! "$MINDI_TMP" ] ; then
     
    18341847        echo -en "default=RESTORE\n"
    18351848    elif [ "$disksize" -gt "2880" ] && [ _"$MONDO_SHARE" != _"" ]; then
    1836         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1849        if [ "$NFS_DEV" != "" ] ; then
    18371850            echo -en "default=iso\n"
    18381851        else
     
    18551868    elif [ "$disksize" -gt "2880" ] ; then
    18561869        if [ _"$MONDO_SHARE" != _"" ]; then
    1857             if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1870            if [ "$NFS_DEV" != "" ] ; then
    18581871                options="iso"
    18591872            else
     
    19751988
    19761989    # copy the kernel across
    1977     rm -Rf $mountpoint/lost+found
     1990    [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found
    19781991    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
    19791992    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     
    20112024    if [ "$disksize" -gt "2880" ] && [ ! "$KERN_DISK_MADE" ] ; then
    20122025        if [ "$ARCH" != "ia64" ] ; then
    2013         $LILO_EXE $LILO_OPTIONS -r $mountpoint >> $LOGFILE 2>> $LOGFILE
     2026        $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE
    20142027        else
    20152028            /bin/true
     
    20962109    [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?"
    20972110    cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $mountpoint > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to tmp_root"
    2098     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     2111    if [ "$NFS_DEV" != "" ] ; then
    20992112        perl -pi -e 's/interactive/iso/' syslinux.cfg
    21002113    fi
     
    21152128
    21162129    # copy the kernel across
    2117     rm -Rf $mountpoint/lost+found
     2130    [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found
    21182131    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
    21192132    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     
    22262239    mkdir -p $bigdir/tmp
    22272240    if [ _"$MONDO_SHARE" != _"" ]; then
    2228         MakeMondoConfigFile $MINDI_TMP/mondo-restore.cfg
    2229         cp -f $MINDI_TMP/mondo-restore.cfg $bigdir/tmp &> /dev/null
     2241        cp -f $MONDO_CACHE/mondo-restore.cfg $bigdir/tmp &> /dev/null
    22302242    fi
    22312243    [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO
     
    22422254
    22432255    # master boot record, too
    2244     i=`cat $MINDI_TMP/BOOTLOADER.DEVICE 2> /dev/null`
     2256    i=`grep bootloader.device $MONDORESTORECFG | cut -d' ' -f2 2> /dev/null`
    22452257    if [ "$i" ] ; then
    22462258        LogIt "Backing up $i's MBR"
     
    24372449    bigdir=$1
    24382450    minidir_root=$2
    2439     rm -Rf $minidir_root/*
     2451    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/*
    24402452
    24412453    TryToFitDataIntoSeveralDirs $bigdir $minidir_root
     
    24462458    fi
    24472459    RejigHyperlinks $minidir_root $noof_disks
    2448     rm -Rf $bigdir/*
     2460    [ "$bigdir" != "" ] && rm -Rf $bigdir/*
    24492461    return $noof_disks
    24502462}
     
    26242636    cd $old_pwd
    26252637    echo -en "\rThe files have been subdivided into $noof_disks directories.                                                            \r"
    2626     rm -Rf $minidir_root/compressed
     2638    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/compressed
    26272639    if [ "$retval" -gt "0" ] ; then
    26282640        return 0
     
    27162728        list_of_groovy_mods="$CDROM_MODS `WhichOfTheseModulesAreLoaded "$SCSI_MODS"`"
    27172729    fi
    2718     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     2730    if [ "$NFS_DEV" != "" ] ; then
    27192731        # For PXE boot
    27202732        list_of_groovy_mods="$list_of_groovy_mods $NET_MODS"
     
    27392751    fi
    27402752    cd $old_pwd
    2741     [ "$TAPEDEV" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE
     2753    [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE
    27422754    dd if=/dev/zero of=$mountpoint/zero &> /dev/null
    27432755    rm -f $mountpoint/zero
     2756    mkdir -p $mountpoint/tmp
    27442757    if [ _"$MONDO_SHARE" != _"" ]; then
    2745         MakeMondoConfigFile $mountpoint/tmp/mondo-restore.cfg
    2746         cp -f $mountpoint/tmp/mondo-restore.cfg $MINDI_TMP &> /dev/null
     2758        cp -f $MONDO_CACHE/mondo-restore.cfg $mountpoint/tmp &> /dev/null || Die "Cannot copy mondo-restore.cfg to ramdisk"
    27472759        cp -f $MINDI_TMP/mountlist.txt $mountpoint/tmp/ 2>/dev/null || Die "Cannot copy mountlist to ramdisk"
    2748         echo -en "$FILES_IN_FILELIST" > $mountpoint/tmp/FILES-IN-FILELIST
    2749         echo -en "$LAST_FILELIST_NUMBER" > $mountpoint/tmp/LAST-FILELIST-NUMBER
    2750         [ "$USE_LZO" = "yes" ] && echo -en "Pras 4 Pres 2004" >> $mountpoint/tmp/USING-LZO
    2751         [ "$USE_GZIP" = "yes" ] && echo -en "YES" >> $mountpoint/tmp/USING-GZIP
    2752         [ "$USE_COMP" = "yes" ] && echo -en "Compression, yep" >> $mountpoint/tmp/USING-COMP
    2753         [ "$USE_STAR" = "yes" ] && echo -en "Using star. Hooray." >> $mountpoint/tmp/USING-STAR
    2754     fi
    2755     mkdir -p $mountpoint/tmp
     2760    fi
    27562761    mkdir -p $mountpoint/proc
    27572762    echo "$disksize" > $mountpoint/tmp/$disksize.siz
    27582763    find $mountpoint -name CVS -exec rm -rf '{}' \;
    2759     umount $mountpoint || Die "Cannot unmount $tempfile"
    2760     dd if=$tempfile bs=1k 2> /dev/null | gzip -v9 > $rdz_fname 2> /dev/null
    2761 #    gzip -9 $tempfile
    2762 #    mv $tempfile.gz $rdz_fname
     2764    # Determine what filesystem to use for initrd image
     2765    LogIt "Call GetInitrdFilesystemToUse() with parameter ${kernelpath} to get filesystem to use for initrd.\n"
     2766    gvFileSystem=`GetInitrdFilesystemToUse ${kernelpath}`
     2767    [ -z  gvFileSystem ] && Die "GetFilesystemToUse() failed. Terminating."
     2768    case "$gvFileSystem" in
     2769    "ext2fs")
     2770        # say what will be used
     2771            LogIt "Creating an ext2 initrd image..."
     2772        # kernel expects linuxrc in ext2 filesystem
     2773        ( cd $mountpoint && ln -s sbin/init linuxrc )
     2774        # unmount loop filesystem and create image file using the standard approach
     2775        umount $mountpoint || Die "Cannot unmount $tempfile"
     2776        dd if=$tempfile bs=1k 2> /dev/null | gzip -v9 > $rdz_fname 2> /dev/null
     2777        # log that we are done
     2778            LogIt "done.\n"
     2779    ;;
     2780    "initramfs")
     2781        # say what will be used
     2782            LogIt "Creating a gzip'ed cpio (AKA initramfs) initrd image..."
     2783        # make sure that cpio is there
     2784        which cpio &> /dev/null; [ $? -eq 0 ] || Die "cpio not found. Please install package cpio and try again."
     2785        # go into filesystem
     2786        cd $mountpoint
     2787        # kernel expects init in cpio filesystem
     2788        ln -s sbin/init init
     2789        # create cpio image file and unmount loop filesystem
     2790        find . -print | cpio -o -H newc | gzip -9 > $old_pwd/$rdz_fname 2> /dev/null
     2791        cd $old_pwd
     2792        umount $mountpoint || Die "Cannot unmount $tempfile"
     2793        # log that we are done
     2794            LogIt "done.\n"
     2795    ;;
     2796    *)
     2797        Die "Filesystem $gvFileSystem not supported for initrd image. Terminating."
     2798    ;;
     2799    esac
    27632800    if [ "$res" -eq "0" ] ; then
    27642801        echo -en "..."
     
    28062843        done
    28072844        mkdir -p $minidir_root/all/tmp
    2808         echo -en "$FILES_IN_FILELIST" > $minidir_root/all/tmp/FILES-IN-FILELIST 2> /dev/null
    2809         echo -en "$LAST_FILELIST_NUMBER" > $minidir_root/all/tmp/LAST-FILELIST-NUMBER 2> /dev/null
    28102845    fi
    28112846    tar -b 4096 -cf - * 2> /dev/null | gzip -9 > $tardir/all.tar.gz
     
    28132848    [ "`du -sm $imagesdir/all.tar.gz | cut -f1`" -ge "30" ] && Die "You have too many tools in your shed"
    28142849    cd $old_pwd
    2815     rm -Rf $minidir_root
     2850    [ "$minidir_root" != "" ] && rm -Rf $minidir_root
    28162851    echo -e "$DONE"
    28172852}
     
    28212856#----------------------------------- Main -----------------------------------#
    28222857##############################################################################
     2858
     2859# Now we can create what we nedd
     2860mkdir -p $MINDI_TMP
     2861
     2862# Purge from potential old run
     2863if [ _"$MINDI_CACHE" = _"" ]; then
     2864    Die "MINDI_CACHE undefined"
     2865fi
     2866rm -rf $MINDI_CACHE 2> /dev/null
     2867mkdir -p $MINDI_CACHE
    28232868
    28242869
     
    28372882echo "$@" >> $LOGFILE
    28382883echo "Start date : `date`" >> $LOGFILE
     2884echo "-----------------------------" >> $LOGFILE
    28392885
    28402886if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then
     
    28462892# Log some capital variables
    28472893[ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     2894echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
    28482895echo "MINDI_LIB = $MINDI_LIB" >> $LOGFILE
    28492896echo "MINDI_SBIN = $MINDI_SBIN" >> $LOGFILE
    28502897[ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
    28512898echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    2852 echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
     2899if [ -f $MINDI_CONF ]; then
     2900    echo "-----------------------------" >> $LOGFILE
     2901    echo " Mindi configuration file    " >> $LOGFILE
     2902    echo "-----------------------------" >> $LOGFILE
     2903    cat $MINDI_CONF >> $LOGFILE
     2904    echo "-----------------------------" >> $LOGFILE
     2905fi
     2906
    28532907
    28542908trap AbortHere SIGTERM SIGHUP SIGQUIT SIGKILL SIGABRT SIGINT
     
    29222976BIGNO=0
    29232977MAX_COMPRESSED_SIZE="$mindi_max_compressed_size"
     2978
     2979#
     2980# Kernel management: Attempt to locate kernel specific module path
     2981# if module path is found then use it other wise use uname -r to set it...
     2982#
     2983#
    29242984kernelpath="$mindi_kernel"
    29252985if [ "$kernelpath" = "NATIVE" ]; then
    29262986    kernelpath=""
    29272987fi
    2928 if [ "$ARCH" = "ia64" ] ; then
    2929     USE_LILO=yes
     2988if [ "$kernelpath" = "" ]; then
     2989    kernelpath=`TryToFindKernelPath`
     2990fi
     2991kernelname=`echo $kernelpath | cut -d'-' -f2-`
     2992echo "kernelname = $kernelname" >> $LOGFILE
     2993echo "kernelpath = $kernelpath" >> $LOGFILE
     2994if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ]
     2995then
     2996   echo "Module path for ${kernelpath} not found..." >> $LOGFILE
     2997   echo "using running kernel\'s modules." >> $LOGFILE
     2998   kernelname=`uname -r`
    29302999else
    2931     USE_LILO=no
     3000   echo "Using modules for kernel: ${kernelname}" >> $LOGFILE
    29323001fi
    29333002
     
    29733042    if [ "$1" = "--usb" ] ; then
    29743043        shift
    2975         USBDEV=$1
    2976         if [ _"$USBDEV" = _"" ]; then
     3044        USBDEVICE=$1
     3045        if [ _"$USBDEVICE" = _"" ]; then
    29773046            Die "No USB device specified"
    29783047        fi
     
    29803049    fi
    29813050fi
     3051
     3052#
     3053# Default value for parameters coming from mondo potentially
     3054#
     3055if [ "$ARCH" = "ia64" ] ; then
     3056    USE_LILO=yes
     3057else
     3058    USE_LILO=no
     3059fi
     3060
     3061#
     3062# These variables are normaly only significant in a mondo environment
     3063# Not enforced yet
     3064#
     3065CDRECOVERY="no"
     3066NOT_BOOT="no"
     3067EXCLUDE_DEVS=""
     3068IMAGE_DEVS=""
     3069NFS_DEV=""
    29823070
    29833071#
     
    30003088        echo "Mindi v$MINDI_VERSION"
    30013089        MindiExit 0
    3002     elif [ "$#" -ge "9" ] && [ "$1" = "--custom" ] ; then
     3090    elif [ "$1" = "--custom" ] ; then
    30033091        if [ _"$MONDO_SHARE" = _"" ]; then
    30043092            Die "--custom is reserved for mondoarchive calls"
     
    30123100        mkdir -p $MINDI_TMP
    30133101        # This is the scratch dir in mondo
    3014         CACHE_LOC=$3
    3015         if [ _"$CACHE_LOC" != _"" ]; then
    3016             mkdir -p $CACHE_LOC
    3017         fi
    3018         kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath=""
    3019 ###
    3020 ### Attempt to locate kernel specific module path
    3021 ### if module path is found then use it other wise use uname -r to set it...
    3022 ###
    3023         if [ "$kernelpath" = "" ]; then
    3024             kernelpath=`TryToFindKernelPath`
    3025         fi
    3026         kernelname=`echo $kernelpath | cut -d'-' -f2-`
    3027         LogIt "kernelname = $kernelname"
    3028         LogIt "kernelpath = $kernelpath"
    3029         if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ]
    3030         then
    3031            LogIt "Module path for ${kernelpath} not found..."
    3032            LogIt "using running kernel\'s modules."
    3033            kernelname=`uname -r`
     3102        MINDI_CACHE=$3
     3103        if [ _"$MINDI_CACHE" != _"" ]; then
     3104            mkdir -p $MINDI_CACHE
     3105        fi
     3106
     3107        if [ ! -e "$MONDORESTORECFG" ]; then
     3108            Die "MONDORESTORECFG undefined. Use an uptodate mondoarchive version"
     3109        fi
     3110
     3111        if [ ! -e "$MONDO_CACHE" ]; then
     3112            Die "MONDO_CACHE undefined. Use an uptodate mondoarchive version"
    30343113        else
    3035            LogIt "Using modules for kernel: ${kernelname}"
    3036         fi
    3037         TAPEDEV=$5
    3038         TAPESIZE=$6
    3039         FILES_IN_FILELIST=$7
    3040         USE_LZO=$8
    3041         CDRECOVERY=$9
    3042         if [ "${10}" = "(null)" ] || [ "${10}" = "" ] ; then
     3114            #
     3115            # Get from mondo our additional configuration
     3116            #
     3117            echo "Using $MONDO_CACHE/mindi.conf as additional config file"
     3118            if [ -f $MONDO_CACHE/mindi.conf ]; then
     3119                . $MONDO_CACHE/mindi.conf
     3120                echo "-----------------------------" >> $LOGFILE
     3121                echo " Mondo configuration file    " >> $LOGFILE
     3122                echo "-----------------------------" >> $LOGFILE
     3123                cat $MONDO_CACHE/mindi.conf >> $LOGFILE
     3124                echo "-----------------------------" >> $LOGFILE
     3125            else
     3126                Die "No mindi.conf file created by mondo. Aborting"
     3127            fi
     3128        fi
     3129
     3130        echo "Here is your mondoresctore.cfg file:" >> $LOGFILE
     3131        echo "------------------------------------" >> $LOGFILE
     3132        cat $MONDORESTORECFG >> $LOGFILE
     3133        echo "-----------------------------------" >> $LOGFILE
     3134
     3135        CDRECOVERY=`grep use-cdrecovery $MONDORESTORECFG | cut -d' ' -f2`
     3136        NOT_BOOT=`grep non-bootable $MONDORESTORECFG | cut -d' ' -f2`
     3137        USE_LILO=`grep use-lilo $MONDORESTORECFG | cut -d' ' -f2`
     3138        EXCLUDE_DEVS=`grep excluded-devs $MONDORESTORECFG | cut -d' ' -f2`
     3139        NFS_DEV=`grep nfs-dev $MONDORESTORECFG | cut -d' ' -f2`
     3140        VALUE=`grep image-devs $MONDORESTORECFG | cut -d' ' -f2`
     3141        if [ "$VALUE" = "(null)" ] || [ "$VALUE" = "" ] ; then
    30433142            IMAGE_DEVS=""
    30443143        else
    3045             IMAGE_DEVS="`echo "${10}" | tr '|' ' '`"
    3046         fi
    3047         if [ "${11}" ] ; then
    3048             LILO_OPTIONS=""
    3049     #       LogIt "LILO will use conservative settings, to be compatible with older BIOSes."
    3050         fi
    3051         LAST_FILELIST_NUMBER=${12}
    3052         ESTIMATED_TOTAL_NOOF_SLICES=${13}
    3053         EXCLUDE_DEVS="${14}"
    3054         USE_COMP="${15}"
    3055         USE_LILO="${16}"
    3056         USE_STAR="${17}"
    3057         INTERNAL_TAPE_BLOCK_SIZE="${18}"
    3058         DIFFERENTIAL="${19}"
    3059         USE_GZIP="${20}"
    3060         NOT_BOOT="${21}"
    3061         [ "$USE_COMP" = "" ] && USE_COMP=yes
    3062         [ "$USE_GZIP" = "" ] && USE_GZIP=no
    3063         [ "$NOT_BOOT" = "" ] && NOT_BOOT=no
    3064         [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine."
    3065         [ "$CDRECOVERY" = "yes" ] && [ "$TAPEDEV" != "" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"
    3066         MONDO_ROOT=`echo $CACHE_LOC | sed 's/\(.*\)\/.*/\1/'`
     3144            IMAGE_DEVS="`echo "$VALUE" | tr '|' ' '`"
     3145        fi
     3146        [ "$CDRECOVERY" = "yes" ] && [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"
     3147        MONDO_ROOT=`echo $MINDI_CACHE | sed 's/\(.*\)\/.*/\1/'`
    30673148        if [ _"$MONDO_ROOT" != _"" ]; then
    30683149            mkdir -p $MONDO_ROOT
     
    31083189KERN_DISK_MADE=""
    31093190
    3110 echo "DIFFERENTIAL = $DIFFERENTIAL" >> $LOGFILE
    3111 echo "INTERNAL TAPE BLOCK SIZE = $INTERNAL_TAPE_BLOCK_SIZE" >> $LOGFILE
    3112 echo "NOT_BOOT = '$NOT_BOOT'" >> $LOGFILE
    3113 if [ "$NOT_BOOT" != "" ] && [ "$NOT_BOOT" != "0" ] && [ "$NOT_BOOT" != "no" ] ; then
    3114     LogIt "Just creating mondo-restore.cfg and a small all.tar.gz for Mondo. Nothing else."
    3115     MakeMondoConfigFile $MINDI_TMP/mondo-restore.cfg
    3116     MakeMountlist $MINDI_TMP/mountlist.txt
     3191if [ "$NOT_BOOT" = "yes" ]; then
     3192    LogIt "Just creating a small all.tar.gz for Mondo. Nothing else."
    31173193    mkdir -p $MINDI_TMP/small-all/tmp
     3194    MakeMountlist $MINDI_TMP/small-all/tmp/mountlist.txt
     3195    cp -f $MINDI_TMP/{filelist.full.gz,biggielist.txt} $MONDO_CACHE/mondo-restore.cfg $MINDI_CACHE/small-all/tmp 2>/dev/null || Die "Cannot copy small all.tar.gz"
    31183196    cd $MINDI_TMP/small-all
    3119     cp -f $MINDI_TMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp 2>/dev/null || Die "Cannot copy small all.tar.gz"
    3120     tar -cv tmp | gzip -9 > $MINDI_TMP/all.tar.gz || Die "Cannot make small all.tar.gz"
    3121     sleep 2
     3197    tar -cv tmp | gzip -9 > $MINDI_CACHE/all.tar.gz || Die "Cannot make small all.tar.gz"
     3198    sync
    31223199    LogIt "Done. Exiting."
    31233200    MindiExit 0
    31243201fi
    31253202
    3126 if [ _"$USBDEV" != _"" ]; then
    3127     LogIt "Including the generation of a Bootable USB device on $USBDEV"
     3203if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3204    LogIt "Including the generation of a Bootable USB device on $USBDEVICE"
    31283205fi
    31293206if [ "$kernelpath" = "" ] ; then
     
    31843261    YOUR_KERNEL_SUCKS="Your kernel sucks"
    31853262fi
    3186 echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$CACHE_LOC" >> $LOGFILE
     3263echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$MINDI_CACHE" >> $LOGFILE
    31873264[ "$(($RANDOM%64))" -eq "0" ] && LogIt "Dude, I've looked inside your computer and it's really dusty..."
    31883265
    31893266[ "$YOUR_KERNEL_SUCKS" ] && [ ! "$FAILSAFE_KVER" ] && Die "Please install mindi-kernel package. You need it.\nGo to http://www.mondorescue.org and download it, then install it."
    31903267
    3191 rm -f $CACHE_LOC/{*img,*gz,*iso}
    3192 
    3193 PrepareDataDiskImages $CACHE_LOC
     3268rm -f $MINDI_CACHE/{*img,*gz,*iso}
     3269
     3270PrepareDataDiskImages $MINDI_CACHE
    31943271noof_disks=$?
    31953272[ "$noof_disks" -eq "0" ] && Die "Too much stuff!"
     
    32173294if [ "$USE_LILO" = "yes" ] ; then
    32183295    if [ "$ARCH" = "ia64" ] ; then
    3219         PrepareBootDiskImage_LILO $CACHE_LOC $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
    3220     else
    3221         if ! PrepareBootDiskImage_LILO $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
     3296        PrepareBootDiskImage_LILO $MINDI_CACHE $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
     3297    else
     3298        if ! PrepareBootDiskImage_LILO $MINDI_CACHE 1722 $kernelpath $ramdisk_size ; then
    32223299            LogIt "WARNING - failed to create 1.72MB boot image."
    32233300            LogIt "Please reduce your kernel's size if you want to make a 1.72MB floppy disk."
    32243301        fi
    3225         if ! PrepareBootDiskImage_LILO $CACHE_LOC 2880 $kernelpath $ramdisk_size ;  then
     3302        if ! PrepareBootDiskImage_LILO $MINDI_CACHE 2880 $kernelpath $ramdisk_size ;  then
    32263303            LogIt "WARNING - failed to create 2.88MB floppy disk image."
    32273304            LogIt "Please reduce your kernel's size if you want to make a 2.88MB floppy disk."
    3228             PrepareBootDiskImage_LILO $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
     3305            PrepareBootDiskImage_LILO $MINDI_CACHE 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
    32293306        fi
    32303307    fi
    32313308else
    3232     if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
     3309    if ! PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 1722 $kernelpath $ramdisk_size ; then
    32333310        LogIt "WARNING - failed to create 1.72MB boot image."
    32343311        LogIt "Please reduce your kernel's size if you want to make a 1.72MB floppy disk."
    3235         if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 2880 $kernelpath $ramdisk_size ; then
     3312        if ! PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 2880 $kernelpath $ramdisk_size ; then
    32363313            LogIt "WARNING - failed to create 2.88MB floppy disk image."
    32373314            LogIt "Please reduce your kernel's size if you want to make a 2.88MB floppy disk."
    3238             PrepareBootDiskImage_SYSLINUX $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
     3315            PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
    32393316        fi
    32403317    fi
     
    32453322
    32463323if [ _"$MONDO_SHARE" = _"" ]; then
    3247     ListImagesForUser $CACHE_LOC
     3324    ListImagesForUser $MINDI_CACHE
    32483325    boot_dev=/dev/fd0u1722
    32493326    [ ! -e "$boot_dev" ] && mknod $boot_dev b 2 60
     
    32513328    [ ! -e "$boot_dev" ] && Die "Will you PLEASE tell your distribution maker to create the 1.72MB devices in /dev?"
    32523329    if [ "$PROMPT_WRITE_BOOT_FLOPPIES" = "yes" ]; then
    3253         OfferToCopyImagesToDisks $CACHE_LOC $boot_dev $FDDEVICE
    3254     fi
    3255     OfferToMakeBootableISO $CACHE_LOC
    3256     if [ _"$USBDEV" != _"" ] ; then
    3257         OfferToMakeBootableUSB $CACHE_LOC
     3330        OfferToCopyImagesToDisks $MINDI_CACHE $boot_dev $FDDEVICE
     3331    fi
     3332    OfferToMakeBootableISO $MINDI_CACHE
     3333    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3334        OfferToMakeBootableUSB $MINDI_CACHE
    32583335    fi
    32593336    LogIt "Finished."
    3260 elif [ "$TAPEDEV" ] ; then
    3261     rm -f $CACHE_LOC/{*img,*gz,*iso}
    3262     OfferToMakeBootableISO $CACHE_LOC
    3263     if [ -e "$CACHE_LOC/all.tar.gz" ] ; then
    3264         cp -f $CACHE_LOC/all.tar.gz $MINDI_TMP/ 2>> $LOGFILE
     3337elif [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] ; then
     3338    rm -f $MINDI_CACHE/{*img,*gz,*iso}
     3339    OfferToMakeBootableISO $MINDI_CACHE
     3340    if [ -e "$MINDI_CACHE/all.tar.gz" ] ; then
     3341        cp -f $MINDI_CACHE/all.tar.gz $MINDI_TMP/ 2>> $LOGFILE
    32653342    else
    32663343        Die "Cannot find all.tar.gz, to be written to tape"
    32673344    fi
    3268 elif [ _"$USBDEV" != _"" ] ; then
    3269     OfferToMakeBootableUSB $CACHE_LOC
     3345elif [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3346    OfferToMakeBootableUSB $MINDI_CACHE
    32703347else
    3271     OfferToMakeBootableISO $CACHE_LOC
     3348    OfferToMakeBootableISO $MINDI_CACHE
    32723349fi
    32733350# cleanup
  • trunk/mindi/rootfs/sbin/find-and-mount-cdrom

    r274 r1106  
    88        [ ! "$SECOND_TRY" ] && LogIt "Trying $device"
    99        if [ "`grep "using-cdstream yes" /tmp/mondo-restore.cfg`" ]; then
    10         pwd=`pwd`
    11         cd $GROOVY
     10            pwd=`pwd`
     11            cd $GROOVY
    1212            tar -zxf $device 2> /tmp/mount.log
    1313            res=$?
    14         cd $pwd
     14            cd $pwd
    1515            if [ "$res" -eq "0" ] ; then
    16         clear
    17                LogIt "Using cdstream as extended datadisk ($device). Good." 3
    18         echo "Using cdstrea as extd dsk." > /tmp/TAPEDEV-HAS-DATA-DISKS
    19                 ln -sf $device /dev/cdrom
    20                 exit 0
    21         fi
     16                clear
     17                LogIt "Using cdstream as extended datadisk ($device). Good." 3
     18                echo "Using cdstream as extd dsk." > /tmp/TAPEDEV-HAS-DATA-DISKS
     19                ln -sf $device /dev/cdrom
     20                exit 0
     21            fi
    2222        else
    2323            mount $device -t iso9660 -o ro /mnt/cdrom 2> /tmp/mount.log
    24         res=$?
     24            res=$?
    2525        fi
    26     if [ "$res" -ne "0" ] ; then
    27         res=`cat /tmp/mount.log`
    28         if [ "$res" = "mount: No medium found" ] ; then
     26        if [ "$res" -ne "0" ] ; then
     27            res=`cat /tmp/mount.log`
     28            if [ "$res" = "mount: No medium found" ] ; then
    2929               [ ! "$SECOND_TRY" ] && LogIt "There is a CD-ROM drive at $device but no CD in it."
    30         else
     30            else
    3131               [ ! "$SECOND_TRY" ] && LogIt "It's not in $device; I'll keep looking"
    32         fi
    33         continue
     32            fi
     33            continue
    3434    fi
    3535    LogIt "$device has a CD-ROM in it"
  • trunk/mindi/rootfs/sbin/init

    r1079 r1106  
    8383LoadKeymap() {
    8484    local fname
    85     fname=`cat /tmp/KEYMAP-LIVES-HERE 2> /dev/null`
     85    fname=`grep keymap-lives-here /tmp/mondo-restore.cfg | cut -d' ' -f2 2> /dev/null`
    8686    [ "$fname" = "" ] && return
    8787    if which loadkeys > /dev/null 2> /dev/null ; then
  • trunk/mondo/src/common/libmondo-archive.c

    r1086 r1106  
    2020#include "mr_mem.h"
    2121#include "mr_err.h"
     22#include "mr_str.h"
     23#include "mr_file.h"
    2224
    2325#include "libmondo-string-EXT.h"
     
    544546    /*@ buffer ************************************************************ */
    545547    char *tmp = NULL;
    546     char *tmp1 = NULL;
    547     char *tmp2 = NULL;
    548548    char *command = NULL;
    549549    char *use_lzo_sz = NULL;
     
    559559    char *devs_to_exclude = NULL;
    560560    char *use_lilo_sz = NULL;
    561     char *value = NULL;
    562561    char *bootdev = NULL;
    563 
    564562
    565563    /*@ char ************************************************************** */
     
    572570    int res = 0;
    573571    long estimated_total_noof_slices = 0;
     572
     573    FILE *fd = NULL;
     574    FILE *fd1 = NULL;
    574575
    575576    assert(bkpinfo != NULL);
     
    606607        mr_asprintf(&tape_device, " ");
    607608    }
     609    /* BERLIOS: This parameter is not used after? */
     610    mr_free(tape_size_sz);
    608611    if (bkpinfo->use_lzo) {
    609612        mr_asprintf(&use_lzo_sz, "yes");
     
    759762    mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
    760763    if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) {
    761         mr_msg(1, "%ld: Unable to write one-liner boot device", __LINE__);
    762     }
    763     mr_free(tmp);
    764     /* BERLIOS: Use bkptype_to_string without LANG */
    765     switch (bkpinfo->backup_media_type) {
    766     case cdr:
    767         mr_asprintf(&value, "cdr");
    768         break;
    769     case cdrw:
    770         mr_asprintf(&value, "cdrw");
    771         break;
    772     case cdstream:
    773         mr_asprintf(&value, "cdstream");
    774         break;
    775     case tape:
    776         mr_asprintf(&value, "tape");
    777         break;
    778     case udev:
    779         mr_asprintf(&value, "udev");
    780         break;
    781     case iso:
    782         mr_asprintf(&value, "iso");
    783         break;
    784     case nfs:
    785         mr_asprintf(&value, "nfs");
    786         break;
    787     case dvd:
    788         mr_asprintf(&value, "dvd");
    789         break;
    790     case usb:
    791         strcpy(value, "usb");
    792         break;
    793     default:
    794         fatal_error("Unknown backup_media_type");
    795     }
    796     mr_asprintf(&tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
    797     if (write_one_liner_data_file(tmp, value)) {
    798         res++;
    799         mr_msg(1, "%ld: Unable to write one-liner backup-media-type",
    800                 __LINE__);
    801     }
    802     mr_free(value);
    803     mr_free(tmp);
    804     log_to_screen(bkpinfo->tmpdir);
    805     mr_asprintf(&tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
    806     if (write_one_liner_data_file(tmp, bootldr_str)) {
    807         res++;
    808         mr_msg(1, "%ld: Unable to write one-liner bootloader.name",
    809                 __LINE__);
    810     }
    811     mr_free(bootldr_str);
    812     mr_free(tmp);
    813     mr_asprintf(&tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
    814     if (bkpinfo->differential) {
    815         res += write_one_liner_data_file(tmp, "1");
    816     } else {
    817         res += write_one_liner_data_file(tmp, "0");
    818     }
    819     mr_free(tmp);
    820 
    821     if (g_getfattr) {
    822         mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
    823         if (write_one_liner_data_file(tmp1, "TRUE")) {
    824             mr_msg(1, "%ld: Unable to write one-liner XATTR",
    825                 __LINE__);
    826         }
    827         mr_free(tmp1);
    828     }
    829     if (g_getfacl) {
    830         mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
    831         if (write_one_liner_data_file(tmp1, "TRUE")) {
    832             mr_msg(1, "%ld: Unable to write one-liner ACL",
    833                 __LINE__);
    834         }
    835         mr_free(tmp1);
     764        mr_msg(1, "Unable to write one-liner boot device");
     765
    836766    }
    837767
     
    850780        log_OS_error("Unable to make mnt floppy directory");
    851781    }
     782
     783    /* Prepare interface with mindi through a configuration file
     784     * under /var/cache/mondo by default
     785     * and the mondorestore configuration file at the same time that
     786     * will be included by mindi on the initrd */
     787
     788    fd = mr_fopen(MONDO_CACHE"/mindi.conf", "w");
     789    fd1 = mr_fopen(MONDORESTORECFG, "a");
     790
     791    mr_fprintf(fd, "mindi_kernel=%s\n", bkpinfo->kernel_path);
     792    mr_fprintf(fd, "mindi_use_own_kernel=yes\n");
     793
     794    mr_fprintf(fd1, "files-in-filelist %ld\n", lines_in_filelist);
     795    mr_fprintf(fd1, "internal-tape-block-size %ld\n", bkpinfo->internal_tape_block_size);
     796    mr_fprintf(fd1, "total-slices %ld\n", estimated_total_noof_slices);
     797    mr_fprintf(fd1, "excluded-devs %s\n", devs_to_exclude);
     798    mr_free(devs_to_exclude);
     799    mr_fprintf(fd1, "image-devs %s\n", bkpinfo->image_devs);
     800    mr_fprintf(fd1, "last-filelist-number %s\n", last_filelist_number);
     801    mr_free(last_filelist_number);
     802    mr_fprintf(fd1, "bootloader.name %s\n", bootldr_str);
     803    mr_free(bootldr_str);
     804    mr_fprintf(fd1, "bootloader.device %s\n", bkpinfo->boot_device);
     805
     806    switch (bkpinfo->backup_media_type) {
     807    case cdr:
     808        mr_fprintf(fd1, "backup-media-type cdr\n");
     809        break;
     810    case cdrw:
     811        mr_fprintf(fd1, "backup-media-type cdrw\n");
     812        break;
     813    case cdstream:
     814        mr_fprintf(fd1, "backup-media-type cdstream\n");
     815        break;
     816    case tape:
     817        mr_fprintf(fd1, "backup-media-type tape\n");
     818        break;
     819    case udev:
     820        mr_fprintf(fd1, "backup-media-type udev\n");
     821        break;
     822    case iso:
     823        mr_fprintf(fd1, "backup-media-type iso\n");
     824        break;
     825    case nfs:
     826        mr_fprintf(fd1, "backup-media-type nfs\n");
     827        break;
     828    case dvd:
     829        mr_fprintf(fd1, "backup-media-type dvd\n");
     830        break;
     831    case usb:
     832        mr_fprintf(fd1, "backup-media-type usb\n");
     833        break;
     834    default:
     835        fatal_error("Unknown backup_media_type");
     836    }
     837
     838    if (bkpinfo->backup_media_type == usb) {
     839        mr_fprintf(fd, "mindi_write_usb=yes\n");
     840        mr_fprintf(fd, "mindi_usb_device=%s\n", bkpinfo->media_device);
     841    }
     842    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     843        mr_fprintf(fd, "mindi_write_tape=yes\n");
     844        mr_fprintf(fd, "mindi_tape_device=%s\n", bkpinfo->media_device);
     845        mr_fprintf(fd1, "media-dev %s\n", bkpinfo->media_device);
     846        mr_fprintf(fd1, "media-size %ld\n", bkpinfo->media_size[1]);
     847    }
     848    if (bkpinfo->compression_level > 0) {
     849        mr_fprintf(fd1, "use-comp yes\n");
     850    } else {
     851        mr_fprintf(fd1, "use-comp no\n");
     852    }
     853    if (bkpinfo->use_gzip) {
     854        mr_fprintf(fd1, "use-gzip yes\n");
     855    } else {
     856        mr_fprintf(fd1, "use-gzip no\n");
     857    }
     858    if (bkpinfo->use_lzo) {
     859        mr_fprintf(fd1, "use-lzo yes\n");
     860    } else {
     861        mr_fprintf(fd1, "use-lzo no\n");
     862    }
     863    if (bkpinfo->use_star) {
     864        mr_fprintf(fd1, "use-star yes\n");
     865    } else {
     866        mr_fprintf(fd1, "use-star no\n");
     867    }
     868    if (g_getfattr) {
     869        mr_fprintf(fd1, "xattr yes\n");
     870    } else {
     871        mr_fprintf(fd1, "xattr no\n");
     872    }
     873    if (g_getfacl) {
     874        mr_fprintf(fd1, "acl yes\n");
     875    } else {
     876        mr_fprintf(fd1, "acl no\n");
     877    }
     878
     879    if (g_cd_recovery) {
     880        mr_fprintf(fd1, "use-cdrecovery yes\n");
     881    } else {
     882        mr_fprintf(fd1, "use-cdrecovery no\n");
     883    }
     884
     885    if (bkpinfo->make_cd_use_lilo) {
     886        mr_fprintf(fd1, "use-lilo yes\n");
     887    } else {
     888        mr_fprintf(fd1, "use-lilo no\n");
     889    }
     890    if (bkpinfo->nonbootable_backup) {
     891        mr_fprintf(fd1, "non-bootable yes\n");
     892    } else {
     893        mr_fprintf(fd1, "non-bootable no\n");
     894    }
     895    if (bkpinfo->differential) {
     896        mr_fprintf(fd1, "differential 1\n");
     897    } else {
     898        mr_fprintf(fd1, "differential 0\n");
     899    }
     900
     901    mr_fclose(fd);
     902    mr_fprintf(fd1, "datestamp %s\n", mr_date());
     903    mr_fclose(fd1);
     904
     905    mr_asprintf(&command, "mindi --custom '%s' '%s/images'",
     906                bkpinfo->tmpdir, bkpinfo->scratchdir);
     907            //bkpinfo->tmpdir,      // parameter #2
     908            //bkpinfo->scratchdir,  // parameter #3
     909            //bkpinfo->kernel_path, // parameter #4
     910            //tape_device,          // parameter #5
     911            //tape_size_sz,         // parameter #6
     912            //lines_in_filelist,        // parameter #7 (INT)
     913            //use_lzo_sz,               // parameter #8
     914            //cd_recovery_sz,           // parameter #9
     915            //bkpinfo->image_devs,  // parameter #10
     916            //broken_bios_sz,           // parameter #11 always yes
     917            //last_filelist_number, // parameter #12 (STRING)
     918            //estimated_total_noof_slices,  // parameter #13 (INT)
     919            //devs_to_exclude,      // parameter #14
     920            //use_comp_sz,          // parameter #15
     921            //use_lilo_sz,          // parameter #16
     922            //use_star_sz,          // parameter #17
     923            //bkpinfo->internal_tape_block_size,    // parameter #18 (LONG)
     924            //bkpinfo->differential,    // parameter #19 (INT)
     925            //use_gzip_sz);         // parameter #20 (STRING)
     926
     927    mr_msg(2, command);
     928
     929
     930    res = run_program_and_log_to_screen(command, "Generating boot+data disks");
    852931    mr_free(command);
    853 
    854     mr_asprintf(&tmp, "BTW, I'm telling Mindi your kernel is '%s'",
    855              bkpinfo->kernel_path);
    856     log_to_screen(tmp);
    857     mr_free(tmp);
    858 
    859     mr_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
    860 
    861     if (bkpinfo->backup_media_type == usb) {
    862         mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
    863     } else {
    864         mr_asprintf(&tmp2,"");
    865     }
    866 
    867     // Watch it! This next line adds a parameter...
    868     if (bkpinfo->nonbootable_backup) {
    869         mr_asprintf(&tmp, " NONBOOTABLE");
    870     } else {
    871         mr_asprintf(&tmp, " ");
    872     }
    873 
    874     mr_asprintf(&command,
    875             "mindi %s --custom '%s' '%s/images' '%s' '%s' \
    876 '%s' %ld '%s' '%s' '%s' \
    877 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'",
    878             tmp2,
    879             bkpinfo->tmpdir,        // parameter #2
    880             bkpinfo->scratchdir,    // parameter #3
    881             bkpinfo->kernel_path,   // parameter #4
    882             tape_device,            // parameter #5
    883             tape_size_sz,           // parameter #6
    884             lines_in_filelist,      // parameter #7 (INT)
    885             use_lzo_sz,             // parameter #8
    886             cd_recovery_sz,         // parameter #9
    887             bkpinfo->image_devs,    // parameter #10
    888             broken_bios_sz,         // parameter #11
    889             last_filelist_number,   // parameter #12 (STRING)
    890             estimated_total_noof_slices,    // parameter #13 (INT)
    891             devs_to_exclude,        // parameter #14
    892             use_comp_sz,            // parameter #15
    893             use_lilo_sz,            // parameter #16
    894             use_star_sz,            // parameter #17
    895             bkpinfo->internal_tape_block_size,  // parameter #18 (LONG)
    896             bkpinfo->differential,  // parameter #19 (INT)
    897             use_gzip_sz,            // parameter #20 (STRING)
    898             tmp);
    899     mr_free(tmp);
    900     mr_free(tape_size_sz);
    901     mr_free(use_lzo_sz);
    902     mr_free(tape_device);
    903     mr_free(use_star_sz);
    904     mr_free(use_comp_sz);
    905     mr_free(broken_bios_sz);
    906     mr_free(cd_recovery_sz);
    907     mr_free(last_filelist_number);
    908     mr_free(devs_to_exclude);
    909     mr_free(use_lilo_sz);
    910     mr_free(use_gzip_sz);
    911     mr_free(tmp2);
    912 
    913     mr_msg(2, command);
    914 
    915     //  popup_and_OK("Pausing");
    916     res = run_program_and_log_to_screen(command,
    917                                         "Generating boot+data disks");
    918     mr_free(command);
    919 
    920932    if (bkpinfo->nonbootable_backup) {
    921933        res = 0;
     
    11761188        closeout_tape(bkpinfo);
    11771189    } else {
    1178         /* write final ISO */
     1190        /* write final ISO/USB */
    11791191        res = write_final_iso_if_necessary(bkpinfo);
    11801192        retval += res;
     
    18681880        if (bkpinfo->nonbootable_backup) {
    18691881            mr_msg(1, "Making nonbootable backup");
    1870 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end
    18711882            res = eval_call_to_make_ISO(bkpinfo,
    18721883                                        "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .",
     
    35633574        bkpinfo->media_size[g_current_media_number]) {
    35643575        mr_asprintf(&tmp,
    3565                  "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
    3566                  (long) space_occupied_by_cd(bkpinfo->scratchdir),
    3567                  (long) bkpinfo->media_size[g_current_media_number]);
     3576                "Warning! %s is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
     3577                media_descriptor_string(bkpinfo->backup_media_type),
     3578                (long) space_occupied_by_cd(bkpinfo->scratchdir),
     3579                (long) bkpinfo->media_size[g_current_media_number]);
    35683580        log_to_screen(tmp);
    35693581        mr_free(tmp);
    35703582    }
    3571     mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    3572              bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    3573              g_current_media_number);
     3583    if (bkpinfo->backup_media_type != usb) {
     3584        mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
     3585            bkpinfo->nfs_remote_dir, bkpinfo->prefix,
     3586            g_current_media_number);
     3587    } else {
     3588    }
    35743589    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    3575         res = make_iso_fs(bkpinfo, isofile);
     3590        if (bkpinfo->backup_media_type != usb) {
     3591            res = make_iso_fs(bkpinfo, isofile);
     3592        } else {
     3593        }
    35763594        if (g_current_media_number == 1 && !res
    35773595            && (bkpinfo->backup_media_type == cdr
     
    38543872
    38553873setenv("MONDO_SHARE", MONDO_SHARE, 1);
     3874setenv("MONDORESTORECFG", MONDORESTORECFG, 1);
     3875setenv("MONDO_CACHE", MONDO_CACHE, 1);
    38563876}
    38573877
  • trunk/mondo/src/common/libmondo-devices.h

    r783 r1106  
    22 * $Id$
    33 */
     4
     5#ifndef LIBMONDO_DEVICES_H
     6# define LIBMONDO_DEVICES_H
    47
    58bool am_I_in_disaster_recovery_mode(void);
     
    3639int eject_device(char *);
    3740
    38 char *list_of_NFS_mounts_only();
     41char *list_of_NFS_mounts_only(void);
    3942
    4043void sensibly_set_tmpdir_and_scratchdir(struct s_bkpinfo *bkpinfo);
     
    5760char *which_partition_format(const char *drive);
    5861char *bkptype_to_string(t_bkptype bt);
     62
     63#endif /* LIBMONDO_DEVICES_H */
  • trunk/mondo/src/common/libmondo-fifo-EXT.h

    r59 r1106  
    44                                    long internal_block_size);
    55extern void sigpipe_occurred(int);
    6 extern void kill_buffer();
     6extern void kill_buffer(void);
  • trunk/mondo/src/common/libmondo-filelist.c

    r1086 r1106  
    395395
    396396
    397 int call_exe_and_pipe_output_to_fd(char *syscall, FILE * pout)
     397int call_exe_and_pipe_output_to_fd(char *sys_call, FILE * pout)
    398398{
    399399    FILE *pattr;
     
    401401    size_t n = 0;
    402402
    403     pattr = popen(syscall, "r");
     403    pattr = popen(sys_call, "r");
    404404    if (!pattr) {
    405         mr_msg(1, "Failed to open fattr() %s", syscall);
     405        mr_msg(1, "Failed to open fattr() %s", sys_call);
    406406        return (1);
    407407    }
    408408    if (feof(pattr)) {
    409         mr_msg(1, "Failed to call fattr() %s", syscall);
     409        mr_msg(1, "Failed to call fattr() %s", sys_call);
    410410        paranoid_pclose(pattr);
    411411        return (2);
     
    426426    FILE *pout;
    427427    char *pout_command;
    428     char *syscall;
     428    char *sys_call;
    429429    char *file_to_analyze = NULL;
    430430    char *strtmp = NULL;
     
    454454        /* BERLIOS : to be checked */
    455455        mr_asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\'));
    456         mr_asprintf(&syscall, "%s 2>> /dev/null", strtmp);
     456        mr_asprintf(&sys_call, "%s 2>> /dev/null", strtmp);
    457457        mr_free(strtmp);
    458         call_exe_and_pipe_output_to_fd(syscall, pout);
    459         mr_free(syscall);
     458        call_exe_and_pipe_output_to_fd(sys_call, pout);
     459        mr_free(sys_call);
    460460    }
    461461    paranoid_fclose(fin);
  • trunk/mondo/src/common/libmondo-files.c

    r1086 r1106  
    1919#include "libmondo-string-EXT.h"
    2020#include "mr_mem.h"
     21
     22#include "mr_file.h"
    2123
    2224/*@unused@*/
     
    10441046    char *command = NULL;
    10451047
     1048    FILE *fd1 = NULL;
     1049
    10461050    /*@ pointers ***** */
    10471051    char *p;
     
    10961100            ("Unable to find ethN (eth0, eth1, ...) adapter via NFS mount you specified.");
    10971101    }
    1098     make_hole_for_dir("/var/cache/mondo-archive");
    10991102    /********
    11001103    * If the NFS device that found above is a bonded device,
     
    11211124    }
    11221125
    1123     mr_asprintf(&tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
    1124     write_one_liner_data_file(tmp, nfs_dev);
    11251126    mr_free(nfs_dev);
    11261127    mr_free(tmp);
    11271128
    1128     mr_asprintf(&tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    1129     write_one_liner_data_file(tmp, nfs_client_ipaddr);
    1130     mr_free(nfs_client_ipaddr);
    1131     mr_free(tmp);
    1132 
    1133     mr_asprintf(&tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    1134     write_one_liner_data_file(tmp, nfs_client_netmask);
    1135     mr_free(nfs_client_netmask);
    1136     mr_free(tmp);
    1137 
    1138     mr_asprintf(&tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    1139     write_one_liner_data_file(tmp, nfs_client_defgw);
    1140     mr_free(nfs_client_defgw);
    1141     mr_free(tmp);
    1142 
    1143     mr_asprintf(&tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    1144     write_one_liner_data_file(tmp, nfs_client_broadcast);
    1145     mr_free(nfs_client_broadcast);
    1146     mr_free(tmp);
    1147 
    1148     mr_asprintf(&tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    1149     write_one_liner_data_file(tmp, nfs_server_ipaddr);
    1150     mr_free(nfs_server_ipaddr);
    1151     mr_free(tmp);
    1152 
    1153     mr_asprintf(&tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
    1154     write_one_liner_data_file(tmp, bkpinfo->nfs_mount);
    1155     mr_free(tmp);
    1156 
    1157     mr_asprintf(&tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    1158     write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir);
    1159     mr_free(tmp);
    1160 
    1161     mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    1162     write_one_liner_data_file(tmp, bkpinfo->prefix);
    1163     mr_free(tmp);
     1129    fd1 = mr_fopen(MONDORESTORECFG, "a");
     1130    mr_fprintf(fd1, "nfs-dev %s\n", nfs_dev);
     1131    mr_fprintf(fd1, "nfs-client-ipaddr %s\n", nfs_client_ipaddr);
     1132    mr_fprintf(fd1, "nfs-client-netmask %s\n", nfs_client_netmask);
     1133    mr_fprintf(fd1, "nfs-client-broadcast %s\n", nfs_client_broadcast);
     1134    mr_fprintf(fd1, "nfs-client-defgw %s\n", nfs_client_defgw);
     1135    mr_fprintf(fd1, "nfs-server-ipaddr %s\n", nfs_server_ipaddr);
     1136    mr_fprintf(fd1, "nfs-server-mount %s\n", bkpinfo->nfs_mount);
     1137    mr_fprintf(fd1, "nfs-server-path %s\n", bkpinfo->nfs_remote_dir);
     1138    mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix);
     1139    mr_fclose(fd1);
    11641140
    11651141    log_it("Finished storing NFS configuration");
  • trunk/mondo/src/common/libmondo-raid.c

    r1086 r1106  
    214214 */
    215215void add_disk_to_raid_device(struct list_of_disks *disklist,
    216                              char *device_to_add, int index)
     216                             char *device_to_add, int idx)
    217217{
    218218    int items;
     
    222222    items = disklist->entries;
    223223    strcpy(disklist->el[items].device, device_to_add);
    224     disklist->el[items].index = index;
     224    disklist->el[items].index = idx;
    225225    items++;
    226226    disklist->entries = items;
     
    652652
    653653    struct list_of_disks *disklist = NULL;
    654     int index = 0;
    655654    int v = 0;
    656655
     
    708707            mr_free(tmp);
    709708        } else {
    710             index = atoi(valueB);
    711             add_disk_to_raid_device(disklist, value, index);
     709            add_disk_to_raid_device(disklist, value, atoi(valueB));
    712710        }
    713711        mr_free(labelB);
  • trunk/mondo/src/common/libmondo-tools-EXT.h

    r171 r1106  
    1 /* libmondo-tools-EXT.h */
     1/* $Id$ */
     2
     3#ifndef LIBMONDO_TOOLS_EXT_H
     4#define LIBMONDO_TOOLS_EXT_H
    25
    36extern void clean_up_KDE_desktop_if_necessary(void);
    4 extern long get_time();
     7extern long get_time(void);
    58extern void (*log_debug_msg) (int debug_level, const char *szFile,
    69                              const char *szFunction, int nLine,
     
    1720extern void initialize_raidrec(struct raid_device_record *raidrec);
    1821#endif
    19 extern int some_basic_system_sanity_checks();
     22extern int some_basic_system_sanity_checks(void);
    2023
    2124
     
    4043extern void free_libmondo_global_strings(void);
    4144
    42 extern double get_kernel_version();
    43 extern char *get_architecture();
     45extern double get_kernel_version(void);
     46extern char *get_architecture(void);
    4447
    4548extern bool does_nonMS_partition_exist(void);
     
    4851extern void stop_magicdev_if_necessary(void);
    4952extern void restart_magicdev_if_necessary(void);
     53
     54#endif /* LIBMONDO_TOOLS_EXT_H */
  • trunk/mondo/src/common/libmondo-tools.c

    r1086 r1106  
    1010#include "my-stuff.h"
    1111#include "mr_mem.h"
     12#include "mr_file.h"
     13
    1214#include "mondostructures.h"
    1315#include "libmondo-tools.h"
     
    362364    int rdsiz_MB;
    363365    char *iso_path = NULL;
     366    FILE *fd1 = NULL;
    364367
    365368    assert(bkpinfo != NULL);
     
    592595                 bkpinfo->isodir);
    593596        log_it("command = %s", command);
    594         tmp = call_program_and_get_last_line_of_output(command);
     597        iso_dev = call_program_and_get_last_line_of_output(command);
    595598        mr_free(command);
    596         log_it("res of it = %s", tmp);
    597         mr_asprintf(&tmp1, "%s/ISO-DEV", bkpinfo->tmpdir);
    598         write_one_liner_data_file(tmp1, tmp);
    599         mr_free(tmp1);
     599        log_it("res of it = %s", iso_dev);
     600
     601        fd1 = mr_fopen(MONDORESTORECFG, "a");
     602        mr_fprintf(fd1, "iso-dev %s\n", iso_dev);
    600603
    601604        mr_asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3",
    602                  tmp);
    603         mr_free(tmp);
     605                 iso_dev);
     606        mr_free(iso_dev);
     607
    604608        log_it("command = %s", command);
    605         tmp = call_program_and_get_last_line_of_output(command);
     609        iso_mnt = call_program_and_get_last_line_of_output(command);
    606610        mr_free(command);
    607         log_it("res of it = %s", tmp);
    608 
    609         mr_asprintf(&tmp1, "%s/ISO-MNT", bkpinfo->tmpdir);
    610         write_one_liner_data_file(tmp1, tmp);
    611         mr_free(tmp1);
    612 
    613         log_it("isomnt: %s, %d", tmp, strlen(tmp));
    614         if (strlen(bkpinfo->isodir) < strlen(tmp)) {
    615             mr_asprintf(&iso_path, " ");
    616         } else {
    617             mr_asprintf(&iso_path, "%s", bkpinfo->isodir + strlen(tmp));
    618         }
    619         mr_free(tmp);
    620 
    621         mr_asprintf(&tmp, "%s/ISODIR", bkpinfo->tmpdir);
    622         write_one_liner_data_file(tmp, iso_path);
    623         mr_free(tmp);
     611
     612        log_it("res of it = %s", iso_mnt);
     613        mr_fprintf(fd1, "iso-mnt %s\n", iso_mnt);
     614        log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt));
     615
     616        mr_asprintf(&iso_tmp, "%s", bkpinfo->isodir);
     617        if (strlen(iso_tmp) >= strlen(iso_mnt)) {
     618            mr_asprintf(&iso_path, "%s", iso_tmp + strlen(iso_mnt));
     619        }
     620        mr_free(iso_tmp);
     621        mr_free(iso_mnt);
     622
    624623        log_it("isodir: %s", iso_path);
     624        mr_fprintf(fd1, "isodir %s\n", iso_path);
    625625        mr_free(iso_path);
    626         mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    627         write_one_liner_data_file(tmp, bkpinfo->prefix);
     626
    628627        log_it("iso-prefix: %s",  bkpinfo->prefix);
    629         mr_free(tmp);
    630 /* End patch */
     628        mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix);
     629
     630        mr_fclose(fd1);
    631631    }                           // end of iso code
    632632
  • trunk/mondo/src/common/libmondo-tools.h

    r171 r1106  
    33     */
    44
     5#ifndef LIBMONDO_TOOLS_H
     6# define LIBMONDO_TOOLS_H
     7
    58void clean_up_KDE_desktop_if_necessary(void);
    69
    7 long get_time();
     10long get_time(void);
    811extern void (*log_debug_msg) (int debug_level, const char *szFile,
    912                              const char *szFunction, int nLine,
     
    2023void initialize_raidrec(struct raid_device_record *raidrec);
    2124#endif
    22 int some_basic_system_sanity_checks();
     25int some_basic_system_sanity_checks(void);
    2326
    2427
     
    4548void free_libmondo_global_strings(void);
    4649
    47 double get_kernel_version();
    48 char *get_architecture();
     50double get_kernel_version(void);
     51char *get_architecture(void);
    4952bool does_nonMS_partition_exist(void);
    5053void stop_magicdev_if_necessary(void);
    5154void restart_magicdev_if_necessary(void);
     55
     56#endif /* LIBMONDO_TOOLS_H */
  • trunk/mondo/src/common/newt-specific-EXT.h

    r688 r1106  
    55extern bool ask_me_OK_or_cancel(char *prompt);
    66extern void close_evalcall_form(void);
    7 extern void close_progress_form();
     7extern void close_progress_form(void);
    88extern void fatal_error(char *error_string);
    99extern void finish(int signal);
     
    1717extern bool popup_and_get_string(char *title, char *b, char *output);
    1818extern bool popup_with_buttons(char *p, char *button1, char *button2);
    19 extern void refresh_log_screen();
    20 extern void setup_newt_stuff();
     19extern void refresh_log_screen(void);
     20extern void setup_newt_stuff(void);
    2121extern void update_evalcall_form_ratio(int num, int denom);
    2222extern void update_evalcall_form(int curr);
     
    3030
    3131extern t_bkptype which_backup_media_type(bool);
    32 extern int which_compression_level();
     32extern int which_compression_level(void);
    3333
    3434
  • trunk/mondo/src/common/newt-specific.c

    r1086 r1106  
    351351 */
    352352    void
    353      finish(int signal) {
     353     finish(int signal_code) {
    354354        char *command = NULL;
    355355
     356<<<<<<< .courant
     357=======
     358        /*  if (signal_code==0) { popup_and_OK("Please press <enter> to quit."); } */
     359
     360        /* newtPopHelpLine(); */
     361
     362>>>>>>> .fusion-droit.r1105
    356363        register_pid(0, "mondo");
    357364        chdir("/");
     
    378385            }
    379386        }
     387<<<<<<< .courant
    380388        printf(_("Execution run ended; result=%d\n"), signal);
    381389        printf(_("Type 'less %s' to see the output log\n"), MONDO_LOGFILE);
     390=======
     391//  system("clear");
     392//  iamhere("Finished calling newtFinished");
     393        printf("Execution run ended; result=%d\n", signal_code);
     394        printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
     395>>>>>>> .fusion-droit.r1105
    382396        free_libmondo_global_strings();
    383         exit(signal);
     397        exit(signal_code);
    384398    }
    385399
     
    650664    void
    651665     popup_and_OK(char *prompt) {
    652         char ch;
     666        int ch;
    653667
    654668        assert_string_is_neither_NULL_nor_zerolength(prompt);
  • trunk/mondo/src/common/newt-specific.h

    r688 r1106  
    33 */
    44
    5 
     5#ifndef NEWT_SPECIFIC_H
     6# define NEWT_SPECIFIC_H
    67#ifndef H_NEWT
    78#include <newt.h>
     
    1112bool ask_me_OK_or_cancel(char *prompt);
    1213void close_evalcall_form(void);
    13 void close_progress_form();
     14void close_progress_form(void);
    1415void fatal_error(char *error_string);
    1516void finish(int signal);
     
    2324bool popup_and_get_string(char *title, char *b, char *output);
    2425bool popup_with_buttons(char *p, char *button1, char *button2);
    25 void refresh_log_screen();
    26 void setup_newt_stuff();
     26void refresh_log_screen(void);
     27void setup_newt_stuff(void);
    2728void update_evalcall_form_ratio(int num, int denom);
    2829void update_evalcall_form(int curr);
     
    3637
    3738t_bkptype which_backup_media_type(bool);
    38 int which_compression_level();
     39int which_compression_level(void);
    3940
    4041
    4142void popup_changelist_from_file(char *source_file);
     43
     44#endif /* NEWT_SPECIFIC_H */
     45
  • trunk/mondo/src/include/mr_err.h

    r1074 r1106  
    99#define MR_ERR_H
    1010
     11#include "mr_msg.h"
     12
    1113/* functions (public methods) */
    1214
    1315extern inline void mr_exit(int errorcode, const char *message);
    14 extern inline void mr_log_exit(int errorcode, const char *message);
     16#define mr_log_exit(x,y) {mr_msg(0,y); mr_exit(x, y);}
    1517
    1618#endif                          /* MR_ERR_H */
  • trunk/mondo/src/include/mr_mem.h

    r1074 r1106  
    1313#endif
    1414#include <stdarg.h>
     15#include <stdio.h>
    1516
    1617/* functions (public methods) */
    1718
    18 extern inline void mr_free(char *allocated);
    19 extern inline void mr_allocstr(char *alloc, const char *orig);
    20 extern inline void mr_asprintf(char **alloc, const char *fmt, ...);
    21 extern inline void mr_getline(char **lineptr, size_t *n, FILE *stream);
    22 extern inline void *mr_malloc(size_t size);
     19#define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__)
     20#define mr_allocstr(x,y) mr_allocstr_int(x, y,__LINE__,__FILE__)
     21#define mr_asprintf(x,y,args...) mr_asprintf_int(x,__LINE__,__FILE__, y, ## args)
     22#define mr_getline(x,y,z) mr_getline_int(x, y,z,__LINE__,__FILE__)
     23#define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__)
     24
     25/* Internal function bringing debuging info
     26 * called indirectly through macros */
     27extern inline void mr_free_int(void **allocated, int line, char *file);
     28extern inline void mr_allocstr_int(char *alloc, const char *orig, int line, char *file);
     29extern inline void mr_asprintf_int(char **alloc, int line, char *file, const char *fmt, ...);
     30extern inline void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, char *file);
     31extern inline void *mr_malloc_int(size_t size, int line, char *file);
    2332
    2433#endif                          /* MR_MEM_H */
  • trunk/mondo/src/include/mr_msg.h

    r1074 r1106  
    1616/* functions (public methods) */
    1717
    18 extern inline void mr_msg(int debug, const char *fmt, ...);
     18#define mr_msg(x,y,args...) {mr_msg_int(x,__LINE__,__FILE__,y,## args);}
    1919extern void mr_msg_init(const char *configfile, int loglevel);
    2020extern void mr_msg_close(void);
    2121
     22/* Internal function bringing debuging info
     23 * called indirectly through macros */
     24extern inline void mr_msg_int(int debug,int line, const char *file, const char *fmt, ...);
     25
    2226#endif                          /* MR_MSG_H */
  • trunk/mondo/src/include/mr_str.h

    r1079 r1106  
    1313extern inline char *mr_strtok(char *instr, const char *delims, int *lastpos);
    1414extern inline char *mr_stresc(char *instr, char *toesc, const char escchr);
     15extern inline char *mr_date(void);
    1516
    1617#endif                          /* MR_STR_H */
  • trunk/mondo/src/include/my-stuff.h

    r1081 r1106  
    1313/*The number of lines of log output to keep at the bottom of the screen.*/
    1414#define NOOF_ERR_LINES  6   
     15
     16/* Hardcoded: Bad for the moment */
     17#define MONDO_CACHE "/var/cache/mondo"
     18#define MONDORESTORECFG MONDO_CACHE"/mondo-restore.cfg"
     19
    1520
    1621/**
     
    270275 * Free variables and call finish(@p x).
    271276 */
    272 #define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) mr_free ( g_bkpinfo_DONTUSETHIS ); finish(x); }
     277#define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) mr_free ( (void*) g_bkpinfo_DONTUSETHIS ); finish(x); }
    273278
    274279/**
  • trunk/mondo/src/lib/Makefile.am

    r900 r1106  
    77noinst_LIBRARIES = libmr.a
    88
    9 libmr_a_SOURCES  = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c
     9libmr_a_SOURCES  = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c mr_file.c
  • trunk/mondo/src/lib/mr_err.c

    r1074 r1106  
    2727        /* We have to properly end newt */
    2828        /* We have to remind people of log files */
     29        mr_msg_close();
    2930}
    3031
     
    3839    exit(errorcode);
    3940}
    40 
    41 void mr_log_exit(int errorcode, const char *message) {
    42     mr_msg(0, message);
    43     mr_exit(errorcode, message);
    44 }
  • trunk/mondo/src/lib/mr_mem.c

    r1074 r1106  
    2222/*
    2323 * Function that frees memory if necessary
     24 * A pointer to the memory pointed is passed to it.
     25 * *allocated variable points then to the original content
     26 * pointed to by the caller
    2427 */
    25 void mr_free(void *allocated) {
     28void mr_free_int(void **allocated, int line, const char *file) {
    2629
    2730    /* free man pages says that if allocated is NULL
    2831     * nothing happens
    2932     */
    30     free(allocated);
    31     allocated = NULL;
     33    if (*allocated != NULL) {
     34        free(*allocated);
     35        *allocated = NULL;
     36    } else {
     37        mr_msg_int(0,line,file,"Attempt to reference NULL pointer\nExiting...");
     38        mr_exit(-1,"Attempt to reference NULL pointer");
     39    }
    3240}
    3341
    3442/* encapsulation function for malloc */
    35 void *mr_malloc(size_t size) {
     43void *mr_malloc_int(size_t size, int line, const char *file) {
    3644   
    3745    void *ret;
     
    3947    ret = malloc(size);
    4048    if (ret == NULL) {
    41         mr_log_exit(-1,"Unable to alloc memory in mr_malloc\nExiting...");
     49        mr_msg_int(0,line,file,"Unable to alloc memory in mr_malloc\nExiting...");
     50        mr_exit(-1,"Unable to alloc memory in mr_malloc");
    4251    }
    4352    return(ret);
     
    4554
    4655/* encapsulation function for getline */
    47 void mr_getline(char **lineptr, size_t *n, FILE *stream) {
     56void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, const char *file) {
    4857   
    4958    ssize_t ret;
     
    5160    ret = getline(lineptr,n,stream);
    5261    if (ret == -1) {
    53         mr_log_exit(-1,"Unable to alloc memory in mr_getline\nExiting...");
     62        mr_msg_int(0,line,file,"Unable to alloc memory in mr_getline\nExiting...",line,file);
     63        mr_exit(-1,"Unable to alloc memory in mr_getline");
    5464    }
    5565}
    5666
    5767/* encapsulation function for asprintf */
    58 void mr_asprintf(char **strp, const char *fmt, ...) {
     68void mr_asprintf_int(char **strp, int line, const char *file, const char *fmt, ...) {
    5969
    6070    int res = 0;
     
    6474    res = vasprintf(strp, fmt, args);
    6575    if (res == -1) {
    66         mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting...");
     76        mr_msg_int(0,line,file,"Unable to alloc memory in mr_asprintf\nExiting...",line,file);
     77        mr_exit(-1,"Unable to alloc memory in mr_asprintf");
    6778    }
    6879    va_end(args);
     
    7384 * freeing it before in any case
    7485 */
    75 void mr_allocstr(char *alloc, const char *orig) {
     86void mr_allocstr_int(char *alloc, const char *orig, int line, const char *file) {
    7687
    77     mr_free((void *)alloc);
    78     mr_asprintf(&alloc, orig);
     88    mr_free_int((void **)&alloc, line, file);
     89    mr_asprintf_int(&alloc, line, file, orig);
    7990}
  • trunk/mondo/src/lib/mr_msg.c

    r1074 r1106  
    5252 * Function that log a message. Not called directly
    5353 * but through other functions
     54 * fmt needs to be just before ...
    5455 */
    55 void mr_msg(int debug, const char *fmt, ...) {
     56void mr_msg_int(int debug, int line, const char *file, const char *fmt, ...) {
    5657
    5758    int i = 0;
     
    7475            for (i = 1; i < debug; i++)
    7576                fprintf(fout, "  ");
    76             fprintf(fout, "%s->%s#%d: ", __FILE__, __FUNCTION__, __LINE__);
     77            fprintf(fout, "%s #%d: ", file, line);
    7778        }
    7879        va_start(args,fmt);
  • trunk/mondo/src/lib/mr_str.c

    r1079 r1106  
    88#include <stdio.h>
    99#include <string.h>
     10#include <time.h>
    1011
    1112#include "mr_mem.h"
     
    105106    return retstr;
    106107}
     108
     109/* Return a string containing the date */
     110char *mr_date(void) {
     111   
     112    time_t tcurr;
     113
     114    tcurr = time(NULL);
     115    return(ctime(&tcurr));
     116}
     117
  • trunk/mondo/src/mondoarchive/main.c

    r1086 r1106  
    1515#include <stdio.h>
    1616#include <stdlib.h>
     17#include <sys/types.h>
     18#include <sys/stat.h>
     19#include <unistd.h>
     20
    1721#include "my-stuff.h"
    1822#include "../common/mondostructures.h"
     
    2125
    2226#include "mr_mem.h"
     27#include "mr_str.h"
     28#include "mr_file.h"
    2329
    2430// for CVS
     
    124130}
    125131
    126 /* Return a string containing the date */
    127 char *mr_date(void) {
    128    
    129     time_t tcurr;
    130 
    131     tcurr = time(NULL);
    132     return(ctime(&tcurr));
    133 }
    134 
    135132/*-----------------------------------------------------------*/
    136133
     
    144141{
    145142    struct s_bkpinfo *bkpinfo;
     143    struct stat stbuf;
    146144    char *tmp;
    147145    int res = 0;
     
    192190    setenv("ARCH", get_architecture(), 1);
    193191
    194     /* Add MONDO_SHARE environment variable for mindi */
     192    /* Add MONDO_SHARE + others environment variable for mindi */
    195193    setenv_mondo_share();
     194
     195    if (stat(MONDO_CACHE, &stbuf) != 0) {
     196        mr_mkdir(MONDO_CACHE,0x755);
     197    }
    196198
    197199    /* Configure the bkpinfo structure, global file paths, etc. */
  • trunk/mondo/src/mondorestore/mondo-prep.c

    r1086 r1106  
    20102010    system("clear");
    20112011    newtResume();
    2012     mr_free(drivelist);
     2012    mr_free((void*) drivelist);
    20132013    return (retval);
    20142014}
     
    26042604    }
    26052605    log_to_screen(_("Mountlist adjusted to suit current hard drive(s)"));
    2606     mr_free(drivelist);
     2606    mr_free((void*) drivelist);
    26072607}
    26082608
  • trunk/mondo/src/mondorestore/mondo-rstr-newt.c

    r1086 r1106  
    6767    /** int ****************************************************************/
    6868    int i = 0;
    69     int index = 0;
     69    int idx = 0;
    7070    int currline = 0;
    7171    int items = 0;
     
    103103            log_it("I don't know what this button does");
    104104        } else {
    105             index = find_next_free_index_in_disklist(disklist);
     105            idx = find_next_free_index_in_disklist(disklist);
    106106
    107107            items = disklist->entries;
    108108            strcpy(disklist->el[items].device,
    109109                   unallocated_raid_partitions->el[currline].device);
    110             disklist->el[items].index = index;
     110            disklist->el[items].index = idx;
    111111            disklist->entries = ++items;
    112112
     
    17331733        calculate_raid_device_size(mountlist, raidlist,
    17341734                                   raidrec->raid_device);
    1735     mr_free(bkp_raidrec);
     1735    mr_free((void*) bkp_raidrec);
    17361736#endif
    17371737}
     
    22592259
    22602260    /** int ***************************************************************/
    2261     int index = -1;
     2261    int idx = -1;
    22622262    int pos = 0;
    22632263
     
    22692269    for (done = FALSE; !done;) {
    22702270        for (pos = 0;
    2271              pos < disklist->entries && disklist->el[pos].index <= index;
     2271             pos < disklist->entries && disklist->el[pos].index <= idx;
    22722272             pos++);
    22732273        if (pos >= disklist->entries) {
    22742274            done = TRUE;
    22752275        } else {
    2276             index = disklist->el[pos].index;
    2277         }
    2278     }
    2279     return (index + 1);
     2276            idx = disklist->el[pos].index;
     2277        }
     2278    }
     2279    return (idx + 1);
    22802280}
    22812281
     
    23352335                char *isodir_path, bool nuke_me_please)
    23362336{
     2337    char *value = NULL;
    23372338
    23382339    /** initialize ********************************************************/
    2339 
    2340     // %d no var ???
    2341     // log_it("%d - AAA - isodir_path = %s", isodir_path);
     2340    malloc_string(value);
     2341
    23422342    if (isodir_device == NULL) {
    23432343        mr_asprintf(&isodir_device, "/dev/");
     
    23462346        mr_asprintf(&isodir_path, "/");
    23472347    }
    2348     if (does_file_exist("/tmp/NFS-SERVER-PATH")) {
    2349         mr_free(isodir_device);
    2350         isodir_device = last_line_of_file("/tmp/NFS-SERVER-MOUNT");
     2348    if (read_cfg_var(g_mondo_cfg_file, "nfs-server-path", value) == 0) {
     2349        read_cfg_var(g_mondo_cfg_file, "nfs-server-mount", isodir_device);
     2350        mr_free(isodir_format);
    23512351        mr_asprintf(&isodir_format, "nfs");
    23522352        mr_free(isodir_path);
    2353         isodir_path = last_line_of_file("/tmp/NFS-SERVER-PATH");
    2354     }
     2353        mr_asprintf(isodir_path, value);
     2354    }
     2355    mr_free(value);
     2356
    23552357    if (nuke_me_please) {
    23562358        return (TRUE);
     
    24512453 * Dummy function that proves that we can get to the point where Mondo is run.
    24522454 */
    2453 void nuke_mode_dummy()
     2455void nuke_mode_dummy(void)
    24542456{
    24552457
     
    29122914               sizeof(struct list_of_disks));
    29132915    }
    2914     mr_free(bkp_raidrec);
    2915     mr_free(bkp_disklist);
    2916     mr_free(bkp_raidlist);
    2917     mr_free(unallocated_raid_partitions);
     2916    mr_free((void*) bkp_raidrec);
     2917    mr_free((void*) bkp_disklist);
     2918    mr_free((void*) bkp_raidlist);
     2919    mr_free((void*) unallocated_raid_partitions);
    29182920}
    29192921#endif
  • trunk/mondo/src/mondorestore/mondo-rstr-newt.h

    r783 r1106  
    120120char *mountlist_entry_to_string(struct mountlist_itself *, int);
    121121void mvaddstr_and_log_it(int, int, char *);
    122 void nuke_mode_dummy();
     122void nuke_mode_dummy(void);
    123123char *number_of_disks_as_string(int, char *);
    124124void open_evalcall_form(char *);
  • trunk/mondo/src/mondorestore/mondo-rstr-tools-EXT.h

    r914 r1106  
    33**/
    44
    5 extern void free_MR_global_filenames();
     5extern void free_MR_global_filenames(void);
    66extern void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *);
    77extern bool is_file_in_list(char *, char *, char *);    /* needle, haystack, preamble */
  • trunk/mondo/src/mondorestore/mondo-rstr-tools.c

    r1086 r1106  
    5555 * Free the malloc()s for the filename variables.
    5656 */
    57 void free_MR_global_filenames()
     57void free_MR_global_filenames(void)
    5858{
    5959    mr_free(g_biggielist_txt);
     
    537537
    538538    assert(p_external_copy_of_mountlist != NULL);
    539     mountlist = mr_malloc(sizeof(struct mountlist_itself));
     539    mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));
    540540    memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    541541           sizeof(struct mountlist_itself));
     
    620620    }
    621621    run_program_and_log_output("df -m", 3);
    622     mr_free(mountlist);
     622    mr_free((void*) mountlist);
    623623    return (retval);
    624624}
     
    918918
    919919    read_cfg_var(cfg_file, "acl", value);
    920     if (strstr(value, "TRUE")) {
     920    if (strstr(value, "yes")) {
    921921        mr_asprintf(&g_getfacl,"setfacl");
    922922        mr_msg(1, "We will restore ACLs");
     
    926926    }
    927927    read_cfg_var(cfg_file, "xattr", value);
    928     if (strstr(value, "TRUE")) {
     928    if (strstr(value, "yes")) {
    929929        mr_asprintf(&g_getfattr,"setfattr");
    930930        mr_msg(1, "We will restore XATTRs");
     
    20272027    assert(p_external_copy_of_mountlist != NULL);
    20282028
    2029     mountlist = mr_malloc(sizeof(struct mountlist_itself));
     2029    mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));
    20302030    memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    20312031           sizeof(struct mountlist_itself));
     
    21202120        log_to_screen(_("All partitions were unmounted OK."));
    21212121    }
    2122     mr_free(mountlist);
     2122    mr_free((void*) mountlist);
    21232123    return (retval);
    21242124}
     
    24412441    char *screen_message = NULL;
    24422442
    2443     raidlist = mr_malloc(sizeof(struct raidlist_itself));
     2443    raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself));
    24442444
    24452445    assert(wait_for_percentage <= 100);
     
    24792479        }
    24802480    }
    2481     mr_free(raidlist);
    2482 }
     2481    mr_free((void*) raidlist);
     2482}
  • trunk/mondo/src/mondorestore/mondo-rstr-tools.h

    r1079 r1106  
    33**/
    44
    5 void free_global_filenames();
     5void free_global_filenames(void);
    66void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *);
    77bool is_file_in_list(char *, char *, char *);   /* needle, haystack, preamble */
  • trunk/mondo/src/test/mktest

    r1079 r1106  
    77
    88lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c"
    9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align -O2 -g -I../common -I../include"
     9OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align -fno-strict-aliasing -O2 -g -I../common -I../include"
    1010
    1111echo "Generating test-msg"
     
    1515echo "Generating test-conf"
    1616gcc $OPT test-conf.c $lib -o test-conf
     17echo "Generating test-mem"
     18gcc $OPT test-mem.c $lib -o test-mem
    1719
    1820echo "Testing against previous run"
    19 for f in test-conf test-string test-msg; do
     21for f in test-conf test-string test-msg test-mem; do
    2022    chmod 755 $f
    2123    ./$f > /tmp/$f.res
     
    2325    if [ $? -ne 0 ]; then
    2426        echo "$f test KO !!"
     27    else
     28        echo "$f test OK"
    2529    fi
    2630    valgrind -q --error-exitcode=1 --leak-check=yes ./$f 2>&1 > /tmp/valgrind-$f.res
Note: See TracChangeset for help on using the changeset viewer.