Changeset 1087 in MondoRescue


Ignore:
Timestamp:
Feb 2, 2007, 11:31:00 PM (17 years ago)
Author:
Bruno Cornec
Message:

WARNING: Not tested yet ! Will be stabilized in next hours.
this patch changes the interface between mindi and mondo.
Everything is now managed through either MONDO_CACHE/mondo-restore.cfg
and MONDO_CACHE/mindi.conf (an additional configuration file)
This removes all the one line files NFS-*, ... that where used
in an anarchic way. Now everything computed by mondo is
under mondo-restore.cfg and everything related to mindi in mindi.conf

Still needed are the removal of the 2 parameters to mindi,
but that will be done after when a clear line is drawn between
where files are put by each tool.

MONDO_TMP and MINDI_TMP should be reserved for temporary files
MONDO_CACHE and MINDI_CACHE for end results and communication
between tools.
These changes were made in order to prepare the USB support in mondo

A first step in the right direction, but still some work to do
before it's working again.
Testers please be warned.

Location:
branches/stable
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/distributions/conf/mindi.conf.dist

    r1071 r1087  
    4848
    4949#
     50# Write mindi Tape (yes|no) ?
     51#
     52mindi_write_tape="no"
     53
     54#
    5055# If set to "no", you will be prompted for whether or not
    5156# you want to use your own kernel, or the supplied default.
     
    5762# Images creation dir
    5863# WARNING: This directory is erased before usage
     64# This is also the directory mondoarchive will use to find
     65# what it needs to create it rescue media
    5966#
    60 mindi_images_dir="/var/cache/mindi"
     67mindi_cache_dir="/var/cache/mindi"
    6168
    6269#
    6370# Temporary directory
     71# Under it a temporary directory will be created to host all
     72# temporary files for mindi. That subdirectory is erased at the end of mindi
    6473#
    6574mindi_tmp_dir="/tmp"
     
    6978#
    7079mindi_fd_device="/dev/fd0"
     80
     81#
     82# USB Disk Device
     83#
     84mindi_usb_device="/dev/sda1"
     85
     86#
     87# Tape Device
     88#
     89mindi_tape_device="/dev/st0"
    7190
    7291#
  • branches/stable/mindi/mindi

    r1082 r1087  
    4848
    4949MINDI_CONFIG="$MINDI_CONF/mindi.conf"
    50 if [ ! -f $MINDI_CONFIG ]; then
     50if [ ! -f $MINDI_CONFIG ]  && [ "$1" != "--printvar" ]; then
    5151    echo "No $MINDI_CONFIG file found using sensible values from $MINDI_CONFIG_DIST"
    5252else
    53     echo "Using $MINDI_CONFIG as additional config file to $MINDI_CONFIG_DIST"
     53    if [ "$1" != "--printvar" ]; 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
     
    1005992
    1006993
    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 
    1050994MakeModuleLoadingScript() {
    1051995    local module fname params modpath kver outerloop i modpaths kver searchpath list_to_echo j
     
    11321076    [ -e "$MY_FSTAB" ] || Die "Cannot find your fstab file ($MY_FSTAB)"
    11331077
    1134     rm -f $mountlist
    1135     mkdir -p $mountlist
    1136     rm -Rf $mountlist
     1078    [ "$mountlist" != "" ] && rm -Rf $mountlist
    11371079    > $mountlist
    11381080    echo -en "\rHang on...\r"
     
    14461388    rm -f $1.tmp
    14471389    if [ "$CDRECOVERY" != "yes" ] ; then
    1448         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1390        if [ "$NFS_DEV" != "" ] ; then
    14491391            echo -en "Press <enter> to continue.\n" >> $1
    14501392        elif [ ! "$MINDI_TMP" ] ; then
     
    15301472        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
    15311473    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."
     1474    if [ _"$MINDI_TMP" = _"" ]; then
     1475        Die "MINDI_TMP undefined"
    15351476    fi
    15361477    rm -Rf $MINDI_TMP/iso
     
    15631504    cd $MINDI_TMP/iso/isolinux
    15641505    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
     1506    if [ "$NFS_DEV" != "" ] ; then
    15661507        perl -pi -e 's/interactive/iso/' isolinux.cfg
    15671508    fi
     
    15761517            cp -f $MONDO_SHARE/autorun . 2>> $LOGFILE
    15771518        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
     1519        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
     1520    else
     1521        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
    15811522    fi
    15821523    if [ "$?" -ne "0" ] ; then
     
    15871528        LogIt "Failed to create ISO image."
    15881529    else
    1589         echo "Created bootable ISO image at $CACHE_LOC/mindi.iso" >> $LOGFILE
     1530        echo "Created bootable ISO image at $MINDI_CACHE/mindi.iso" >> $LOGFILE
    15901531    fi
    15911532    rm -f $MINDI_TMP/mkisofs.log
     
    15981539    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then
    15991540        echo "Shall I make a bootable USB image ?"
    1600         echo -en "WARNING: This will erase all content on $USBDEV (y/[n]) "
     1541        echo -en "WARNING: This will erase all content on $USBDEVICE (y/[n]) "
    16011542        read i
    16021543        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
    16031544    fi
     1545    if [ _"$MINDI_TMP" = _"" ]; then
     1546        Die "MINDI_TMP undefined"
     1547    fi
    16041548    rm -Rf $MINDI_TMP/usb
    16051549    mkdir -p $MINDI_TMP/usb
    1606     USBPART="${USBDEV}1"
    1607 
    1608     echo -en "Transforming $USBDEV in a Bootable device "
     1550    USBPART="${USBDEVICE}1"
     1551
     1552    echo -en "Transforming $USBDEVICE in a Bootable device "
    16091553    echo -en "."
    1610     echo "Transforming $USBDEV in a Bootable device"  >> $LOGFILE
    1611     echo "Checking $USBDEV" >> $LOGFILE
    1612     $FDISK -l $USBDEV 2>&1 >> $LOGFILE
     1554    echo "Transforming $USBDEVICE in a Bootable device"  >> $LOGFILE
     1555    echo "Checking $USBDEVICE" >> $LOGFILE
     1556    $FDISK -l $USBDEVICE 2>&1 >> $LOGFILE
    16131557    if [ $? -ne 0 ]; then
    1614         echo "Unable to access $USBDEV" | tee -a $LOGFILE
     1558        echo "Unable to access $USBDEVICE" | tee -a $LOGFILE
    16151559        echo "Make sure your USB device is pluged in" | tee -a $LOGFILE
    16161560        MindiExit -1
    16171561    fi
    16181562    echo -en "."
    1619     echo "Erasing $USBDEV" >> $LOGFILE
    1620     $FDISK $USBDEV 2>&1 >> $LOGFILE << EOF
     1563    echo "Erasing $USBDEVICE" >> $LOGFILE
     1564    $FDISK $USBDEVICE 2>&1 >> $LOGFILE << EOF
    16211565d
    16221566d
     
    16351579EOF
    16361580    if [ $? -ne 0 ]; then
    1637         echo "Unable to create a vfat Filesystem on $USBDEV" | tee -a $LOGFILE
     1581        echo "Unable to create a vfat Filesystem on $USBDEVICE" | tee -a $LOGFILE
    16381582        echo "Make sure your USB device is pluged in" | tee -a $LOGFILE
    1639         $FDISK -l $USBDEV 2>&1 | tee -a $LOGFILE
     1583        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
    16401584        MindiExit -1
    16411585    fi
     
    16461590        echo "Unable to create a vfat filesystem on $USBPART" | tee -a $LOGFILE
    16471591        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
     1592        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
    16491593        MindiExit -1
    16501594    fi
     
    16551599        echo "Unable to mount $USBPART on $MINDI_TMP/usb" | tee -a $LOGFILE
    16561600        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
     1601        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
    16581602        MindiExit -1
    16591603    fi
     
    16931637    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?"
    16941638    echo -en "."
    1695     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1639    if [ "$NFS_DEV" != "" ] ; then
    16961640        perl -pi -e 's/interactive/iso/' syslinux.cfg
    16971641    fi
     
    17171661    else
    17181662        echo -e "$DONE"
    1719         echo "Created bootable USB image on $USBDEV" >> $LOGFILE
     1663        echo "Created bootable USB image on $USBDEVICE" >> $LOGFILE
    17201664    fi
    17211665    rm -f $MINDI_TMP/syslinux.log
     1666    #
     1667    # If mondoarchive, then tranfer $MINDI_CACHE content to the USB device
     1668    # and mount that device under that mountpoint instead
     1669    # Has to be done at the end here.
     1670    #
     1671    if [ _"$MONDO_SHARE" != _"" ]; then
     1672        mount $USBPART $MINDI_TMP/usb 2>> $LOGFILE
     1673        mv $MINDI_CACHE/* $MINDI_TMP/usb
     1674        umount $MINDI_TMP/usb
     1675        mount $USBPART $MINDI_CACHE
     1676    fi
    17221677}
    17231678
     
    17391694        if [ _"$MONDO_SHARE" != _"" ]; then
    17401695            if [ "$CDRECOVERY" != "yes" ] ; then
    1741                 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1696                if [ "$NFS_DEV" != "" ] ; then
    17421697                    echo -en "Press <enter> to continue.\n"
    17431698                elif [ ! "$MINDI_TMP" ] ; then
     
    18341789        echo -en "default=RESTORE\n"
    18351790    elif [ "$disksize" -gt "2880" ] && [ _"$MONDO_SHARE" != _"" ]; then
    1836         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1791        if [ "$NFS_DEV" != "" ] ; then
    18371792            echo -en "default=iso\n"
    18381793        else
     
    18551810    elif [ "$disksize" -gt "2880" ] ; then
    18561811        if [ _"$MONDO_SHARE" != _"" ]; then
    1857             if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1812            if [ "$NFS_DEV" != "" ] ; then
    18581813                options="iso"
    18591814            else
     
    19751930
    19761931    # copy the kernel across
    1977     rm -Rf $mountpoint/lost+found
     1932    [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found
    19781933    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
    19791934    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     
    20111966    if [ "$disksize" -gt "2880" ] && [ ! "$KERN_DISK_MADE" ] ; then
    20121967        if [ "$ARCH" != "ia64" ] ; then
    2013         $LILO_EXE $LILO_OPTIONS -r $mountpoint >> $LOGFILE 2>> $LOGFILE
     1968        $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE
    20141969        else
    20151970            /bin/true
     
    20962051    [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?"
    20972052    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
     2053    if [ "$NFS_DEV" != "" ] ; then
    20992054        perl -pi -e 's/interactive/iso/' syslinux.cfg
    21002055    fi
     
    21152070
    21162071    # copy the kernel across
    2117     rm -Rf $mountpoint/lost+found
     2072    [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found
    21182073    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
    21192074    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     
    22262181    mkdir -p $bigdir/tmp
    22272182    if [ _"$MONDO_SHARE" != _"" ]; then
    2228         MakeMondoConfigFile $MINDI_TMP/mondo-restore.cfg
    2229         cp -f $MINDI_TMP/mondo-restore.cfg $bigdir/tmp &> /dev/null
     2183        cp -f $MONDO_CACHE/mondo-restore.cfg $bigdir/tmp &> /dev/null
    22302184    fi
    22312185    [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO
     
    22422196
    22432197    # master boot record, too
    2244     i=`cat $MINDI_TMP/BOOTLOADER.DEVICE 2> /dev/null`
     2198    i=`grep bootloader.device $MONDORESTORECFG | cut -d' ' -f2 2> /dev/null`
    22452199    if [ "$i" ] ; then
    22462200        LogIt "Backing up $i's MBR"
     
    24372391    bigdir=$1
    24382392    minidir_root=$2
    2439     rm -Rf $minidir_root/*
     2393    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/*
    24402394
    24412395    TryToFitDataIntoSeveralDirs $bigdir $minidir_root
     
    24462400    fi
    24472401    RejigHyperlinks $minidir_root $noof_disks
    2448     rm -Rf $bigdir/*
     2402    [ "$bigdir" != "" ] && rm -Rf $bigdir/*
    24492403    return $noof_disks
    24502404}
     
    26242578    cd $old_pwd
    26252579    echo -en "\rThe files have been subdivided into $noof_disks directories.                                                            \r"
    2626     rm -Rf $minidir_root/compressed
     2580    [ "$minidir_root" != "" ] && rm -Rf $minidir_root/compressed
    26272581    if [ "$retval" -gt "0" ] ; then
    26282582        return 0
     
    27162670        list_of_groovy_mods="$CDROM_MODS `WhichOfTheseModulesAreLoaded "$SCSI_MODS"`"
    27172671    fi
    2718     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     2672    if [ "$NFS_DEV" != "" ] ; then
    27192673        # For PXE boot
    27202674        list_of_groovy_mods="$list_of_groovy_mods $NET_MODS"
     
    27392693    fi
    27402694    cd $old_pwd
    2741     [ "$TAPEDEV" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE
     2695    [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE
    27422696    dd if=/dev/zero of=$mountpoint/zero &> /dev/null
    27432697    rm -f $mountpoint/zero
     2698    mkdir -p $mountpoint/tmp
    27442699    if [ _"$MONDO_SHARE" != _"" ]; then
    2745         MakeMondoConfigFile $mountpoint/tmp/mondo-restore.cfg
    2746         cp -f $mountpoint/tmp/mondo-restore.cfg $MINDI_TMP &> /dev/null
     2700        cp -f $MONDO_CACHE/mondo-restore.cfg $mountpoint/tmp &> /dev/null || Die "Cannot copy mondo-restore.cfg to ramdisk"
    27472701        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
     2702    fi
    27562703    mkdir -p $mountpoint/proc
    27572704    echo "$disksize" > $mountpoint/tmp/$disksize.siz
     
    27592706    umount $mountpoint || Die "Cannot unmount $tempfile"
    27602707    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
    27632708    if [ "$res" -eq "0" ] ; then
    27642709        echo -en "..."
     
    28062751        done
    28072752        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
    28102753    fi
    28112754    tar -b 4096 -cf - * 2> /dev/null | gzip -9 > $tardir/all.tar.gz
     
    28132756    [ "`du -sm $imagesdir/all.tar.gz | cut -f1`" -ge "30" ] && Die "You have too many tools in your shed"
    28142757    cd $old_pwd
    2815     rm -Rf $minidir_root
     2758    [ "$minidir_root" != "" ] && rm -Rf $minidir_root
    28162759    echo -e "$DONE"
    28172760}
     
    28212764#----------------------------------- Main -----------------------------------#
    28222765##############################################################################
     2766
     2767# Now we can create what we nedd
     2768mkdir -p $MINDI_TMP
     2769
     2770# Purge from potential old run
     2771if [ _"$MINDI_CACHE" = _"" ]; then
     2772    Die "MINDI_CACHE undefined"
     2773fi
     2774rm -rf $MINDI_CACHE 2> /dev/null
     2775mkdir -p $MINDI_CACHE
    28232776
    28242777
     
    28372790echo "$@" >> $LOGFILE
    28382791echo "Start date : `date`" >> $LOGFILE
     2792echo "-----------------------------" >> $LOGFILE
    28392793
    28402794if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then
     
    28462800# Log some capital variables
    28472801[ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     2802echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
    28482803echo "MINDI_LIB = $MINDI_LIB" >> $LOGFILE
    28492804echo "MINDI_SBIN = $MINDI_SBIN" >> $LOGFILE
    28502805[ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
    28512806echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    2852 echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE
     2807if [ -f $MINDI_CONF ]; then
     2808    echo "-----------------------------" >> $LOGFILE
     2809    echo " Mindi configuration file    " >> $LOGFILE
     2810    echo "-----------------------------" >> $LOGFILE
     2811    cat $MINDI_CONF >> $LOGFILE
     2812    echo "-----------------------------" >> $LOGFILE
     2813fi
     2814
    28532815
    28542816trap AbortHere SIGTERM SIGHUP SIGQUIT SIGKILL SIGABRT SIGINT
     
    29222884BIGNO=0
    29232885MAX_COMPRESSED_SIZE="$mindi_max_compressed_size"
     2886
     2887#
     2888# Kernel management: Attempt to locate kernel specific module path
     2889# if module path is found then use it other wise use uname -r to set it...
     2890#
     2891#
    29242892kernelpath="$mindi_kernel"
    29252893if [ "$kernelpath" = "NATIVE" ]; then
    29262894    kernelpath=""
    29272895fi
    2928 if [ "$ARCH" = "ia64" ] ; then
    2929     USE_LILO=yes
     2896if [ "$kernelpath" = "" ]; then
     2897    kernelpath=`TryToFindKernelPath`
     2898fi
     2899kernelname=`echo $kernelpath | cut -d'-' -f2-`
     2900LogIt "kernelname = $kernelname"
     2901LogIt "kernelpath = $kernelpath"
     2902if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ]
     2903then
     2904   LogIt "Module path for ${kernelpath} not found..."
     2905   LogIt "using running kernel\'s modules."
     2906   kernelname=`uname -r`
    29302907else
    2931     USE_LILO=no
     2908   LogIt "Using modules for kernel: ${kernelname}"
    29322909fi
    29332910
     
    29732950    if [ "$1" = "--usb" ] ; then
    29742951        shift
    2975         USBDEV=$1
    2976         if [ _"$USBDEV" = _"" ]; then
     2952        USBDEVICE=$1
     2953        if [ _"$USBDEVICE" = _"" ]; then
    29772954            Die "No USB device specified"
    29782955        fi
    29792956        shift
    29802957    fi
     2958fi
     2959
     2960#
     2961# Default value for parameters coming from mondo potentially
     2962#
     2963if [ "$ARCH" = "ia64" ] ; then
     2964    USE_LILO=yes
     2965else
     2966    USE_LILO=no
     2967fi
     2968
     2969#
     2970# These variables are normaly only significant in a mondo environment
     2971# Not enforced yet
     2972#
     2973CDRECOVERY="no"
     2974NOT_BOOT="no"
     2975EXCLUDE_DEVS=""
     2976IMAGE_DEVS=""
     2977NFS_DEV=""
     2978if [ _"$MONDO_SHARE" != _"" ]; then
    29812979fi
    29822980
     
    30002998        echo "Mindi v$MINDI_VERSION"
    30012999        MindiExit 0
    3002     elif [ "$#" -ge "9" ] && [ "$1" = "--custom" ] ; then
     3000    elif [ "$1" = "--custom" ] ; then
    30033001        if [ _"$MONDO_SHARE" = _"" ]; then
    30043002            Die "--custom is reserved for mondoarchive calls"
     
    30123010        mkdir -p $MINDI_TMP
    30133011        # 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`
     3012        MINDI_CACHE=$3
     3013        if [ _"$MINDI_CACHE" != _"" ]; then
     3014            mkdir -p $MINDI_CACHE
     3015        fi
     3016
     3017        if [ ! -e "$MONDORESTORECFG" ]; then
     3018            Die "MONDORESTORECFG undefined. Use an uptodate mondoarchive version"
     3019        fi
     3020
     3021        if [ ! -e "$MONDO_CACHE" ]; then
     3022            Die "MONDO_CACHE undefined. Use an uptodate mondoarchive version"
    30343023        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
     3024            #
     3025            # Get from mondo our additional configuration
     3026            #
     3027            echo "Using $MONDO_CACHE/mindi.conf as additional config file"
     3028            if [ -f $MONDO_CACHE/mindi.conf ]; then
     3029                . $MONDO_CACHE/mindi.conf
     3030                echo "-----------------------------" >> $LOGFILE
     3031                echo " Mondo configuration file    " >> $LOGFILE
     3032                echo "-----------------------------" >> $LOGFILE
     3033                cat $MONDO_CACHE/mindi.conf >> $LOGFILE
     3034                echo "-----------------------------" >> $LOGFILE
     3035            else
     3036                Die "No mindi.conf file created by mondo. Aborting"
     3037            fi
     3038        fi
     3039
     3040        echo "Here is your mondoresctore.cfg file:" >> $LOGFILE
     3041        echo "------------------------------------" >> $LOGFILE
     3042        cat $MONDORESTORECFG >> $LOGFILE
     3043        echo "-----------------------------------" >> $LOGFILE
     3044
     3045        CDRECOVERY=`grep use-cdrecovery $MONDORESTORECFG | cut -d' ' -f2`
     3046        NOT_BOOT=`grep non-bootable $MONDORESTORECFG | cut -d' ' -f2`
     3047        USE_LILO=`grep use-lilo $MONDORESTORECFG | cut -d' ' -f2`
     3048        EXCLUDE_DEVS=`grep excluded-devs $MONDORESTORECFG | cut -d' ' -f2`
     3049        NFS_DEV=`grep nfs-dev $MONDORESTORECFG | cut -d' ' -f2`
     3050        VALUE=`grep image-devs $MONDORESTORECFG | cut -d' ' -f2`
     3051        if [ "$VALUE" = "(null)" ] || [ "$VALUE" = "" ] ; then
    30433052            IMAGE_DEVS=""
    30443053        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/'`
     3054            IMAGE_DEVS="`echo "$VALUE" | tr '|' ' '`"
     3055        fi
     3056        [ "$CDRECOVERY" = "yes" ] && [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"
     3057        MONDO_ROOT=`echo $MINDI_CACHE | sed 's/\(.*\)\/.*/\1/'`
    30673058        if [ _"$MONDO_ROOT" != _"" ]; then
    30683059            mkdir -p $MONDO_ROOT
     
    31083099KERN_DISK_MADE=""
    31093100
    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
     3101if [ "$NOT_BOOT" = "yes" ]; then
     3102    LogIt "Just creating a small all.tar.gz for Mondo. Nothing else."
    31173103    mkdir -p $MINDI_TMP/small-all/tmp
     3104    MakeMountlist $MINDI_TMP/small-all/tmp/mountlist.txt
     3105    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"
    31183106    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
     3107    tar -cv tmp | gzip -9 > $MINDI_CACHE/all.tar.gz || Die "Cannot make small all.tar.gz"
     3108    sync
    31223109    LogIt "Done. Exiting."
    31233110    MindiExit 0
    31243111fi
    31253112
    3126 if [ _"$USBDEV" != _"" ]; then
    3127     LogIt "Including the generation of a Bootable USB device on $USBDEV"
     3113if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3114    LogIt "Including the generation of a Bootable USB device on $USBDEVICE"
    31283115fi
    31293116if [ "$kernelpath" = "" ] ; then
     
    31843171    YOUR_KERNEL_SUCKS="Your kernel sucks"
    31853172fi
    3186 echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$CACHE_LOC" >> $LOGFILE
     3173echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$MINDI_CACHE" >> $LOGFILE
    31873174[ "$(($RANDOM%64))" -eq "0" ] && LogIt "Dude, I've looked inside your computer and it's really dusty..."
    31883175
    31893176[ "$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."
    31903177
    3191 rm -f $CACHE_LOC/{*img,*gz,*iso}
    3192 
    3193 PrepareDataDiskImages $CACHE_LOC
     3178rm -f $MINDI_CACHE/{*img,*gz,*iso}
     3179
     3180PrepareDataDiskImages $MINDI_CACHE
    31943181noof_disks=$?
    31953182ramdisk_size=$(($size_of_all_tools+$EXTRA_SPACE))
     
    32003187if [ "$USE_LILO" = "yes" ] ; then
    32013188    if [ "$ARCH" = "ia64" ] ; then
    3202         PrepareBootDiskImage_LILO $CACHE_LOC $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
    3203     else
    3204         if ! PrepareBootDiskImage_LILO $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
     3189        PrepareBootDiskImage_LILO $MINDI_CACHE $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."
     3190    else
     3191        if ! PrepareBootDiskImage_LILO $MINDI_CACHE 1722 $kernelpath $ramdisk_size ; then
    32053192            LogIt "WARNING - failed to create 1.72MB boot image."
    32063193            LogIt "Please reduce your kernel's size if you want to make a 1.72MB floppy disk."
    32073194        fi
    3208         if ! PrepareBootDiskImage_LILO $CACHE_LOC 2880 $kernelpath $ramdisk_size ;  then
     3195        if ! PrepareBootDiskImage_LILO $MINDI_CACHE 2880 $kernelpath $ramdisk_size ;  then
    32093196            LogIt "WARNING - failed to create 2.88MB floppy disk image."
    32103197            LogIt "Please reduce your kernel's size if you want to make a 2.88MB floppy disk."
    3211             PrepareBootDiskImage_LILO $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
     3198            PrepareBootDiskImage_LILO $MINDI_CACHE 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."
    32123199        fi
    32133200    fi
    32143201else
    3215     if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then
     3202    if ! PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 1722 $kernelpath $ramdisk_size ; then
    32163203        LogIt "WARNING - failed to create 1.72MB boot image."
    32173204        LogIt "Please reduce your kernel's size if you want to make a 1.72MB floppy disk."
    3218         if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 2880 $kernelpath $ramdisk_size ; then
     3205        if ! PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 2880 $kernelpath $ramdisk_size ; then
    32193206            LogIt "WARNING - failed to create 2.88MB floppy disk image."
    32203207            LogIt "Please reduce your kernel's size if you want to make a 2.88MB floppy disk."
    3221             PrepareBootDiskImage_SYSLINUX $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
     3208            PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."
    32223209        fi
    32233210    fi
     
    32283215
    32293216if [ _"$MONDO_SHARE" = _"" ]; then
    3230     ListImagesForUser $CACHE_LOC
     3217    ListImagesForUser $MINDI_CACHE
    32313218    boot_dev=/dev/fd0u1722
    32323219    [ ! -e "$boot_dev" ] && mknod $boot_dev b 2 60
     
    32343221    [ ! -e "$boot_dev" ] && Die "Will you PLEASE tell your distribution maker to create the 1.72MB devices in /dev?"
    32353222    if [ "$PROMPT_WRITE_BOOT_FLOPPIES" = "yes" ]; then
    3236         OfferToCopyImagesToDisks $CACHE_LOC $boot_dev $FDDEVICE
    3237     fi
    3238     OfferToMakeBootableISO $CACHE_LOC
    3239     if [ _"$USBDEV" != _"" ] ; then
    3240         OfferToMakeBootableUSB $CACHE_LOC
     3223        OfferToCopyImagesToDisks $MINDI_CACHE $boot_dev $FDDEVICE
     3224    fi
     3225    OfferToMakeBootableISO $MINDI_CACHE
     3226    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3227        OfferToMakeBootableUSB $MINDI_CACHE
    32413228    fi
    32423229    LogIt "Finished."
    3243 elif [ "$TAPEDEV" ] ; then
    3244     rm -f $CACHE_LOC/{*img,*gz,*iso}
    3245     OfferToMakeBootableISO $CACHE_LOC
    3246     if [ -e "$CACHE_LOC/all.tar.gz" ] ; then
    3247         cp -f $CACHE_LOC/all.tar.gz $MINDI_TMP/ 2>> $LOGFILE
     3230elif [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] ; then
     3231    rm -f $MINDI_CACHE/{*img,*gz,*iso}
     3232    OfferToMakeBootableISO $MINDI_CACHE
     3233    if [ -e "$MINDI_CACHE/all.tar.gz" ] ; then
     3234        cp -f $MINDI_CACHE/all.tar.gz $MINDI_TMP/ 2>> $LOGFILE
    32483235    else
    32493236        Die "Cannot find all.tar.gz, to be written to tape"
    32503237    fi
    3251 elif [ _"$USBDEV" != _"" ] ; then
    3252     OfferToMakeBootableUSB $CACHE_LOC
     3238elif [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3239    OfferToMakeBootableUSB $MINDI_CACHE
    32533240else
    3254     OfferToMakeBootableISO $CACHE_LOC
     3241    OfferToMakeBootableISO $MINDI_CACHE
    32553242fi
    32563243# cleanup
  • branches/stable/mindi/rootfs/sbin/find-and-mount-cdrom

    r273 r1087  
    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"
  • branches/stable/mindi/rootfs/sbin/init

    r1061 r1087  
    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
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1080 r1087  
    2727
    2828#include "mr_mem.h"
     29#include "mr_str.h"
     30#include "mr_file.h"
     31
    2932#include <sys/sem.h>
    3033#include <sys/types.h>
     
    534537    char *tmp;
    535538    char *tmp1 = NULL;
    536     char *tmp2 = NULL;
    537539    char *scratchdir;
    538540    char *command;
    539     char *use_lzo_sz;
    540     char *use_gzip_sz;
    541     char *use_comp_sz;
    542     char *use_star_sz;
    543541    char *bootldr_str;
    544542    char *tape_device;
    545543    char *last_filelist_number;
    546     char *broken_bios_sz;
    547     char *cd_recovery_sz;
    548544    char *tape_size_sz;
    549545    char *devs_to_exclude;
    550     char *use_lilo_sz;
    551546    char *value;
    552547    char *bootdev;
    553 
    554 
    555548
    556549    /*@ char ************************************************************** */
     
    563556    int res = 0;
    564557    long estimated_total_noof_slices = 0;
     558
     559    FILE *fd = NULL;
    565560
    566561    assert(bkpinfo != NULL);
     
    568563    malloc_string(tmp);
    569564    malloc_string(scratchdir);
    570     malloc_string(use_lzo_sz);
    571     malloc_string(use_gzip_sz);
    572     malloc_string(use_star_sz);
    573     malloc_string(use_comp_sz);
    574565    malloc_string(bootldr_str);
    575     malloc_string(tape_device);
    576566    malloc_string(last_filelist_number);
    577     malloc_string(broken_bios_sz);
    578     malloc_string(cd_recovery_sz);
    579567    malloc_string(tape_size_sz);
    580568    malloc_string(devs_to_exclude);
    581     malloc_string(use_lilo_sz); /* BCO: shared between LILO/ELILO */
    582569    malloc_string(value);
    583570    malloc_string(bootdev);
     
    588575            bkpinfo->exclude_paths);
    589576    strcpy(devs_to_exclude, call_program_and_get_last_line_of_output(tmp));
    590     sprintf(tmp, "devs_to_exclude = '%s'", devs_to_exclude);
    591577    log_msg(2, tmp);
    592578    mvaddstr_and_log_it(g_currentY, 0,
     
    601587    }
    602588    lines_in_filelist = count_lines_in_file(tmp);
    603     sprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    604589    strcpy(last_filelist_number, last_line_of_file(tmp));
    605     if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    606         sprintf(tape_size_sz, "%ld", bkpinfo->media_size[1]);
    607         strcpy(tape_device, bkpinfo->media_device);
    608     } else {
    609         tape_size_sz[0] = '\0';
    610         tape_device[0] = '\0';
    611     }
    612     if (bkpinfo->use_lzo) {
    613         strcpy(use_lzo_sz, "yes");
    614     } else {
    615         strcpy(use_lzo_sz, "no");
    616     }
    617     if (bkpinfo->use_gzip) {
    618         strcpy(use_gzip_sz, "yes");
    619     } else {
    620         strcpy(use_gzip_sz, "no");
    621     }
    622     if (bkpinfo->use_star) {
    623         strcpy(use_star_sz, "yes");
    624     } else {
    625         strcpy(use_star_sz, "no");
    626     }
    627 
    628     if (bkpinfo->compression_level > 0) {
    629         strcpy(use_comp_sz, "yes");
    630     } else {
    631         strcpy(use_comp_sz, "no");
    632     }
    633 
    634     strcpy(broken_bios_sz, "yes");  /* assume so */
    635     if (g_cd_recovery) {
    636         strcpy(cd_recovery_sz, "yes");
    637     } else {
    638         strcpy(cd_recovery_sz, "no");
    639     }
    640     if (bkpinfo->make_cd_use_lilo) {
    641         strcpy(use_lilo_sz, "yes");
    642     } else {
    643         strcpy(use_lilo_sz, "no");
    644     }
    645590
    646591    if (!bkpinfo->nonbootable_backup
     
    758703            bootldr_str, bkpinfo->boot_device);
    759704    log_to_screen(tmp);
    760     sprintf(tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
    761     if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) {
    762         log_msg(1, "%ld: Unable to write one-liner boot device", __LINE__);
    763     }
    764     switch (bkpinfo->backup_media_type) {
    765     case cdr:
    766         strcpy(value, "cdr");
    767         break;
    768     case cdrw:
    769         strcpy(value, "cdrw");
    770         break;
    771     case cdstream:
    772         strcpy(value, "cdstream");
    773         break;
    774     case tape:
    775         strcpy(value, "tape");
    776         break;
    777     case udev:
    778         strcpy(value, "udev");
    779         break;
    780     case iso:
    781         strcpy(value, "iso");
    782         break;
    783     case nfs:
    784         strcpy(value, "nfs");
    785         break;
    786     case dvd:
    787         strcpy(value, "dvd");
    788         break;
    789     case usb:
    790         strcpy(value, "usb");
    791         break;
    792     default:
    793         fatal_error("Unknown backup_media_type");
    794     }
    795     sprintf(tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
    796     if (write_one_liner_data_file(tmp, value)) {
    797         res++;
    798         log_msg(1, "%ld: Unable to write one-liner backup-media-type",
    799                 __LINE__);
    800     }
    801     log_to_screen(bkpinfo->tmpdir);
    802     sprintf(tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
    803     if (write_one_liner_data_file(tmp, bootldr_str)) {
    804         res++;
    805         log_msg(1, "%ld: Unable to write one-liner bootloader.name",
    806                 __LINE__);
    807     }
    808     sprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
    809     if (bkpinfo->differential) {
    810         res += write_one_liner_data_file(tmp, "1");
    811     } else {
    812         res += write_one_liner_data_file(tmp, "0");
    813     }
    814 
    815     if (g_getfattr) {
    816         mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
    817         if (write_one_liner_data_file(tmp1, "TRUE")) {
    818             log_msg(1, "%ld: Unable to write one-liner XATTR",
    819                 __LINE__);
    820         }
    821         mr_free(tmp1);
    822     }
    823     if (g_getfacl) {
    824         mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
    825         if (write_one_liner_data_file(tmp1, "TRUE")) {
    826             log_msg(1, "%ld: Unable to write one-liner ACL",
    827                 __LINE__);
    828         }
    829         mr_free(tmp1);
    830     }
    831705
    832706    estimated_total_noof_slices =
     
    843717        log_OS_error("Unable to make mnt floppy directory");
    844718    }
    845     sprintf(tmp, "BTW, I'm telling Mindi your kernel is '%s'",
    846             bkpinfo->kernel_path);
    847 
    848     log_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
     719
     720    /* Prepare interface with mindi through a configuration file
     721     * under /var/cache/mondo by default
     722     * and the mondorestore configuration file at the same time that
     723     * will be included by mindi on the initrd */
     724
     725    fd = mr_fopen(MONDO_CACHE"/mindi.conf", "w");
     726    fd1 = mr_fopen(MONDORESTORECFG, "a");
     727
     728    mr_fprintf(fd, "mindi_kernel=%s\n", bkpinfo->kernel_path);
     729    mr_fprintf(fd, "mindi_use_own_kernel=yes\n");
     730
     731    mr_fprintf(fd1, "files-in-filelist %ld\n", lines_in_filelist);
     732    mr_fprintf(fd1, "internal-tape-block-size %ld\n", bkpinfo->internal_tape_block_size);
     733    mr_fprintf(fd1, "total-slices %ld\n", estimated_total_noof_slices);
     734    mr_fprintf(fd1, "excluded-devs %s\n", devs_to_exclude);
     735    mr_fprintf(fd1, "image-devs %s\n", bkpinfo->image_devs);
     736    mr_fprintf(fd1, "last-filelist-number %s\n", last_filelist_number);
     737    mr_fprintf(fd1, "bootloader.name %s\n", bootldr_str);
     738    mr_fprintf(fd1, "bootloader.device %s\n", bkpinfo->boot_device);
     739
     740    switch (bkpinfo->backup_media_type) {
     741    case cdr:
     742        mr_fprintf(fd1, "backup-media-type cdr\n");
     743        break;
     744    case cdrw:
     745        mr_fprintf(fd1, "backup-media-type cdrw\n");
     746        break;
     747    case cdstream:
     748        mr_fprintf(fd1, "backup-media-type cdstream\n");
     749        break;
     750    case tape:
     751        mr_fprintf(fd1, "backup-media-type tape\n");
     752        break;
     753    case udev:
     754        mr_fprintf(fd1, "backup-media-type udev\n");
     755        break;
     756    case iso:
     757        mr_fprintf(fd1, "backup-media-type iso\n");
     758        break;
     759    case nfs:
     760        mr_fprintf(fd1, "backup-media-type nfs\n");
     761        break;
     762    case dvd:
     763        mr_fprintf(fd1, "backup-media-type dvd\n");
     764        break;
     765    case usb:
     766        mr_fprintf(fd1, "backup-media-type usb\n");
     767        break;
     768    default:
     769        fatal_error("Unknown backup_media_type");
     770    }
    849771
    850772    if (bkpinfo->backup_media_type == usb) {
    851         mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
     773        mr_fprintf(fd, "mindi_write_usb=yes\n");
     774        mr_fprintf(fd, "mindi_usb_device=%s\n", bkpinfo->media_device);
     775    }
     776    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     777        mr_fprintf(fd, "mindi_write_tape=yes\n");
     778        mr_fprintf(fd, "mindi_tape_device=%s\n", bkpinfo->media_device);
     779        mr_fprintf(fd1, "media-dev %s\n", bkpinfo->media_device);
     780        mr_fprintf(fd1, "media-size %ld\n", bkpinfo->media_size[1]);
     781    }
     782    if (bkpinfo->compression_level > 0) {
     783        mr_fprintf(fd1, "use-comp yes\n");
    852784    } else {
    853         mr_asprintf(&tmp2,"");
    854     }
     785        mr_fprintf(fd1, "use-comp no\n");
     786    }
     787    if (bkpinfo->use_gzip) {
     788        mr_fprintf(fd1, "use-gzip yes\n");
     789    } else {
     790        mr_fprintf(fd1, "use-gzip no\n");
     791    }
     792    if (bkpinfo->use_lzo) {
     793        mr_fprintf(fd1, "use-lzo yes\n");
     794    } else {
     795        mr_fprintf(fd1, "use-lzo no\n");
     796    }
     797    if (bkpinfo->use_star) {
     798        mr_fprintf(fd1, "use-star yes\n");
     799    } else {
     800        mr_fprintf(fd1, "use-star no\n");
     801    }
     802    if (g_getfattr) {
     803        mr_fprintf(fd1, "xattr yes\n");
     804    } else {
     805        mr_fprintf(fd1, "xattr no\n");
     806    }
     807    if (g_getfacl) {
     808        mr_fprintf(fd1, "acl yes\n");
     809    } else {
     810        mr_fprintf(fd1, "acl no\n");
     811    }
     812
     813    if (g_cd_recovery) {
     814        mr_fprintf(fd1, "use-cdrecovery yes\n");
     815    } else {
     816        mr_fprintf(fd1, "use-cdrecovery no\n");
     817    }
     818    if (bkpinfo->make_cd_use_lilo) {
     819        mr_fprintf(fd1, "use-lilo yes\n");
     820    } else {
     821        mr_fprintf(fd1, "use-lilo no\n");
     822    }
     823    if (bkpinfo->nonbootable_backup) {
     824        mr_fprintf(fd1, "non-bootable yes\n");
     825    } else {
     826        mr_fprintf(fd1, "non-bootable no\n");
     827    }
     828    if (bkpinfo->differential) {
     829        mr_fprintf(fd1, "differential 1\n");
     830    } else {
     831        mr_fprintf(fd1, "differential 0\n");
     832    }
     833
     834    mr_fclose(fd);
     835    mr_fprintf(fd1, "datestamp %s\n", mr_date());
     836    mr_fclose(fd1);
    855837
    856838    sprintf(command,
    857 /*     "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \
    858 6=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \
    859 11=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
    860             "mindi %s --custom '%s' '%s/images' '%s' '%s' \
    861 '%s' %ld '%s' '%s' '%s' \
    862 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'",
    863             tmp2,
     839            "mindi --custom '%s' '%s/images'",
    864840            bkpinfo->tmpdir,        // parameter #2
    865841            bkpinfo->scratchdir,    // parameter #3
    866             bkpinfo->kernel_path,   // parameter #4
    867             tape_device,            // parameter #5
    868             tape_size_sz,           // parameter #6
    869             lines_in_filelist,      // parameter #7 (INT)
    870             use_lzo_sz,             // parameter #8
    871             cd_recovery_sz,         // parameter #9
    872             bkpinfo->image_devs,    // parameter #10
    873             broken_bios_sz,         // parameter #11
    874             last_filelist_number,   // parameter #12 (STRING)
    875             estimated_total_noof_slices,    // parameter #13 (INT)
    876             devs_to_exclude,        // parameter #14
    877             use_comp_sz,            // parameter #15
    878             use_lilo_sz,            // parameter #16
    879             use_star_sz,            // parameter #17
    880             bkpinfo->internal_tape_block_size,  // parameter #18 (LONG)
    881             bkpinfo->differential,  // parameter #19 (INT)
    882             use_gzip_sz);           // parameter #20 (STRING)
    883 
    884     mr_free(tmp2);
    885 
    886 // Watch it! This next line adds a parameter...
    887     if (bkpinfo->nonbootable_backup) {
    888         strcat(command, " NONBOOTABLE"); // parameter #21 (STRING)
    889     }
     842            //bkpinfo->kernel_path, // parameter #4
     843            //tape_device,          // parameter #5
     844            //tape_size_sz,         // parameter #6
     845            //lines_in_filelist,        // parameter #7 (INT)
     846            //use_lzo_sz,               // parameter #8
     847            //cd_recovery_sz,           // parameter #9
     848            //bkpinfo->image_devs,  // parameter #10
     849            //broken_bios_sz,           // parameter #11 always yes
     850            //last_filelist_number, // parameter #12 (STRING)
     851            //estimated_total_noof_slices,  // parameter #13 (INT)
     852            //devs_to_exclude,      // parameter #14
     853            //use_comp_sz,          // parameter #15
     854            //use_lilo_sz,          // parameter #16
     855            //use_star_sz,          // parameter #17
     856            //bkpinfo->internal_tape_block_size,    // parameter #18 (LONG)
     857            //bkpinfo->differential,    // parameter #19 (INT)
     858            //use_gzip_sz);         // parameter #20 (STRING)
     859            );
     860
    890861    log_msg(2, command);
    891862
    892 //  popup_and_OK("Pausing");
    893 
    894     res =
    895         run_program_and_log_to_screen(command,
    896                                       "Generating boot+data disks");
     863    res = run_program_and_log_to_screen(command, "Generating boot+data disks");
    897864    if (bkpinfo->nonbootable_backup) {
    898865        res = 0;
     
    936903    }
    937904    mr_free(tmp);
    938     mr_free(use_lzo_sz);
    939     mr_free(use_gzip_sz);
    940905    mr_free(scratchdir);
    941     mr_free(use_comp_sz);
    942906    mr_free(bootldr_str);
    943     mr_free(tape_device);
    944907    mr_free(last_filelist_number);
    945     mr_free(broken_bios_sz);
    946908    mr_free(cd_recovery_sz);
    947909    mr_free(tape_size_sz);
    948910    mr_free(devs_to_exclude);
    949     mr_free(use_lilo_sz);
    950911    mr_free(value);
    951912    mr_free(bootdev);
    952913    mr_free(command);
    953     mr_free(use_star_sz);
    954914    return (res);
    955915}
     
    11621122        closeout_tape(bkpinfo);
    11631123    } else
    1164         /* write final ISO */
     1124        /* write final ISO/USB */
    11651125    {
    11661126        res = write_final_iso_if_necessary(bkpinfo);
     
    18921852        if (bkpinfo->nonbootable_backup) {
    18931853            log_msg(1, "Making nonbootable backup");
    1894 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end
    18951854            res =
    18961855                eval_call_to_make_ISO(bkpinfo,
     
    36583617        bkpinfo->media_size[g_current_media_number]) {
    36593618        sprintf(tmp,
    3660                 "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
     3619                "Warning! %s is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
     3620                media_descriptor_string(bkpinfo->backup_media_type),
    36613621                (long) space_occupied_by_cd(bkpinfo->scratchdir),
    36623622                (long) bkpinfo->media_size[g_current_media_number]);
    36633623        log_to_screen(tmp);
    36643624    }
    3665     sprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
     3625    if (bkpinfo->backup_media_type != usb) {
     3626        sprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    36663627            bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    36673628            g_current_media_number);
     3629    } else {
     3630    }
    36683631    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    3669         res = make_iso_fs(bkpinfo, isofile);
     3632        if (bkpinfo->backup_media_type != usb) {
     3633            res = make_iso_fs(bkpinfo, isofile);
     3634        } else {
     3635        }
    36703636        if (g_current_media_number == 1 && !res
    36713637            && (bkpinfo->backup_media_type == cdr
     
    39683934
    39693935setenv("MONDO_SHARE", MONDO_SHARE, 1);
     3936setenv("MONDORESTORECFG", MONDORESTORECFG, 1);
     3937setenv("MONDO_CACHE", MONDO_CACHE, 1);
    39703938}
  • branches/stable/mondo/src/common/libmondo-files.c

    r1080 r1087  
    2020#include "libmondo-fork-EXT.h"
    2121#include "libmondo-string-EXT.h"
     22
     23#include "mr_file.h"
    2224
    2325/*@unused@*/
     
    11571159    char command[MAX_STR_LEN * 2];
    11581160
     1161    FILE *fd1 = NULL;
     1162
    11591163    /*@ pointers ***** */
    11601164    char *p;
     
    12181222    }
    12191223
    1220     sprintf(tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
    1221     write_one_liner_data_file(tmp, nfs_dev);
    1222 
    1223     sprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    1224     write_one_liner_data_file(tmp, nfs_client_ipaddr);
    1225     sprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    1226     write_one_liner_data_file(tmp, nfs_client_netmask);
    1227     sprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    1228     write_one_liner_data_file(tmp, nfs_client_broadcast);
    1229     sprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    1230     write_one_liner_data_file(tmp, nfs_client_defgw);
    1231     sprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    1232     write_one_liner_data_file(tmp, nfs_server_ipaddr);
    1233     sprintf(tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
    1234     write_one_liner_data_file(tmp, bkpinfo->nfs_mount);
    1235     sprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    1236     write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir);
    1237     sprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    1238     write_one_liner_data_file(tmp, bkpinfo->prefix);
     1224    fd1 = mr_fopen(MONDORESTORECFG, "a");
     1225
     1226    mr_fprintf(fd1, "nfs-dev %s\n", nfs_dev);
     1227    mr_fprintf(fd1, "nfs-client-ipaddr %s\n", nfs_client_ipaddr);
     1228    mr_fprintf(fd1, "nfs-client-netmask %s\n", nfs_client_netmask);
     1229    mr_fprintf(fd1, "nfs-client-broadcast %s\n", nfs_client_broadcast);
     1230    mr_fprintf(fd1, "nfs-client-defgw %s\n", nfs_client_defgw);
     1231    mr_fprintf(fd1, "nfs-server-ipaddr %s\n", nfs_server_ipaddr);
     1232    mr_fprintf(fd1, "nfs-server-mount %s\n", bkpinfo->nfs_mount);
     1233    mr_fprintf(fd1, "nfs-server-path %s\n", bkpinfo->nfs_remote_dir);
     1234    mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix);
     1235    mr_flcose(fd1);
     1236
    12391237    log_it("Finished storing NFS configuration");
    12401238}
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1080 r1087  
    1111#include "my-stuff.h"
    1212#include "mr_mem.h"
     13#include "mr_file.h"
    1314#include "mondostructures.h"
    1415#include "lib-common-externs.h"
     
    409410    char *iso_tmp;
    410411    char *iso_path;
     412    FILE *fd1 = NULL;
    411413
    412414    assert(bkpinfo != NULL);
     
    643645                bkpinfo->isodir);
    644646        log_it("command = %s", command);
    645         log_it("res of it = %s",
    646                call_program_and_get_last_line_of_output(command));
    647647        sprintf(iso_dev, "%s",
    648648                call_program_and_get_last_line_of_output(command));
    649         sprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
    650         write_one_liner_data_file(tmp,
    651                                   call_program_and_get_last_line_of_output
    652                                   (command));
     649        log_it("res of it = %s", iso_dev);
     650
     651        fd1 = mr_fopen(MONDORESTORECFG, "a");
     652        mr_fprintf(fd1, "iso-dev %s\n", iso_dev);
    653653
    654654        sprintf(command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3",
    655655                iso_dev);
    656656        log_it("command = %s", command);
    657         log_it("res of it = %s",
    658                call_program_and_get_last_line_of_output(command));
    659657        sprintf(iso_mnt, "%s",
    660658                call_program_and_get_last_line_of_output(command));
    661         sprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
    662         write_one_liner_data_file(tmp,
    663                                   call_program_and_get_last_line_of_output
    664                                   (command));
     659
     660        log_it("res of it = %s", iso_mnt);
     661        mr_fprintf(fd1, "iso-mnt %s\n", iso_mnt);
    665662        log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt));
     663
    666664        sprintf(iso_tmp, "%s", bkpinfo->isodir);
    667665        if (strlen(iso_tmp) < strlen(iso_mnt)) {
     
    670668            sprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt));
    671669        }
    672         sprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir);
    673         write_one_liner_data_file(tmp, iso_path);
    674670        log_it("isodir: %s", iso_path);
    675         sprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    676         write_one_liner_data_file(tmp, bkpinfo->prefix);
     671        mr_fprintf(fd1, "isodir %s\n", iso_path);
     672
    677673        log_it("iso-prefix: %s",  bkpinfo->prefix);
    678 
    679 /* End patch */
     674        mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix);
     675
     676        mr_flcose(fd1);
    680677    }                           // end of iso code
    681678
  • branches/stable/mondo/src/include/mr_str.h

    r1064 r1087  
    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 */
  • branches/stable/mondo/src/include/my-stuff.h

    r1080 r1087  
    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/**
  • branches/stable/mondo/src/lib/Makefile.am

    r1054 r1087  
    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
  • branches/stable/mondo/src/lib/mr_str.c

    r1054 r1087  
    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
  • branches/stable/mondo/src/mondoarchive/main.c

    r1080 r1087  
    1919#include "../common/libmondo.h"
    2020#include "mondo-cli-EXT.h"
     21
     22#include "mr_str.h"
    2123
    2224// for CVS
     
    139141}
    140142
    141 /* Return a string containing the date */
    142 char *mr_date(void) {
    143    
    144     time_t tcurr;
    145 
    146     tcurr = time(NULL);
    147     return(ctime(&tcurr));
    148 }
    149 
    150143/*-----------------------------------------------------------*/
    151144
  • branches/stable/mondo/src/mondorestore/mondo-rstr-newt.c

    r1080 r1087  
    55#include "mr_mem.h"
    66
     7extern char *g_mondo_cfg_file;  // where m*ndo-restore.cfg (the config file) is stored
    78
    89/**
     
    22652266                char *isodir_path, bool nuke_me_please)
    22662267{
     2268    char *value = NULL;
    22672269
    22682270    /** initialize ********************************************************/
     2271    malloc_string(value);
    22692272
    22702273    assert(isodir_device != NULL);
     
    22722275    assert(isodir_path != NULL);
    22732276
    2274     log_it("%d - AAA - isodir_path = %s", isodir_path);
     2277    log_it("%d - AAA - isodir_path = %s", __LINE__, isodir_path);
    22752278    isodir_format[0] = '\0';
    22762279    if (isodir_device[0] == '\0') {
     
    22802283        strcpy(isodir_path, "/");
    22812284    }
    2282     if (does_file_exist("/tmp/NFS-SERVER-PATH")) {
    2283         strcpy(isodir_device, last_line_of_file("/tmp/NFS-SERVER-MOUNT"));
     2285    if (read_cfg_var(g_mondo_cfg_file, "nfs-server-path", value) == 0) {
     2286        read_cfg_var(g_mondo_cfg_file, "nfs-server-mount", isodir_device);
    22842287        strcpy(isodir_format, "nfs");
    2285         strcpy(isodir_path, last_line_of_file("/tmp/NFS-SERVER-PATH"));
    2286     }
     2288        strcpy(isodir_path, value);
     2289    }
     2290    mr_free(value);
     2291
    22872292    if (nuke_me_please) {
    22882293        return (TRUE);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1080 r1087  
    978978
    979979    read_cfg_var(cfg_file, "acl", value);
    980     if (strstr(value, "TRUE")) {
     980    if (strstr(value, "yes")) {
    981981        mr_asprintf(&g_getfacl,"setfacl");
    982982        log_msg(1, "We will restore ACLs");
     
    986986    }
    987987    read_cfg_var(cfg_file, "xattr", value);
    988     if (strstr(value, "TRUE")) {
     988    if (strstr(value, "yes")) {
    989989        mr_asprintf(&g_getfattr,"setfattr");
    990990        log_msg(1, "We will restore XATTRs");
Note: See TracChangeset for help on using the changeset viewer.