Changeset 2635 in MondoRescue for branches/2.2.10/mindi/mindi
- Timestamp:
- May 17, 2010, 5:57:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mindi/mindi
r2623 r2635 51 51 # If "yes" mindi will automatically use your own kernel. 52 52 53 KERNEL_IS_XEN="no" 54 # If set to "no", the kernel is not a Xen kernel 55 # If "yes", mindi will modify isolinux.cfg for the Xen kernel. 56 53 57 MY_FSTAB=/etc/fstab 54 58 TAPE_MODS="ht st osst ide-tape ide_tape" … … 420 424 } 421 425 426 427 FindMboot32Binary() { 428 MBOOTC32=/usr/lib/syslinux/mboot.c32 429 [ ! -e "$MBOOTC32" ] && MBOOTC32=/usr/lib/syslinux/mboot.c32 430 [ ! -e "$MBOOTC32" ] && MBOOTC32=/usr/lib64/syslinux/mboot.c32 431 [ ! -e "$MBOOTC32" ] && MBOOTC32=/usr/share/syslinux/mboot.c32 432 [ ! -e "$MBOOTC32" ] && MBOOTC32=/usr/share/lib/syslinux/mboot.c32 433 [ ! -e "$MBOOTC32" ] && MBOOTC32=/usr/share/lib64/syslinux/mboot.c32 434 [ ! -e "$MBOOTC32" ] && MBOOTC32=`find / -name mboot.c32 | grep -x "/.*/mboot.c32"` 435 [ ! -e "$MBOOTC32" ] && Die "Please install mboot.c32 first. If your syslinux RPM doesn't include mboot.c32, you may download an isolinux RPM from Mondo's website - go to http://www.mondorescue.com and click on 'Download'" 436 LogFile "Found mboot.c32 at $MBOOTC32" 437 } 422 438 423 439 FindIsolinuxBinary() { … … 913 929 } 914 930 931 # Get PV's for an LV 932 GetPVsForLV() { 933 if [ -n "$1" ]; then 934 vg=`$LVMCMD lvdisplay $1 2>/dev/null |awk '/VG Name/{print $NF;exit}'` 935 if [ -z "$vg" ]; then 936 return 937 fi 938 $LVMCMD vgdisplay -v $vg 2>/dev/null | awk '/PV Name/{print $NF}' 939 fi 940 } 941 915 942 916 943 MakeMountlist() { … … 1149 1176 l="$l `$MINDI_LIB/analyze-my-lvm --givemapperofdm $d`" 1150 1177 done 1178 1179 # Remove PVs from LVs excluded 1180 l="$l `GetPVsForLV $current_partition`" 1181 1182 # We want a single unique list 1151 1183 list_of_devices="`echo $l | sort -u`" 1184 1152 1185 for d in $MINDI_EXCLUDE_DEVS ; do 1153 1186 if [ "`echo " $list_of_devices " | grep " $d"`" != "" ]; then … … 1317 1350 local i old_pwd 1318 1351 if [ -z "$ISO_CMD" ]; then 1319 Log It"Neither mkisofs nor genisoimage found, unable to make CD image"1352 LogFile "Neither mkisofs nor genisoimage found, unable to make CD image" 1320 1353 return 1321 1354 fi … … 1343 1376 MakeMessageFile > $MINDI_TMP/iso/message.txt 1344 1377 cp $kernelpath $MINDI_TMP/iso/vmlinuz 2>> $LOGFILE || Die "Cannot copy vmlinuz ($kernelpath) to mindi tmp ($MINDI_TMP/iso/vmlinuz). Did you run out of disk space?" 1378 if [ $KERNEL_IS_XEN = "yes" ]; then 1379 cp $xenkernelpath $MINDI_TMP/iso/xen.gz 2>> $LOGFILE || Die "Cannot copy xen.gz ($xenkernelpath) to mindi tmp ($MINDI_TMP/iso/xen.gz). Did you run out of disk space?" 1380 cp $MBOOTC32 $MINDI_TMP/iso/mboot.c32 2>> $LOGFILE || Die "Cannot copy mboot.c32 ($MBOOTC32) to mindi tmp ($MINDI_TMP/iso/mboot.c32). Did you run out of disk space?" 1381 fi 1382 1345 1383 cp $MINDI_TMP/initrd.img $MINDI_TMP/iso/initrd.img 2>> $LOGFILE || Die "Cannot copy initrd.img ($MINDI_TMP/initrd.img) to $MINDI_TMP/iso/initrd.img. Did you run out of disk space?" 1346 1384 if [ _"$MONDO_SHARE" != _"" ]; then … … 1362 1400 if [ "$ARCH" != "ia64" ] ; then 1363 1401 if [ _"$MONDO_SHARE" != _"" ]; then 1364 cp -f $MINDI_TMP/iso/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt} $MONDO_CACHE 2>> $LOGFILE || Die "Cannot copy core files to ramdisk for boot disk (under $MONDO_CACHE). Did you run out of disk space?" 1402 if [ $KERNEL_IS_XEN = "no" ]; then 1403 cp -f $MINDI_TMP/iso/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt} $MONDO_CACHE 2>> $LOGFILE || Die "Cannot copy core files to ramdisk for boot disk (under $MONDO_CACHE). Did you run out of disk space?" 1404 else 1405 cp -f $MINDI_TMP/iso/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt,mboot.c32,xen.gz} $MONDO_CACHE 2>> $LOGFILE || Die "Cannot copy core files to ramdisk for boot disk (under $MONDO_CACHE). Did you run out of disk space?" 1406 fi 1365 1407 cp -f $MONDO_SHARE/autorun $MINDI_TMP/iso 2>> $LOGFILE 1366 1408 fi … … 1368 1410 else 1369 1411 $ISO_CMD $ISO_OPT -V Mindi_Image -o $MINDI_CACHE/mindi.iso -b images/mindi-bootroot.$BOOT_SIZE.img -c images/boot.cat -no-emul-boot . > /dev/null 2> $MINDI_TMP/mkisofs.log 1370 rm -f images/mindi-bootroot.$BOOT_SIZE.img1371 1412 fi 1372 1413 if [ "$?" -ne "0" ] ; then … … 1387 1428 local i 1388 1429 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1389 echo -n "Shall I make a bootable USB image ? (y/[n]) "1430 echo -n "Shall I make a bootable USB device ? (y/[n]) " 1390 1431 read i 1391 1432 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 … … 1617 1658 ps="" 1618 1659 fi 1619 outstr="label $i\n\tkernel ${ps}vmlinuz\n\tappend initrd=${ps}initrd.img root=/dev/ram0 rw ramdisk_size=$ramdisk_size ${ooo} $MINDI_ADDITIONAL_BOOT_PARAMS\n" 1660 if [ $KERNEL_IS_XEN = "no" ]; then 1661 outstr="label $i\n\tkernel ${ps}vmlinuz\n\tappend initrd=${ps}initrd.img root=/dev/ram0 rw ramdisk_size=$ramdisk_size ${ooo} $MINDI_ADDITIONAL_BOOT_PARAMS\n" 1662 else 1663 outstr="label $i\n\tkernel ${ps}mboot.c32\n\tappend ${ps}xen.gz --- ${ps}vmlinuz root=/dev/ram0 rw ramdisk_size=$ramdisk_size ${ooo} $MINDI_ADDITIONAL_BOOT_PARAMS --- ${ps}initrd.img\n" 1664 fi 1620 1665 fi 1621 1666 echo -en "$outstr" 1622 1667 done 1623 1624 1668 if [ -e "$MINDI_DATA/memtest.img" ] ; then 1625 1669 if [ "$type" = "elilo" ]; then … … 1708 1752 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null 1709 1753 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4` 1710 cp -f $kernelpath $mountpoint/vmlinuz &> /dev/null 1711 if [ "$?" -ne "0" ] ; then 1754 1755 retval=0 1756 if [ $KERNEL_IS_XEN = "no" ]; then 1757 cp -f $kernelpath $mountpoint/vmlinuz &> /dev/null 1758 retval=$? 1759 else 1760 cp -f $xenkernelpath $mountpoint/xenkernel &> /dev/null 1761 retval=$? 1762 cp -f $kernelpath $mountpoint/vmlinuz &> /dev/null 1763 let retval+=$? 1764 fi 1765 1766 if [ "$retval" -ne "0" ] ; then 1712 1767 LogFile "Files at mountpoint ($mountpoint) :-" 1713 1768 du -sk $mountpoint/* >> $LOGFILE … … 2200 2255 done 2201 2256 2257 rm -f $MINDI_TMP/ungzip.lis 2202 2258 for i in `echo $needed_modules | tr ' ' '\n' | sort -u`; do 2203 2259 grep -qE '^$i$' $MINDI_TMP/cp.lis … … 2206 2262 LogFile "Adding $i ($s KB) to the rootfs" 2207 2263 echo $i >> $MINDI_TMP/cp.lis 2264 2265 # Uncompress modules if not using udev and native modprobe 2266 if [ ! -f $mountpoint/tmp/USE-UDEV ]; then 2267 if [ "`echo "$i" | grep -F ".gz"`" ]; then 2268 echo "$i" >> $MINDI_TMP/ungzip.lis 2269 fi 2270 fi 2208 2271 fi 2209 2272 done … … 2256 2319 # Then copy files needed 2257 2320 LANGUAGE=C tar cf - `cat $MINDI_TMP/cp.lis` 2> /dev/null | (cd $mountpoint ; tar xf - ) 2>&1 | grep -Ev "tar: Removing.*/\'" >> $LOGFILE 2321 2322 # Uncompress modules if not using udev and native modprobe 2323 for f in `cat $MINDI_TMP/ungzip.lis`; do 2324 echo "Uncompressing $f" >> $LOGFILE 2325 gunzip -f $mountpoint/$f 2326 done 2327 rm -f $MINDI_TMP/ungzip.lis 2258 2328 2259 2329 # Then handle links … … 2597 2667 2598 2668 kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath="" 2669 # See if it's a Xen kernel 2670 if [ -n "$kernelpath" ]; then 2671 strings $kernelpath | grep -iq xen 2>/dev/null 2672 if [ $? -eq 0 ]; then 2673 # It's a Xen kernel 2674 KERNEL_IS_XEN=yes 2675 LogFile "It's a Xen kernel..." 2676 # WARNING: This will only work for RHEL 5 2677 # TODO: SLES and others 2678 # Use TryToFindKernelPath ? 2679 xenkernelpath="/boot/`uname -r | awk '{sub("[Xx][Ee][Nn]",""); printf("xen.gz-%s",$0)}'`" 2680 if [[ -z "$xenkernelpath" || ! -f "$xenkernelpath" ]]; then 2681 Die "Cannot find Xen kernel $xenkernelpath, aborting" 2682 fi 2683 xenkernelname=`basename $xenkernelpath` 2684 FindMboot32Binary 2685 fi 2686 fi 2687 2599 2688 ### 2600 2689 ### Sq-Modification... … … 2602 2691 ### if module path is found then use it other wise use uname -r to set it... 2603 2692 ### 2693 if [ $KERNEL_IS_XEN = "yes" ]; then 2694 LogAll "xenkernelpath = $xenkernelpath" 2695 LogAll "xenkernelname = $xenkernelname" 2696 fi 2604 2697 kernelname=`echo $kernelpath | cut -d'-' -f2-` 2605 2698 LogAll "kernelname = $kernelname"
Note:
See TracChangeset
for help on using the changeset viewer.