Changeset 1106 in MondoRescue
- Timestamp:
- Feb 7, 2007, 11:55:11 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 36 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/mindi/distributions/conf/mindi.conf.dist
r1079 r1106 4 4 # 5 5 # 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. 8 10 9 11 # … … 48 50 49 51 # 52 # Write mindi Tape (yes|no) ? 53 # 54 mindi_write_tape="no" 55 56 # 50 57 # If set to "no", you will be prompted for whether or not 51 58 # you want to use your own kernel, or the supplied default. … … 57 64 # Images creation dir 58 65 # 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 59 68 # 60 mindi_ images_dir="/var/cache/mindi"69 mindi_cache_dir="/var/cache/mindi" 61 70 62 71 # 63 72 # 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 64 75 # 65 76 mindi_tmp_dir="/tmp" … … 69 80 # 70 81 mindi_fd_device="/dev/fd0" 82 83 # 84 # USB Disk Device 85 # 86 mindi_usb_device="/dev/sda1" 87 88 # 89 # Tape Device 90 # 91 mindi_tape_device="/dev/st0" 71 92 72 93 # -
trunk/mindi/install.sh
r1081 r1106 140 140 install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR 141 141 142 if [ "_$PREFIX" = "_" &&! -f $locallib/mindi/rootfs/bin/busybox ]; then142 if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then 143 143 echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)" 144 144 fi -
trunk/mindi/mindi
r1085 r1106 48 48 49 49 MINDI_CONFIG="$MINDI_CONF/mindi.conf" 50 if [ ! -f $MINDI_CONFIG ] ; then50 if [ ! -f $MINDI_CONFIG ] && [ "_$1" = "_" ]; then 51 51 echo "No $MINDI_CONFIG file found using sensible values" 52 52 else 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 54 56 . $MINDI_CONFIG 55 57 fi … … 87 89 PROMPT_MAKE_CD_IMAGE="$mindi_write_cd" 88 90 PROMPT_MAKE_USB_IMAGE="$mindi_write_usb" 91 PROMPT_MAKE_TAPE_IMAGE="$mindi_write_tape" 89 92 USE_OWN_KERNEL="$mindi_use_own_kernel" 90 CACHE_LOC="$mindi_images_dir"93 MINDI_CACHE="$mindi_cache_dir" 91 94 FORCE_DUAL_FLOPPIES="$mindi_dual_floppies" 92 95 TMPDIR="$mindi_tmp_dir" 93 96 FDDEVICE="$mindi_fd_device" 97 USBDEVICE="$mindi_usb_device" 98 TAPEDEV="$mindi_tape_device" 94 99 ADDITIONAL_BOOT_PARAMS="$mindi_boot_params" 95 100 MY_FSTAB="$mindi_etc_fstab" … … 107 112 BOOT_MEDIA_MESSAGE="$mindi_boot_msg" 108 113 FDISK=$MINDI_SBIN/parted2fdisk 109 110 # Now we can create what we nedd111 114 MINDI_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 117 116 # ---------------------------------------------------------------------------- 118 117 … … 143 142 Aborted() { 144 143 trap SIGHUP SIGTERM SIGTRAP SIGINT 145 [ "$ CACHE_LOC" != "" ] && rm -f $CACHE_LOC/mindi*img $CACHE_LOC/*gz $CACHE_LOC/mindi.iso144 [ "$MINDI_CACHE" != "" ] && rm -f $MINDI_CACHE/mindi*img $MINDI_CACHE/*gz $MINDI_CACHE/mindi.iso 146 145 [ "$minidir_root" != "" ] && rm -Rf $minidir_root/* 147 146 Die "User abort." 148 }149 150 151 AddFileToCfgIfExists() {152 [ -e "$1" ] && echo -en "$2 `cat $1`\n" >> $3153 147 } 154 148 … … 415 409 if [ "$?" -ne "0" ] ; then 416 410 umount $mountpoint 411 rmdir $mountpoint 417 412 Die "Tarball $tarball is too big for disk! (CODI)\nAdjust mindi_max_compressed_size in your $MINDI_CONFIG" 418 413 fi … … 522 517 echo -en "Adding the following keyboard mapping tables: " 523 518 mkdir -p $bigdir/tmp 524 echo " /etc/console/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE519 echo "keymap-lives-here /etc/console/boottime.kmap.gz" > $MINDI_TMP/mondo-restore.cfg 525 520 KBDEPTH=0 526 521 mkdir -p $bigdir/etc/console … … 573 568 echo -en "Adding the following keyboard mapping tables: " 574 569 mkdir -p $bigdir/tmp 575 echo " $mappath" > $bigdir/tmp/KEYMAP-LIVES-HERE570 echo "keymap-lives-here $mappath" > $MINDI_TMP/mondo-restore.cfg 576 571 KBDEPTH=0 577 572 AddKeyboardMappingFile $mappath … … 787 782 Die "Odd." 788 783 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" ] ; then791 LogIt "Incorporating NFS-related settings"792 for r in NFS-* ISO-PREFIX ; do793 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" >> $LOGFILE795 done796 fi797 784 fi 798 785 tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile … … 838 825 } 839 826 827 828 # Check kernel filesystem capabilites for accessing initrd image 829 # 830 # Interface definition: 831 # param #1: absolute path to kernel image 832 GetInitrdFilesystemToUse() { 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 } 840 885 841 886 # Searches parent raid device of given disk device … … 1005 1050 1006 1051 1007 # Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg1008 MakeMondoConfigFile() {1009 local outfile use_lzo use_comp use_star1010 outfile=$11011 > $outfile1012 [ "$TAPESIZE" ] && echo "media-size $TAPESIZE" >> $outfile1013 [ "$TAPEDEV" ] && echo "media-dev $TAPEDEV" >> $outfile1014 [ "$FILES_IN_FILELIST" ] && echo "files-in-filelist $FILES_IN_FILELIST" >> $outfile1015 [ "$LAST_FILELIST_NUMBER" ] && echo "last-filelist-number $LAST_FILELIST_NUMBER" >> $outfile1016 [ "$INTERNAL_TAPE_BLOCK_SIZE" ] && echo "internal-tape-block-size $INTERNAL_TAPE_BLOCK_SIZE" >> $outfile1017 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" >> $outfile1022 echo "use-gzip $use_gzip" >> $outfile1023 echo "use-star $use_star" >> $outfile1024 echo "use-comp $use_comp" >> $outfile1025 echo "datestamp `date`" >> $outfile1026 [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile1027 AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile1028 AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile1029 AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile1030 AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-DEFGW nfs-client-defgw $outfile1031 AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-MOUNT nfs-server-mount $outfile1032 AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-PATH nfs-server-path $outfile1033 AddFileToCfgIfExists $MINDI_TMP/NFS-DEV nfs-dev $outfile1034 AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile1035 AddFileToCfgIfExists $MINDI_TMP/ISO-DEV iso-dev $outfile1036 AddFileToCfgIfExists $MINDI_TMP/ISO-MNT iso-mnt $outfile1037 AddFileToCfgIfExists $MINDI_TMP/ISO-PREFIX iso-prefix $outfile1038 AddFileToCfgIfExists $MINDI_TMP/ISODIR isodir $outfile1039 AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.DEVICE bootloader.device $outfile1040 AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.NAME bootloader.name $outfile1041 AddFileToCfgIfExists $MINDI_TMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile1042 AddFileToCfgIfExists $MINDI_TMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile1043 AddFileToCfgIfExists $MINDI_TMP/BACKUP-MEDIA-TYPE backup-media-type $outfile1044 AddFileToCfgIfExists $MINDI_TMP/DIFFERENTIAL differential $outfile1045 AddFileToCfgIfExists $MINDI_TMP/ACL acl $outfile1046 AddFileToCfgIfExists $MINDI_TMP/XATTR xattr $outfile1047 }1048 1049 1050 1052 MakeModuleLoadingScript() { 1051 1053 local module fname params modpath kver outerloop i modpaths kver searchpath list_to_echo j … … 1132 1134 [ -e "$MY_FSTAB" ] || Die "Cannot find your fstab file ($MY_FSTAB)" 1133 1135 1134 rm -f $mountlist 1135 mkdir -p $mountlist 1136 rm -Rf $mountlist 1136 [ "$mountlist" != "" ] && rm -Rf $mountlist 1137 1137 > $mountlist 1138 1138 echo -en "\rHang on...\r" … … 1446 1446 rm -f $1.tmp 1447 1447 if [ "$CDRECOVERY" != "yes" ] ; then 1448 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then1448 if [ "$NFS_DEV" != "" ] ; then 1449 1449 echo -en "Press <enter> to continue.\n" >> $1 1450 1450 elif [ ! "$MINDI_TMP" ] ; then … … 1530 1530 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1531 1531 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" 1535 1534 fi 1536 1535 rm -Rf $MINDI_TMP/iso … … 1563 1562 cd $MINDI_TMP/iso/isolinux 1564 1563 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" ] ; then1564 if [ "$NFS_DEV" != "" ] ; then 1566 1565 perl -pi -e 's/interactive/iso/' isolinux.cfg 1567 1566 fi … … 1576 1575 cp -f $MONDO_SHARE/autorun . 2>> $LOGFILE 1577 1576 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.log1579 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.log1577 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 1581 1580 fi 1582 1581 if [ "$?" -ne "0" ] ; then … … 1587 1586 LogIt "Failed to create ISO image." 1588 1587 else 1589 echo "Created bootable ISO image at $ CACHE_LOC/mindi.iso" >> $LOGFILE1588 echo "Created bootable ISO image at $MINDI_CACHE/mindi.iso" >> $LOGFILE 1590 1589 fi 1591 1590 rm -f $MINDI_TMP/mkisofs.log … … 1598 1597 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1599 1598 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]) " 1601 1600 read i 1602 1601 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1603 1602 fi 1603 if [ _"$MINDI_TMP" = _"" ]; then 1604 Die "MINDI_TMP undefined" 1605 fi 1604 1606 rm -Rf $MINDI_TMP/usb 1605 1607 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 " 1609 1611 echo -en "." 1610 echo "Transforming $USBDEV in a Bootable device" >> $LOGFILE1611 echo "Checking $USBDEV " >> $LOGFILE1612 $FDISK -l $USBDEV 2>&1 >> $LOGFILE1612 echo "Transforming $USBDEVICE in a Bootable device" >> $LOGFILE 1613 echo "Checking $USBDEVICE" >> $LOGFILE 1614 $FDISK -l $USBDEVICE 2>&1 >> $LOGFILE 1613 1615 if [ $? -ne 0 ]; then 1614 echo "Unable to access $USBDEV " | tee -a $LOGFILE1616 echo "Unable to access $USBDEVICE" | tee -a $LOGFILE 1615 1617 echo "Make sure your USB device is pluged in" | tee -a $LOGFILE 1616 1618 MindiExit -1 1617 1619 fi 1618 1620 echo -en "." 1619 echo "Erasing $USBDEV " >> $LOGFILE1620 $FDISK $USBDEV 2>&1 >> $LOGFILE << EOF1621 echo "Erasing $USBDEVICE" >> $LOGFILE 1622 $FDISK $USBDEVICE 2>&1 >> $LOGFILE << EOF 1621 1623 d 1622 1624 d … … 1635 1637 EOF 1636 1638 if [ $? -ne 0 ]; then 1637 echo "Unable to create a vfat Filesystem on $USBDEV " | tee -a $LOGFILE1639 echo "Unable to create a vfat Filesystem on $USBDEVICE" | tee -a $LOGFILE 1638 1640 echo "Make sure your USB device is pluged in" | tee -a $LOGFILE 1639 $FDISK -l $USBDEV 2>&1 | tee -a $LOGFILE1641 $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE 1640 1642 MindiExit -1 1641 1643 fi … … 1646 1648 echo "Unable to create a vfat filesystem on $USBPART" | tee -a $LOGFILE 1647 1649 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 $LOGFILE1650 $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE 1649 1651 MindiExit -1 1650 1652 fi … … 1655 1657 echo "Unable to mount $USBPART on $MINDI_TMP/usb" | tee -a $LOGFILE 1656 1658 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 $LOGFILE1659 $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE 1658 1660 MindiExit -1 1659 1661 fi … … 1693 1695 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?" 1694 1696 echo -en "." 1695 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then1697 if [ "$NFS_DEV" != "" ] ; then 1696 1698 perl -pi -e 's/interactive/iso/' syslinux.cfg 1697 1699 fi … … 1717 1719 else 1718 1720 echo -e "$DONE" 1719 echo "Created bootable USB image on $USBDEV " >> $LOGFILE1721 echo "Created bootable USB image on $USBDEVICE" >> $LOGFILE 1720 1722 fi 1721 1723 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 1722 1735 } 1723 1736 … … 1739 1752 if [ _"$MONDO_SHARE" != _"" ]; then 1740 1753 if [ "$CDRECOVERY" != "yes" ] ; then 1741 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then1754 if [ "$NFS_DEV" != "" ] ; then 1742 1755 echo -en "Press <enter> to continue.\n" 1743 1756 elif [ ! "$MINDI_TMP" ] ; then … … 1834 1847 echo -en "default=RESTORE\n" 1835 1848 elif [ "$disksize" -gt "2880" ] && [ _"$MONDO_SHARE" != _"" ]; then 1836 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then1849 if [ "$NFS_DEV" != "" ] ; then 1837 1850 echo -en "default=iso\n" 1838 1851 else … … 1855 1868 elif [ "$disksize" -gt "2880" ] ; then 1856 1869 if [ _"$MONDO_SHARE" != _"" ]; then 1857 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then1870 if [ "$NFS_DEV" != "" ] ; then 1858 1871 options="iso" 1859 1872 else … … 1975 1988 1976 1989 # copy the kernel across 1977 rm -Rf $mountpoint/lost+found1990 [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found 1978 1991 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null 1979 1992 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4` … … 2011 2024 if [ "$disksize" -gt "2880" ] && [ ! "$KERN_DISK_MADE" ] ; then 2012 2025 if [ "$ARCH" != "ia64" ] ; then 2013 $LILO_EXE $LILO_OPTIONS-r $mountpoint >> $LOGFILE 2>> $LOGFILE2026 $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE 2014 2027 else 2015 2028 /bin/true … … 2096 2109 [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?" 2097 2110 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" ] ; then2111 if [ "$NFS_DEV" != "" ] ; then 2099 2112 perl -pi -e 's/interactive/iso/' syslinux.cfg 2100 2113 fi … … 2115 2128 2116 2129 # copy the kernel across 2117 rm -Rf $mountpoint/lost+found2130 [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found 2118 2131 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null 2119 2132 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4` … … 2226 2239 mkdir -p $bigdir/tmp 2227 2240 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 2230 2242 fi 2231 2243 [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO … … 2242 2254 2243 2255 # master boot record, too 2244 i=` cat $MINDI_TMP/BOOTLOADER.DEVICE2> /dev/null`2256 i=`grep bootloader.device $MONDORESTORECFG | cut -d' ' -f2 2> /dev/null` 2245 2257 if [ "$i" ] ; then 2246 2258 LogIt "Backing up $i's MBR" … … 2437 2449 bigdir=$1 2438 2450 minidir_root=$2 2439 rm -Rf $minidir_root/*2451 [ "$minidir_root" != "" ] && rm -Rf $minidir_root/* 2440 2452 2441 2453 TryToFitDataIntoSeveralDirs $bigdir $minidir_root … … 2446 2458 fi 2447 2459 RejigHyperlinks $minidir_root $noof_disks 2448 rm -Rf $bigdir/*2460 [ "$bigdir" != "" ] && rm -Rf $bigdir/* 2449 2461 return $noof_disks 2450 2462 } … … 2624 2636 cd $old_pwd 2625 2637 echo -en "\rThe files have been subdivided into $noof_disks directories. \r" 2626 rm -Rf $minidir_root/compressed2638 [ "$minidir_root" != "" ] && rm -Rf $minidir_root/compressed 2627 2639 if [ "$retval" -gt "0" ] ; then 2628 2640 return 0 … … 2716 2728 list_of_groovy_mods="$CDROM_MODS `WhichOfTheseModulesAreLoaded "$SCSI_MODS"`" 2717 2729 fi 2718 if [ -e "$MINDI_TMP/NFS-DEV" ] ; then2730 if [ "$NFS_DEV" != "" ] ; then 2719 2731 # For PXE boot 2720 2732 list_of_groovy_mods="$list_of_groovy_mods $NET_MODS" … … 2739 2751 fi 2740 2752 cd $old_pwd 2741 [ "$ TAPEDEV" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE2753 [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE 2742 2754 dd if=/dev/zero of=$mountpoint/zero &> /dev/null 2743 2755 rm -f $mountpoint/zero 2756 mkdir -p $mountpoint/tmp 2744 2757 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" 2747 2759 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 2756 2761 mkdir -p $mountpoint/proc 2757 2762 echo "$disksize" > $mountpoint/tmp/$disksize.siz 2758 2763 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 2763 2800 if [ "$res" -eq "0" ] ; then 2764 2801 echo -en "..." … … 2806 2843 done 2807 2844 mkdir -p $minidir_root/all/tmp 2808 echo -en "$FILES_IN_FILELIST" > $minidir_root/all/tmp/FILES-IN-FILELIST 2> /dev/null2809 echo -en "$LAST_FILELIST_NUMBER" > $minidir_root/all/tmp/LAST-FILELIST-NUMBER 2> /dev/null2810 2845 fi 2811 2846 tar -b 4096 -cf - * 2> /dev/null | gzip -9 > $tardir/all.tar.gz … … 2813 2848 [ "`du -sm $imagesdir/all.tar.gz | cut -f1`" -ge "30" ] && Die "You have too many tools in your shed" 2814 2849 cd $old_pwd 2815 rm -Rf $minidir_root2850 [ "$minidir_root" != "" ] && rm -Rf $minidir_root 2816 2851 echo -e "$DONE" 2817 2852 } … … 2821 2856 #----------------------------------- Main -----------------------------------# 2822 2857 ############################################################################## 2858 2859 # Now we can create what we nedd 2860 mkdir -p $MINDI_TMP 2861 2862 # Purge from potential old run 2863 if [ _"$MINDI_CACHE" = _"" ]; then 2864 Die "MINDI_CACHE undefined" 2865 fi 2866 rm -rf $MINDI_CACHE 2> /dev/null 2867 mkdir -p $MINDI_CACHE 2823 2868 2824 2869 … … 2837 2882 echo "$@" >> $LOGFILE 2838 2883 echo "Start date : `date`" >> $LOGFILE 2884 echo "-----------------------------" >> $LOGFILE 2839 2885 2840 2886 if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then … … 2846 2892 # Log some capital variables 2847 2893 [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly." 2894 echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE 2848 2895 echo "MINDI_LIB = $MINDI_LIB" >> $LOGFILE 2849 2896 echo "MINDI_SBIN = $MINDI_SBIN" >> $LOGFILE 2850 2897 [ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly." 2851 2898 echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE 2852 echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE 2899 if [ -f $MINDI_CONF ]; then 2900 echo "-----------------------------" >> $LOGFILE 2901 echo " Mindi configuration file " >> $LOGFILE 2902 echo "-----------------------------" >> $LOGFILE 2903 cat $MINDI_CONF >> $LOGFILE 2904 echo "-----------------------------" >> $LOGFILE 2905 fi 2906 2853 2907 2854 2908 trap AbortHere SIGTERM SIGHUP SIGQUIT SIGKILL SIGABRT SIGINT … … 2922 2976 BIGNO=0 2923 2977 MAX_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 # 2924 2984 kernelpath="$mindi_kernel" 2925 2985 if [ "$kernelpath" = "NATIVE" ]; then 2926 2986 kernelpath="" 2927 2987 fi 2928 if [ "$ARCH" = "ia64" ] ; then 2929 USE_LILO=yes 2988 if [ "$kernelpath" = "" ]; then 2989 kernelpath=`TryToFindKernelPath` 2990 fi 2991 kernelname=`echo $kernelpath | cut -d'-' -f2-` 2992 echo "kernelname = $kernelname" >> $LOGFILE 2993 echo "kernelpath = $kernelpath" >> $LOGFILE 2994 if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ] 2995 then 2996 echo "Module path for ${kernelpath} not found..." >> $LOGFILE 2997 echo "using running kernel\'s modules." >> $LOGFILE 2998 kernelname=`uname -r` 2930 2999 else 2931 USE_LILO=no 3000 echo "Using modules for kernel: ${kernelname}" >> $LOGFILE 2932 3001 fi 2933 3002 … … 2973 3042 if [ "$1" = "--usb" ] ; then 2974 3043 shift 2975 USBDEV =$12976 if [ _"$USBDEV " = _"" ]; then3044 USBDEVICE=$1 3045 if [ _"$USBDEVICE" = _"" ]; then 2977 3046 Die "No USB device specified" 2978 3047 fi … … 2980 3049 fi 2981 3050 fi 3051 3052 # 3053 # Default value for parameters coming from mondo potentially 3054 # 3055 if [ "$ARCH" = "ia64" ] ; then 3056 USE_LILO=yes 3057 else 3058 USE_LILO=no 3059 fi 3060 3061 # 3062 # These variables are normaly only significant in a mondo environment 3063 # Not enforced yet 3064 # 3065 CDRECOVERY="no" 3066 NOT_BOOT="no" 3067 EXCLUDE_DEVS="" 3068 IMAGE_DEVS="" 3069 NFS_DEV="" 2982 3070 2983 3071 # … … 3000 3088 echo "Mindi v$MINDI_VERSION" 3001 3089 MindiExit 0 3002 elif [ "$ #" -ge "9" ] && [ "$1" = "--custom" ] ; then3090 elif [ "$1" = "--custom" ] ; then 3003 3091 if [ _"$MONDO_SHARE" = _"" ]; then 3004 3092 Die "--custom is reserved for mondoarchive calls" … … 3012 3100 mkdir -p $MINDI_TMP 3013 3101 # 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" 3034 3113 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 3043 3142 IMAGE_DEVS="" 3044 3143 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/'` 3067 3148 if [ _"$MONDO_ROOT" != _"" ]; then 3068 3149 mkdir -p $MONDO_ROOT … … 3108 3189 KERN_DISK_MADE="" 3109 3190 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 3191 if [ "$NOT_BOOT" = "yes" ]; then 3192 LogIt "Just creating a small all.tar.gz for Mondo. Nothing else." 3117 3193 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" 3118 3196 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 3122 3199 LogIt "Done. Exiting." 3123 3200 MindiExit 0 3124 3201 fi 3125 3202 3126 if [ _"$USBDEV" != _"" ]; then3127 LogIt "Including the generation of a Bootable USB device on $USBDEV "3203 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then 3204 LogIt "Including the generation of a Bootable USB device on $USBDEVICE" 3128 3205 fi 3129 3206 if [ "$kernelpath" = "" ] ; then … … 3184 3261 YOUR_KERNEL_SUCKS="Your kernel sucks" 3185 3262 fi 3186 echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$ CACHE_LOC" >> $LOGFILE3263 echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$MINDI_CACHE" >> $LOGFILE 3187 3264 [ "$(($RANDOM%64))" -eq "0" ] && LogIt "Dude, I've looked inside your computer and it's really dusty..." 3188 3265 3189 3266 [ "$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." 3190 3267 3191 rm -f $ CACHE_LOC/{*img,*gz,*iso}3192 3193 PrepareDataDiskImages $ CACHE_LOC3268 rm -f $MINDI_CACHE/{*img,*gz,*iso} 3269 3270 PrepareDataDiskImages $MINDI_CACHE 3194 3271 noof_disks=$? 3195 3272 [ "$noof_disks" -eq "0" ] && Die "Too much stuff!" … … 3217 3294 if [ "$USE_LILO" = "yes" ] ; then 3218 3295 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_LOC1722 $kernelpath $ramdisk_size ; then3296 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 3222 3299 LogIt "WARNING - failed to create 1.72MB boot image." 3223 3300 LogIt "Please reduce your kernel's size if you want to make a 1.72MB floppy disk." 3224 3301 fi 3225 if ! PrepareBootDiskImage_LILO $ CACHE_LOC2880 $kernelpath $ramdisk_size ; then3302 if ! PrepareBootDiskImage_LILO $MINDI_CACHE 2880 $kernelpath $ramdisk_size ; then 3226 3303 LogIt "WARNING - failed to create 2.88MB floppy disk image." 3227 3304 LogIt "Please reduce your kernel's size if you want to make a 2.88MB floppy disk." 3228 PrepareBootDiskImage_LILO $ CACHE_LOC5760 $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." 3229 3306 fi 3230 3307 fi 3231 3308 else 3232 if ! PrepareBootDiskImage_SYSLINUX $ CACHE_LOC1722 $kernelpath $ramdisk_size ; then3309 if ! PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 1722 $kernelpath $ramdisk_size ; then 3233 3310 LogIt "WARNING - failed to create 1.72MB boot image." 3234 3311 LogIt "Please reduce your kernel's size if you want to make a 1.72MB floppy disk." 3235 if ! PrepareBootDiskImage_SYSLINUX $ CACHE_LOC2880 $kernelpath $ramdisk_size ; then3312 if ! PrepareBootDiskImage_SYSLINUX $MINDI_CACHE 2880 $kernelpath $ramdisk_size ; then 3236 3313 LogIt "WARNING - failed to create 2.88MB floppy disk image." 3237 3314 LogIt "Please reduce your kernel's size if you want to make a 2.88MB floppy disk." 3238 PrepareBootDiskImage_SYSLINUX $ CACHE_LOC5760 $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." 3239 3316 fi 3240 3317 fi … … 3245 3322 3246 3323 if [ _"$MONDO_SHARE" = _"" ]; then 3247 ListImagesForUser $ CACHE_LOC3324 ListImagesForUser $MINDI_CACHE 3248 3325 boot_dev=/dev/fd0u1722 3249 3326 [ ! -e "$boot_dev" ] && mknod $boot_dev b 2 60 … … 3251 3328 [ ! -e "$boot_dev" ] && Die "Will you PLEASE tell your distribution maker to create the 1.72MB devices in /dev?" 3252 3329 if [ "$PROMPT_WRITE_BOOT_FLOPPIES" = "yes" ]; then 3253 OfferToCopyImagesToDisks $ CACHE_LOC$boot_dev $FDDEVICE3254 fi 3255 OfferToMakeBootableISO $ CACHE_LOC3256 if [ _"$USBDEV" != _"" ]; then3257 OfferToMakeBootableUSB $ CACHE_LOC3330 OfferToCopyImagesToDisks $MINDI_CACHE $boot_dev $FDDEVICE 3331 fi 3332 OfferToMakeBootableISO $MINDI_CACHE 3333 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then 3334 OfferToMakeBootableUSB $MINDI_CACHE 3258 3335 fi 3259 3336 LogIt "Finished." 3260 elif [ "$ TAPEDEV" ] ; then3261 rm -f $ CACHE_LOC/{*img,*gz,*iso}3262 OfferToMakeBootableISO $ CACHE_LOC3263 if [ -e "$ CACHE_LOC/all.tar.gz" ] ; then3264 cp -f $ CACHE_LOC/all.tar.gz $MINDI_TMP/ 2>> $LOGFILE3337 elif [ "$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 3265 3342 else 3266 3343 Die "Cannot find all.tar.gz, to be written to tape" 3267 3344 fi 3268 elif [ _"$USBDEV" != _"" ]; then3269 OfferToMakeBootableUSB $ CACHE_LOC3345 elif [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then 3346 OfferToMakeBootableUSB $MINDI_CACHE 3270 3347 else 3271 OfferToMakeBootableISO $ CACHE_LOC3348 OfferToMakeBootableISO $MINDI_CACHE 3272 3349 fi 3273 3350 # cleanup -
trunk/mindi/rootfs/sbin/find-and-mount-cdrom
r274 r1106 8 8 [ ! "$SECOND_TRY" ] && LogIt "Trying $device" 9 9 if [ "`grep "using-cdstream yes" /tmp/mondo-restore.cfg`" ]; then 10 pwd=`pwd`11 cd $GROOVY10 pwd=`pwd` 11 cd $GROOVY 12 12 tar -zxf $device 2> /tmp/mount.log 13 13 res=$? 14 cd $pwd14 cd $pwd 15 15 if [ "$res" -eq "0" ] ; then 16 clear17 18 echo "Using cdstreaas extd dsk." > /tmp/TAPEDEV-HAS-DATA-DISKS19 20 21 fi16 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 22 22 else 23 23 mount $device -t iso9660 -o ro /mnt/cdrom 2> /tmp/mount.log 24 res=$?24 res=$? 25 25 fi 26 if [ "$res" -ne "0" ] ; then27 res=`cat /tmp/mount.log`28 if [ "$res" = "mount: No medium found" ] ; then26 if [ "$res" -ne "0" ] ; then 27 res=`cat /tmp/mount.log` 28 if [ "$res" = "mount: No medium found" ] ; then 29 29 [ ! "$SECOND_TRY" ] && LogIt "There is a CD-ROM drive at $device but no CD in it." 30 else30 else 31 31 [ ! "$SECOND_TRY" ] && LogIt "It's not in $device; I'll keep looking" 32 fi33 continue32 fi 33 continue 34 34 fi 35 35 LogIt "$device has a CD-ROM in it" -
trunk/mindi/rootfs/sbin/init
r1079 r1106 83 83 LoadKeymap() { 84 84 local fname 85 fname=` cat /tmp/KEYMAP-LIVES-HERE2> /dev/null`85 fname=`grep keymap-lives-here /tmp/mondo-restore.cfg | cut -d' ' -f2 2> /dev/null` 86 86 [ "$fname" = "" ] && return 87 87 if which loadkeys > /dev/null 2> /dev/null ; then -
trunk/mondo/src/common/libmondo-archive.c
r1086 r1106 20 20 #include "mr_mem.h" 21 21 #include "mr_err.h" 22 #include "mr_str.h" 23 #include "mr_file.h" 22 24 23 25 #include "libmondo-string-EXT.h" … … 544 546 /*@ buffer ************************************************************ */ 545 547 char *tmp = NULL; 546 char *tmp1 = NULL;547 char *tmp2 = NULL;548 548 char *command = NULL; 549 549 char *use_lzo_sz = NULL; … … 559 559 char *devs_to_exclude = NULL; 560 560 char *use_lilo_sz = NULL; 561 char *value = NULL;562 561 char *bootdev = NULL; 563 564 562 565 563 /*@ char ************************************************************** */ … … 572 570 int res = 0; 573 571 long estimated_total_noof_slices = 0; 572 573 FILE *fd = NULL; 574 FILE *fd1 = NULL; 574 575 575 576 assert(bkpinfo != NULL); … … 606 607 mr_asprintf(&tape_device, " "); 607 608 } 609 /* BERLIOS: This parameter is not used after? */ 610 mr_free(tape_size_sz); 608 611 if (bkpinfo->use_lzo) { 609 612 mr_asprintf(&use_lzo_sz, "yes"); … … 759 762 mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir); 760 763 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 836 766 } 837 767 … … 850 780 log_OS_error("Unable to make mnt floppy directory"); 851 781 } 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"); 852 931 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 #2880 bkpinfo->scratchdir, // parameter #3881 bkpinfo->kernel_path, // parameter #4882 tape_device, // parameter #5883 tape_size_sz, // parameter #6884 lines_in_filelist, // parameter #7 (INT)885 use_lzo_sz, // parameter #8886 cd_recovery_sz, // parameter #9887 bkpinfo->image_devs, // parameter #10888 broken_bios_sz, // parameter #11889 last_filelist_number, // parameter #12 (STRING)890 estimated_total_noof_slices, // parameter #13 (INT)891 devs_to_exclude, // parameter #14892 use_comp_sz, // parameter #15893 use_lilo_sz, // parameter #16894 use_star_sz, // parameter #17895 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 920 932 if (bkpinfo->nonbootable_backup) { 921 933 res = 0; … … 1176 1188 closeout_tape(bkpinfo); 1177 1189 } else { 1178 /* write final ISO */1190 /* write final ISO/USB */ 1179 1191 res = write_final_iso_if_necessary(bkpinfo); 1180 1192 retval += res; … … 1868 1880 if (bkpinfo->nonbootable_backup) { 1869 1881 mr_msg(1, "Making nonbootable backup"); 1870 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end1871 1882 res = eval_call_to_make_ISO(bkpinfo, 1872 1883 "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", … … 3563 3574 bkpinfo->media_size[g_current_media_number]) { 3564 3575 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]); 3568 3580 log_to_screen(tmp); 3569 3581 mr_free(tmp); 3570 3582 } 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 } 3574 3589 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 } 3576 3594 if (g_current_media_number == 1 && !res 3577 3595 && (bkpinfo->backup_media_type == cdr … … 3854 3872 3855 3873 setenv("MONDO_SHARE", MONDO_SHARE, 1); 3874 setenv("MONDORESTORECFG", MONDORESTORECFG, 1); 3875 setenv("MONDO_CACHE", MONDO_CACHE, 1); 3856 3876 } 3857 3877 -
trunk/mondo/src/common/libmondo-devices.h
r783 r1106 2 2 * $Id$ 3 3 */ 4 5 #ifndef LIBMONDO_DEVICES_H 6 # define LIBMONDO_DEVICES_H 4 7 5 8 bool am_I_in_disaster_recovery_mode(void); … … 36 39 int eject_device(char *); 37 40 38 char *list_of_NFS_mounts_only( );41 char *list_of_NFS_mounts_only(void); 39 42 40 43 void sensibly_set_tmpdir_and_scratchdir(struct s_bkpinfo *bkpinfo); … … 57 60 char *which_partition_format(const char *drive); 58 61 char *bkptype_to_string(t_bkptype bt); 62 63 #endif /* LIBMONDO_DEVICES_H */ -
trunk/mondo/src/common/libmondo-fifo-EXT.h
r59 r1106 4 4 long internal_block_size); 5 5 extern void sigpipe_occurred(int); 6 extern void kill_buffer( );6 extern void kill_buffer(void); -
trunk/mondo/src/common/libmondo-filelist.c
r1086 r1106 395 395 396 396 397 int call_exe_and_pipe_output_to_fd(char *sys call, FILE * pout)397 int call_exe_and_pipe_output_to_fd(char *sys_call, FILE * pout) 398 398 { 399 399 FILE *pattr; … … 401 401 size_t n = 0; 402 402 403 pattr = popen(sys call, "r");403 pattr = popen(sys_call, "r"); 404 404 if (!pattr) { 405 mr_msg(1, "Failed to open fattr() %s", sys call);405 mr_msg(1, "Failed to open fattr() %s", sys_call); 406 406 return (1); 407 407 } 408 408 if (feof(pattr)) { 409 mr_msg(1, "Failed to call fattr() %s", sys call);409 mr_msg(1, "Failed to call fattr() %s", sys_call); 410 410 paranoid_pclose(pattr); 411 411 return (2); … … 426 426 FILE *pout; 427 427 char *pout_command; 428 char *sys call;428 char *sys_call; 429 429 char *file_to_analyze = NULL; 430 430 char *strtmp = NULL; … … 454 454 /* BERLIOS : to be checked */ 455 455 mr_asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\')); 456 mr_asprintf(&sys call, "%s 2>> /dev/null", strtmp);456 mr_asprintf(&sys_call, "%s 2>> /dev/null", strtmp); 457 457 mr_free(strtmp); 458 call_exe_and_pipe_output_to_fd(sys call, pout);459 mr_free(sys call);458 call_exe_and_pipe_output_to_fd(sys_call, pout); 459 mr_free(sys_call); 460 460 } 461 461 paranoid_fclose(fin); -
trunk/mondo/src/common/libmondo-files.c
r1086 r1106 19 19 #include "libmondo-string-EXT.h" 20 20 #include "mr_mem.h" 21 22 #include "mr_file.h" 21 23 22 24 /*@unused@*/ … … 1044 1046 char *command = NULL; 1045 1047 1048 FILE *fd1 = NULL; 1049 1046 1050 /*@ pointers ***** */ 1047 1051 char *p; … … 1096 1100 ("Unable to find ethN (eth0, eth1, ...) adapter via NFS mount you specified."); 1097 1101 } 1098 make_hole_for_dir("/var/cache/mondo-archive");1099 1102 /******** 1100 1103 * If the NFS device that found above is a bonded device, … … 1121 1124 } 1122 1125 1123 mr_asprintf(&tmp, "%s/NFS-DEV", bkpinfo->tmpdir);1124 write_one_liner_data_file(tmp, nfs_dev);1125 1126 mr_free(nfs_dev); 1126 1127 mr_free(tmp); 1127 1128 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); 1164 1140 1165 1141 log_it("Finished storing NFS configuration"); -
trunk/mondo/src/common/libmondo-raid.c
r1086 r1106 214 214 */ 215 215 void add_disk_to_raid_device(struct list_of_disks *disklist, 216 char *device_to_add, int i ndex)216 char *device_to_add, int idx) 217 217 { 218 218 int items; … … 222 222 items = disklist->entries; 223 223 strcpy(disklist->el[items].device, device_to_add); 224 disklist->el[items].index = i ndex;224 disklist->el[items].index = idx; 225 225 items++; 226 226 disklist->entries = items; … … 652 652 653 653 struct list_of_disks *disklist = NULL; 654 int index = 0;655 654 int v = 0; 656 655 … … 708 707 mr_free(tmp); 709 708 } else { 710 index = atoi(valueB); 711 add_disk_to_raid_device(disklist, value, index); 709 add_disk_to_raid_device(disklist, value, atoi(valueB)); 712 710 } 713 711 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 2 5 3 6 extern void clean_up_KDE_desktop_if_necessary(void); 4 extern long get_time( );7 extern long get_time(void); 5 8 extern void (*log_debug_msg) (int debug_level, const char *szFile, 6 9 const char *szFunction, int nLine, … … 17 20 extern void initialize_raidrec(struct raid_device_record *raidrec); 18 21 #endif 19 extern int some_basic_system_sanity_checks( );22 extern int some_basic_system_sanity_checks(void); 20 23 21 24 … … 40 43 extern void free_libmondo_global_strings(void); 41 44 42 extern double get_kernel_version( );43 extern char *get_architecture( );45 extern double get_kernel_version(void); 46 extern char *get_architecture(void); 44 47 45 48 extern bool does_nonMS_partition_exist(void); … … 48 51 extern void stop_magicdev_if_necessary(void); 49 52 extern void restart_magicdev_if_necessary(void); 53 54 #endif /* LIBMONDO_TOOLS_EXT_H */ -
trunk/mondo/src/common/libmondo-tools.c
r1086 r1106 10 10 #include "my-stuff.h" 11 11 #include "mr_mem.h" 12 #include "mr_file.h" 13 12 14 #include "mondostructures.h" 13 15 #include "libmondo-tools.h" … … 362 364 int rdsiz_MB; 363 365 char *iso_path = NULL; 366 FILE *fd1 = NULL; 364 367 365 368 assert(bkpinfo != NULL); … … 592 595 bkpinfo->isodir); 593 596 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); 595 598 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_f ree(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); 600 603 601 604 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 604 608 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); 606 610 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 624 623 log_it("isodir: %s", iso_path); 624 mr_fprintf(fd1, "isodir %s\n", iso_path); 625 625 mr_free(iso_path); 626 mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 627 write_one_liner_data_file(tmp, bkpinfo->prefix); 626 628 627 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); 631 631 } // end of iso code 632 632 -
trunk/mondo/src/common/libmondo-tools.h
r171 r1106 3 3 */ 4 4 5 #ifndef LIBMONDO_TOOLS_H 6 # define LIBMONDO_TOOLS_H 7 5 8 void clean_up_KDE_desktop_if_necessary(void); 6 9 7 long get_time( );10 long get_time(void); 8 11 extern void (*log_debug_msg) (int debug_level, const char *szFile, 9 12 const char *szFunction, int nLine, … … 20 23 void initialize_raidrec(struct raid_device_record *raidrec); 21 24 #endif 22 int some_basic_system_sanity_checks( );25 int some_basic_system_sanity_checks(void); 23 26 24 27 … … 45 48 void free_libmondo_global_strings(void); 46 49 47 double get_kernel_version( );48 char *get_architecture( );50 double get_kernel_version(void); 51 char *get_architecture(void); 49 52 bool does_nonMS_partition_exist(void); 50 53 void stop_magicdev_if_necessary(void); 51 54 void restart_magicdev_if_necessary(void); 55 56 #endif /* LIBMONDO_TOOLS_H */ -
trunk/mondo/src/common/newt-specific-EXT.h
r688 r1106 5 5 extern bool ask_me_OK_or_cancel(char *prompt); 6 6 extern void close_evalcall_form(void); 7 extern void close_progress_form( );7 extern void close_progress_form(void); 8 8 extern void fatal_error(char *error_string); 9 9 extern void finish(int signal); … … 17 17 extern bool popup_and_get_string(char *title, char *b, char *output); 18 18 extern bool popup_with_buttons(char *p, char *button1, char *button2); 19 extern void refresh_log_screen( );20 extern void setup_newt_stuff( );19 extern void refresh_log_screen(void); 20 extern void setup_newt_stuff(void); 21 21 extern void update_evalcall_form_ratio(int num, int denom); 22 22 extern void update_evalcall_form(int curr); … … 30 30 31 31 extern t_bkptype which_backup_media_type(bool); 32 extern int which_compression_level( );32 extern int which_compression_level(void); 33 33 34 34 -
trunk/mondo/src/common/newt-specific.c
r1086 r1106 351 351 */ 352 352 void 353 finish(int signal ) {353 finish(int signal_code) { 354 354 char *command = NULL; 355 355 356 <<<<<<< .courant 357 ======= 358 /* if (signal_code==0) { popup_and_OK("Please press <enter> to quit."); } */ 359 360 /* newtPopHelpLine(); */ 361 362 >>>>>>> .fusion-droit.r1105 356 363 register_pid(0, "mondo"); 357 364 chdir("/"); … … 378 385 } 379 386 } 387 <<<<<<< .courant 380 388 printf(_("Execution run ended; result=%d\n"), signal); 381 389 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 382 396 free_libmondo_global_strings(); 383 exit(signal );397 exit(signal_code); 384 398 } 385 399 … … 650 664 void 651 665 popup_and_OK(char *prompt) { 652 charch;666 int ch; 653 667 654 668 assert_string_is_neither_NULL_nor_zerolength(prompt); -
trunk/mondo/src/common/newt-specific.h
r688 r1106 3 3 */ 4 4 5 5 #ifndef NEWT_SPECIFIC_H 6 # define NEWT_SPECIFIC_H 6 7 #ifndef H_NEWT 7 8 #include <newt.h> … … 11 12 bool ask_me_OK_or_cancel(char *prompt); 12 13 void close_evalcall_form(void); 13 void close_progress_form( );14 void close_progress_form(void); 14 15 void fatal_error(char *error_string); 15 16 void finish(int signal); … … 23 24 bool popup_and_get_string(char *title, char *b, char *output); 24 25 bool popup_with_buttons(char *p, char *button1, char *button2); 25 void refresh_log_screen( );26 void setup_newt_stuff( );26 void refresh_log_screen(void); 27 void setup_newt_stuff(void); 27 28 void update_evalcall_form_ratio(int num, int denom); 28 29 void update_evalcall_form(int curr); … … 36 37 37 38 t_bkptype which_backup_media_type(bool); 38 int which_compression_level( );39 int which_compression_level(void); 39 40 40 41 41 42 void popup_changelist_from_file(char *source_file); 43 44 #endif /* NEWT_SPECIFIC_H */ 45 -
trunk/mondo/src/include/mr_err.h
r1074 r1106 9 9 #define MR_ERR_H 10 10 11 #include "mr_msg.h" 12 11 13 /* functions (public methods) */ 12 14 13 15 extern 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);} 15 17 16 18 #endif /* MR_ERR_H */ -
trunk/mondo/src/include/mr_mem.h
r1074 r1106 13 13 #endif 14 14 #include <stdarg.h> 15 #include <stdio.h> 15 16 16 17 /* functions (public methods) */ 17 18 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 */ 27 extern inline void mr_free_int(void **allocated, int line, char *file); 28 extern inline void mr_allocstr_int(char *alloc, const char *orig, int line, char *file); 29 extern inline void mr_asprintf_int(char **alloc, int line, char *file, const char *fmt, ...); 30 extern inline void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, char *file); 31 extern inline void *mr_malloc_int(size_t size, int line, char *file); 23 32 24 33 #endif /* MR_MEM_H */ -
trunk/mondo/src/include/mr_msg.h
r1074 r1106 16 16 /* functions (public methods) */ 17 17 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);} 19 19 extern void mr_msg_init(const char *configfile, int loglevel); 20 20 extern void mr_msg_close(void); 21 21 22 /* Internal function bringing debuging info 23 * called indirectly through macros */ 24 extern inline void mr_msg_int(int debug,int line, const char *file, const char *fmt, ...); 25 22 26 #endif /* MR_MSG_H */ -
trunk/mondo/src/include/mr_str.h
r1079 r1106 13 13 extern inline char *mr_strtok(char *instr, const char *delims, int *lastpos); 14 14 extern inline char *mr_stresc(char *instr, char *toesc, const char escchr); 15 extern inline char *mr_date(void); 15 16 16 17 #endif /* MR_STR_H */ -
trunk/mondo/src/include/my-stuff.h
r1081 r1106 13 13 /*The number of lines of log output to keep at the bottom of the screen.*/ 14 14 #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 15 20 16 21 /** … … 270 275 * Free variables and call finish(@p x). 271 276 */ 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); } 273 278 274 279 /** -
trunk/mondo/src/lib/Makefile.am
r900 r1106 7 7 noinst_LIBRARIES = libmr.a 8 8 9 libmr_a_SOURCES = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c 9 libmr_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 27 27 /* We have to properly end newt */ 28 28 /* We have to remind people of log files */ 29 mr_msg_close(); 29 30 } 30 31 … … 38 39 exit(errorcode); 39 40 } 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 22 22 /* 23 23 * 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 24 27 */ 25 void mr_free (void *allocated) {28 void mr_free_int(void **allocated, int line, const char *file) { 26 29 27 30 /* free man pages says that if allocated is NULL 28 31 * nothing happens 29 32 */ 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 } 32 40 } 33 41 34 42 /* encapsulation function for malloc */ 35 void *mr_malloc (size_t size) {43 void *mr_malloc_int(size_t size, int line, const char *file) { 36 44 37 45 void *ret; … … 39 47 ret = malloc(size); 40 48 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"); 42 51 } 43 52 return(ret); … … 45 54 46 55 /* encapsulation function for getline */ 47 void mr_getline (char **lineptr, size_t *n, FILE *stream) {56 void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, const char *file) { 48 57 49 58 ssize_t ret; … … 51 60 ret = getline(lineptr,n,stream); 52 61 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"); 54 64 } 55 65 } 56 66 57 67 /* encapsulation function for asprintf */ 58 void mr_asprintf (char **strp, const char *fmt, ...) {68 void mr_asprintf_int(char **strp, int line, const char *file, const char *fmt, ...) { 59 69 60 70 int res = 0; … … 64 74 res = vasprintf(strp, fmt, args); 65 75 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"); 67 78 } 68 79 va_end(args); … … 73 84 * freeing it before in any case 74 85 */ 75 void mr_allocstr (char *alloc, const char *orig) {86 void mr_allocstr_int(char *alloc, const char *orig, int line, const char *file) { 76 87 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); 79 90 } -
trunk/mondo/src/lib/mr_msg.c
r1074 r1106 52 52 * Function that log a message. Not called directly 53 53 * but through other functions 54 * fmt needs to be just before ... 54 55 */ 55 void mr_msg (int debug, const char *fmt, ...) {56 void mr_msg_int(int debug, int line, const char *file, const char *fmt, ...) { 56 57 57 58 int i = 0; … … 74 75 for (i = 1; i < debug; i++) 75 76 fprintf(fout, " "); 76 fprintf(fout, "%s ->%s#%d: ", __FILE__, __FUNCTION__, __LINE__);77 fprintf(fout, "%s #%d: ", file, line); 77 78 } 78 79 va_start(args,fmt); -
trunk/mondo/src/lib/mr_str.c
r1079 r1106 8 8 #include <stdio.h> 9 9 #include <string.h> 10 #include <time.h> 10 11 11 12 #include "mr_mem.h" … … 105 106 return retstr; 106 107 } 108 109 /* Return a string containing the date */ 110 char *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 15 15 #include <stdio.h> 16 16 #include <stdlib.h> 17 #include <sys/types.h> 18 #include <sys/stat.h> 19 #include <unistd.h> 20 17 21 #include "my-stuff.h" 18 22 #include "../common/mondostructures.h" … … 21 25 22 26 #include "mr_mem.h" 27 #include "mr_str.h" 28 #include "mr_file.h" 23 29 24 30 // for CVS … … 124 130 } 125 131 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 135 132 /*-----------------------------------------------------------*/ 136 133 … … 144 141 { 145 142 struct s_bkpinfo *bkpinfo; 143 struct stat stbuf; 146 144 char *tmp; 147 145 int res = 0; … … 192 190 setenv("ARCH", get_architecture(), 1); 193 191 194 /* Add MONDO_SHARE environment variable for mindi */192 /* Add MONDO_SHARE + others environment variable for mindi */ 195 193 setenv_mondo_share(); 194 195 if (stat(MONDO_CACHE, &stbuf) != 0) { 196 mr_mkdir(MONDO_CACHE,0x755); 197 } 196 198 197 199 /* Configure the bkpinfo structure, global file paths, etc. */ -
trunk/mondo/src/mondorestore/mondo-prep.c
r1086 r1106 2010 2010 system("clear"); 2011 2011 newtResume(); 2012 mr_free( drivelist);2012 mr_free((void*) drivelist); 2013 2013 return (retval); 2014 2014 } … … 2604 2604 } 2605 2605 log_to_screen(_("Mountlist adjusted to suit current hard drive(s)")); 2606 mr_free( drivelist);2606 mr_free((void*) drivelist); 2607 2607 } 2608 2608 -
trunk/mondo/src/mondorestore/mondo-rstr-newt.c
r1086 r1106 67 67 /** int ****************************************************************/ 68 68 int i = 0; 69 int i ndex = 0;69 int idx = 0; 70 70 int currline = 0; 71 71 int items = 0; … … 103 103 log_it("I don't know what this button does"); 104 104 } else { 105 i ndex = find_next_free_index_in_disklist(disklist);105 idx = find_next_free_index_in_disklist(disklist); 106 106 107 107 items = disklist->entries; 108 108 strcpy(disklist->el[items].device, 109 109 unallocated_raid_partitions->el[currline].device); 110 disklist->el[items].index = i ndex;110 disklist->el[items].index = idx; 111 111 disklist->entries = ++items; 112 112 … … 1733 1733 calculate_raid_device_size(mountlist, raidlist, 1734 1734 raidrec->raid_device); 1735 mr_free( bkp_raidrec);1735 mr_free((void*) bkp_raidrec); 1736 1736 #endif 1737 1737 } … … 2259 2259 2260 2260 /** int ***************************************************************/ 2261 int i ndex = -1;2261 int idx = -1; 2262 2262 int pos = 0; 2263 2263 … … 2269 2269 for (done = FALSE; !done;) { 2270 2270 for (pos = 0; 2271 pos < disklist->entries && disklist->el[pos].index <= i ndex;2271 pos < disklist->entries && disklist->el[pos].index <= idx; 2272 2272 pos++); 2273 2273 if (pos >= disklist->entries) { 2274 2274 done = TRUE; 2275 2275 } else { 2276 i ndex = disklist->el[pos].index;2277 } 2278 } 2279 return (i ndex + 1);2276 idx = disklist->el[pos].index; 2277 } 2278 } 2279 return (idx + 1); 2280 2280 } 2281 2281 … … 2335 2335 char *isodir_path, bool nuke_me_please) 2336 2336 { 2337 char *value = NULL; 2337 2338 2338 2339 /** initialize ********************************************************/ 2339 2340 // %d no var ??? 2341 // log_it("%d - AAA - isodir_path = %s", isodir_path); 2340 malloc_string(value); 2341 2342 2342 if (isodir_device == NULL) { 2343 2343 mr_asprintf(&isodir_device, "/dev/"); … … 2346 2346 mr_asprintf(&isodir_path, "/"); 2347 2347 } 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); 2351 2351 mr_asprintf(&isodir_format, "nfs"); 2352 2352 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 2355 2357 if (nuke_me_please) { 2356 2358 return (TRUE); … … 2451 2453 * Dummy function that proves that we can get to the point where Mondo is run. 2452 2454 */ 2453 void nuke_mode_dummy( )2455 void nuke_mode_dummy(void) 2454 2456 { 2455 2457 … … 2912 2914 sizeof(struct list_of_disks)); 2913 2915 } 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); 2918 2920 } 2919 2921 #endif -
trunk/mondo/src/mondorestore/mondo-rstr-newt.h
r783 r1106 120 120 char *mountlist_entry_to_string(struct mountlist_itself *, int); 121 121 void mvaddstr_and_log_it(int, int, char *); 122 void nuke_mode_dummy( );122 void nuke_mode_dummy(void); 123 123 char *number_of_disks_as_string(int, char *); 124 124 void open_evalcall_form(char *); -
trunk/mondo/src/mondorestore/mondo-rstr-tools-EXT.h
r914 r1106 3 3 **/ 4 4 5 extern void free_MR_global_filenames( );5 extern void free_MR_global_filenames(void); 6 6 extern void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *); 7 7 extern bool is_file_in_list(char *, char *, char *); /* needle, haystack, preamble */ -
trunk/mondo/src/mondorestore/mondo-rstr-tools.c
r1086 r1106 55 55 * Free the malloc()s for the filename variables. 56 56 */ 57 void free_MR_global_filenames( )57 void free_MR_global_filenames(void) 58 58 { 59 59 mr_free(g_biggielist_txt); … … 537 537 538 538 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)); 540 540 memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist, 541 541 sizeof(struct mountlist_itself)); … … 620 620 } 621 621 run_program_and_log_output("df -m", 3); 622 mr_free( mountlist);622 mr_free((void*) mountlist); 623 623 return (retval); 624 624 } … … 918 918 919 919 read_cfg_var(cfg_file, "acl", value); 920 if (strstr(value, " TRUE")) {920 if (strstr(value, "yes")) { 921 921 mr_asprintf(&g_getfacl,"setfacl"); 922 922 mr_msg(1, "We will restore ACLs"); … … 926 926 } 927 927 read_cfg_var(cfg_file, "xattr", value); 928 if (strstr(value, " TRUE")) {928 if (strstr(value, "yes")) { 929 929 mr_asprintf(&g_getfattr,"setfattr"); 930 930 mr_msg(1, "We will restore XATTRs"); … … 2027 2027 assert(p_external_copy_of_mountlist != NULL); 2028 2028 2029 mountlist = mr_malloc(sizeof(struct mountlist_itself));2029 mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself)); 2030 2030 memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist, 2031 2031 sizeof(struct mountlist_itself)); … … 2120 2120 log_to_screen(_("All partitions were unmounted OK.")); 2121 2121 } 2122 mr_free( mountlist);2122 mr_free((void*) mountlist); 2123 2123 return (retval); 2124 2124 } … … 2441 2441 char *screen_message = NULL; 2442 2442 2443 raidlist = mr_malloc(sizeof(struct raidlist_itself));2443 raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself)); 2444 2444 2445 2445 assert(wait_for_percentage <= 100); … … 2479 2479 } 2480 2480 } 2481 mr_free( raidlist);2482 } 2481 mr_free((void*) raidlist); 2482 } -
trunk/mondo/src/mondorestore/mondo-rstr-tools.h
r1079 r1106 3 3 **/ 4 4 5 void free_global_filenames( );5 void free_global_filenames(void); 6 6 void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *); 7 7 bool is_file_in_list(char *, char *, char *); /* needle, haystack, preamble */ -
trunk/mondo/src/test/mktest
r1079 r1106 7 7 8 8 lib="../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"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 -fno-strict-aliasing -O2 -g -I../common -I../include" 10 10 11 11 echo "Generating test-msg" … … 15 15 echo "Generating test-conf" 16 16 gcc $OPT test-conf.c $lib -o test-conf 17 echo "Generating test-mem" 18 gcc $OPT test-mem.c $lib -o test-mem 17 19 18 20 echo "Testing against previous run" 19 for f in test-conf test-string test-msg ; do21 for f in test-conf test-string test-msg test-mem; do 20 22 chmod 755 $f 21 23 ./$f > /tmp/$f.res … … 23 25 if [ $? -ne 0 ]; then 24 26 echo "$f test KO !!" 27 else 28 echo "$f test OK" 25 29 fi 26 30 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.