Changeset 1842 in MondoRescue for branches/stable/mindi/mindi
- Timestamp:
- Dec 15, 2007, 2:24:34 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi/mindi
r1770 r1842 428 428 rmdir $mountpoint || LogIt "Cannot rmdir (CODI)" 429 429 } 430 430 431 431 432 # Last function called before exiting … … 659 660 fi 660 661 modpaths=`find $1 -name $2.*o -type f` 661 [ "$?" -ne "0" ] && Die "find $1 -name $2.o -type f --- failed"662 #[ "$?" -ne "0" ] && Die "find $1 -name $2.o -type f --- failed" 662 663 [ "$modpaths" = "" ] && modpaths=`find $1 -name $2.o.gz -type f` 663 664 [ "$modpaths" = "" ] && modpaths=`find $1 -name $2.ko.gz -type f` … … 956 957 grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||^LABEL=\/|^UUID=/ && !/fdd|cdr|zip|floppy/ {print $1}' 957 958 [ -e "/etc/raidtab" ] && $AWK '/^ *device/ {print $2}' /etc/raidtab 959 if [ -e "/vmfs/volumes" ]; then 960 # For VMWare ESX 3 get the device names of these volumes 961 vdf -P | grep -E '/vmfs/volumes' | awk '{print $1}' 962 fi 958 963 return 959 964 } … … 1003 1008 } 1004 1009 1005 1010 # 1011 # Critical function which computes all dependencies (dyn. lib.) 1012 # for a list of binaries 1013 # 1006 1014 LocateDeps() { 1007 1015 local incoming fname deps … … 1042 1050 fi 1043 1051 if [ -h "$d" ]; then 1044 echo "$link $d" 1052 echo "$link" 1053 echo "$d" 1045 1054 else 1046 1055 echo "$link" … … 1212 1221 [ "$c_p" = "none" ] && continue 1213 1222 redhat_label="" 1223 label="" 1214 1224 uuid="" 1215 1225 absolute_partition=`readlink -f $c_p` … … 1617 1627 LogIt "Failed to create ISO image." 1618 1628 else 1619 echo "Created bootable ISO image at $MINDI_CACHE/mindi.iso" >>$LOGFILE1629 echo "Created bootable ISO image at $MINDI_CACHE/mindi.iso" | tee -a $LOGFILE 1620 1630 fi 1621 1631 rm -f $MINDI_TMP/mkisofs.log … … 1627 1637 local i old_pwd 1628 1638 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1629 echo "Shall I make a bootable USB image ? (y/[n]"1639 echo -n "Shall I make a bootable USB image ? (y/[n]) " 1630 1640 read i 1631 1641 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 … … 1898 1908 el=`find /boot/efi -name elilo.efi` 1899 1909 cp $el $mountpoint 1900 cp $liloconf $mountpoint /elilo.efi $mountpoint/efi/boot1910 cp $liloconf $mountpoint 1901 1911 if [ $mountefi -eq 1 ]; then 1902 1912 umount /boot/efi 2>&1 > /dev/null … … 1947 1957 echo "Free space left on image = $free_space KB" >> $LOGFILE 1948 1958 echo "Max kernel size on $BOOT_SIZE KB image (est'd) = $max_kernel_size K" >> $LOGFILE 1949 # make it bootable1959 # make it bootable 1950 1960 rm -f $mountpoint/zero 1951 1961 [ -e "$MINDI_LIB/memdisk" ] && cp -f $MINDI_LIB/memdisk $mountpoint 2>> $LOGFILE … … 1953 1963 if [ "$ARCH" != "ia64" ] ; then 1954 1964 $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE 1965 else 1966 /bin/true 1955 1967 fi 1956 1968 else … … 2120 2132 done 2121 2133 for i in $EXTRA_MODS ; do 2122 j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null`2123 [ ! "$j" ] && echo "WARNING - cannot find failsafe module $i.o " >> $LOGFILE2134 j=`find lib/modules/$FAILSAFE_KVER -name $i.*o.gz 2> /dev/null` 2135 [ ! "$j" ] && echo "WARNING - cannot find failsafe module $i.o.gz" >> $LOGFILE 2124 2136 for k in $j ; do 2125 2137 if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then … … 2210 2222 2211 2223 ProcessLDD() { 2212 local incoming f 2224 local incoming f d nd bd bnd 2213 2225 read incoming 2214 while [ "$incoming" != "" ] 2226 while [ "$incoming" != "" ]; do 2215 2227 # We take the full path name of the dyn. lib. we want 2216 2228 incoming=`echo "$incoming" | awk '{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'` 2217 2229 for f in $incoming ; do 2230 # echo modified file name if one of the parent dir is a link 2231 # by replacing the original dirname by the destination of the link 2232 d="`dirname $f`" 2233 found="false" 2234 while [ "$d" != "/" ]; do 2235 if [ -h "$d" ]; then 2236 nd=`readlink -f $d` 2237 bd=`basename $d` 2238 bnd=`basename $nd` 2239 f=`echo $f | sed "s~/$bd/~/$bnd/~"` 2240 echo $d 2241 fi 2242 d="`dirname $d`" 2243 done 2244 2218 2245 echo "$f" 2219 2246 echo "`ReadAllLink $f`" … … 2590 2617 [ -e "/dev/.devfsd" ] && echo "/dev/.devfsd found" > tmp/USE-DEVFS 2591 2618 2619 # Handle the case where busybox is dynamically linked 2620 # Should be done first so that if /lib64 is a link, it's 2621 # created first like that, instead of as a real dir later on 2622 file $MINDI_LIB/rootfs/bin/busybox 2>&1 | grep -q "dynamically" 2623 if [ $? -eq 0 ]; then 2624 LocateDeps $MINDI_LIB/rootfs/bin/busybox > $MINDI_TMP/busy.lis 2625 cp --parents -Rdf `sort -u $MINDI_TMP/busy.lis` . 2626 rm -f $MINDI_TMP/busy.lis 2627 fi 2628 2592 2629 # Management of udev (which includes modprobe in rules) 2593 2630 ps auxww | grep -v grep | grep -qw udevd … … 2596 2633 LogIt "udev device manager found" 2597 2634 cp --parents -Rdf /etc/udev . 2> /dev/null 2635 # This avoids NIC remapping if on another machine at restore time on Debian at least 2636 rm -f ./etc/udev/rules.d/z25_persistent-net.rules 2598 2637 cp --parents -Rdf /lib/udev /lib64/udev . 2> /dev/null 2599 2638 if [ -x /sbin/udevd ]; then 2600 lis=`grep -Ev '^#' $MINDI_CONF/udev.files` 2639 lis2=`grep -Ev '^#' $MINDI_CONF/udev.files` 2640 lis="" 2641 # Get only the files which exist in that list 2642 # and potentially their symlink structure 2643 for i in $lis2; do 2644 if [ -h $i ]; then 2645 j=$i 2646 while [ -h $j ]; do 2647 lis="$lis $j" 2648 j=`readlink $j` 2649 done 2650 lis="$lis $j" 2651 elif [ -f $i ]; then 2652 lis="$lis $i" 2653 fi 2654 done 2655 # And their deps 2601 2656 LocateDeps $lis > $MINDI_TMP/udev.lis 2602 2657 for i in $lis; do … … 2614 2669 fi 2615 2670 fi 2671 2616 2672 # Management of potential HW info (Proliant only at the moment) 2673 rm -rf $MINDI_CACHE/bkphw 2617 2674 mindi-bkphw $MINDI_CACHE $MINDI_CONF | tee -a $LOGFILE 2618 2675 if [ -d $MINDI_CACHE/bkphw ]; then … … 2641 2698 cp --parents -Rdf /dev/fd0*[1,2][4,7,8]* . 2> /dev/null 2642 2699 2643 # Handle the case where busybox is dynamically linked2644 file $MINDI_LIB/rootfs/bin/busybox 2>&1 | grep -q "dynamically"2645 if [ $? -eq 0 ]; then2646 LocateDeps $MINDI_LIB/rootfs/bin/busybox > $MINDI_TMP/busy.lis2647 cp --parents -Rdf `sort -u $MINDI_TMP/busy.lis` .2648 rm -f $MINDI_TMP/busy.lis2649 fi2650 2700 cd $old_pwd 2651 2701 echo -en "..." … … 2689 2739 echo "Adding $i ($s KB) to the rootfs" >> $LOGFILE 2690 2740 cp --parents -pdf $i $mountpoint 2>/dev/null || LogIt "Unable to copy $i to $mountpoint" 2691 if [ "`echo "$i" | grep -F ".gz"`" ]; then 2741 # Uncompress modules if not useing udev and native modprobe 2742 if [ ! -f $mountpoint/tmp/USE-UDEV ]; then 2743 if [ "`echo "$i" | grep -F ".gz"`" ]; then 2692 2744 gunzip -f $mountpoint/$i 2693 i=`echo $i | sed 's/.gz//'` 2694 fi 2745 #i=`echo $i | sed 's/.gz//'` 2746 fi 2747 fi 2748 done 2749 2750 # Also copy modules.dep in case of udev so that normal modprobe works 2751 cp --parents -pdf /$floppy_modules_path/modules.dep $mountpoint 2>/dev/null || LogIt "Unable to copy modules.dep to $mountpoint" 2752 2753 # For all modules supported, create symlinks under the mountpoint 2754 for i in $EXTRA_MODS $NET_MODS $SCSI_MODS; do 2755 all_modules="$all_modules `FindSpecificModuleInPath $mountpoint $i | sed 's~^$mountpoint/~~g'`" 2756 done 2757 for i in $all_modules; do 2695 2758 (cd $mountpoint ; ln -s $i . 2>/dev/null) 2696 [ "`echo "$i" | grep -F ".gz"`" ] && gunzip -f $mountpoint/`basename $i` 2697 done 2698 # Also copy modules.dep in case of udev so that normal modprobe works 2699 p=`echo $i | cut -d/ -f1-3` 2700 cp -df $p/modules.dep $mountpoint/$p 2>/dev/null || LogIt "Unable to copy modules.dep to $mountpoint" 2759 done 2701 2760 if [ ! -e "/sbin/devfsd" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then 2702 2761 echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE … … 2724 2783 "ext2fs") 2725 2784 # say what will be used 2726 2785 echo "Creating an ext2 initrd image..." >> $LOGFILE 2727 2786 # kernel expects linuxrc in ext2 filesystem 2728 2787 ( cd $mountpoint && ln -sf sbin/init linuxrc ) … … 2730 2789 umount $mountpoint || Die "Cannot unmount $tempfile" 2731 2790 dd if=$tempfile bs=1k 2> /dev/null > ${rdz_fname}.tmp 2> /dev/null 2732 bs=`tune2fs -l ${rdz_fname}.tmp | grep -E '^Block size:' | cut -d: -f2 `2791 bs=`tune2fs -l ${rdz_fname}.tmp | grep -E '^Block size:' | cut -d: -f2 | sed 's/^ *//'` 2733 2792 ADDITIONAL_BOOT_PARAMS="$ADDITIONAL_BOOT_PARAMS ramdisk_blocksize=$bs" 2734 gzip - v9 ${rdz_fname}.tmp > $rdz_fname 2> /dev/null2793 gzip -c9 ${rdz_fname}.tmp > $rdz_fname 2735 2794 rm -f ${rdz_fname}.tmp 2736 2795 # log that we are done 2737 2796 echo "...done." >> $LOGFILE 2738 2797 ;; 2739 2798 "initramfs") 2740 2799 # say what will be used 2741 2800 echo "Creating a gzip'ed cpio (AKA initramfs) initrd image..." >> $LOGFILE 2742 2801 # make sure that cpio is there 2743 2802 which cpio &> /dev/null; [ $? -eq 0 ] || Die "cpio not found. Please install package cpio and try again." … … 2973 3032 echo "LVM set to $LVM" >> $LOGFILE 2974 3033 echo "----------" >> $LOGFILE 2975 echo "df result:" >> $LOGFILE2976 echo "----------" >> $LOGFILE2977 df -T >> $LOGFILE2978 echo "-------------" >> $LOGFILE2979 3034 echo "mount result:" >> $LOGFILE 2980 3035 echo "-------------" >> $LOGFILE … … 2997 3052 MODULES="`cat /proc/modules | awk '{print $1}'`" 2998 3053 if [ -x /usr/sbin/esxcfg-module ]; then 3054 echo "-------------" >> $LOGFILE 2999 3055 echo "VMWare ESX server detected - Enabling dedicated support" >> $LOGFILE 3000 3056 echo "-------------" >> $LOGFILE … … 3005 3061 fi 3006 3062 echo "-------------" >> $LOGFILE 3063 echo "df result:" >> $LOGFILE 3064 echo "----------" >> $LOGFILE 3065 df -T >> $LOGFILE 3066 echo "-------------" >> $LOGFILE 3007 3067 echo "Liste of extra modules is:" >> $LOGFILE 3008 3068 echo "$EXTRA_MODS" >> $LOGFILE … … 3010 3070 3011 3071 # Compute libata version 3012 laver=`modinfo libata | grep -Ei '^Version:' | cut -d: -f2 | cut -d. -f1 | sed 's/ *//g' `3072 laver=`modinfo libata | grep -Ei '^Version:' | cut -d: -f2 | cut -d. -f1 | sed 's/ *//g' 2> /dev/null` 3013 3073 # If libata v2 is used then remove ide-generic as it will perturbate boot 3014 3074 if [ "`echo $MODULES | grep libata`" ]; then … … 3079 3139 [ ! "$2" ] && Die "Please specify the binary to look at" 3080 3140 LocateDeps $2 3141 # Avoids logfile content for mondo 3142 export MONDO_SHARE="" 3143 MindiExit $? 3144 elif [ "$1" = "--readalllink" ] ; then 3145 [ ! "$2" ] && Die "Please specify the binary to look at" 3146 ReadAllLink $2 3081 3147 # Avoids logfile content for mondo 3082 3148 export MONDO_SHARE="" … … 3215 3281 if [ _"$MONDO_SHARE" != _"" ]; then 3216 3282 Die "Please use -k <path> to specify kernel." 3283 else 3284 USE_OWN_KERNEL="no" 3217 3285 fi 3218 3286 if [ "$INTERACTIVE" = "yes" ]; then
Note:
See TracChangeset
for help on using the changeset viewer.