Changeset 1770 in MondoRescue for branches/stable/mindi/mindi
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi/mindi
r1693 r1770 416 416 dd if=/dev/zero of=$imagefile bs=1k count=1440 &> /dev/null || LogIt "Cannot dd (CODI)" 417 417 echo "Creating ext2 filesystem on $imagefile" >> $LOGFILE 418 mke2fs -N 12 -F $imagefile &> /dev/null|| Die "Unable to create an ext2 file system on $imagefile"418 mke2fs -N 12 -F $imagefile >> $LOGFILE 2>> $LOGFILE || Die "Unable to create an ext2 file system on $imagefile" 419 419 mount -t ext2 -o loop $imagefile $mountpoint || Die "Can't loopmount $imagefile to $mountpoint! The reason may be missing support for loopfs or ext2 (or both) in the running kernel." 420 420 mv $tarball $mountpoint/ … … 511 511 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/lib/kbd 512 512 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share 513 [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole 514 [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole-setup 513 515 if [ ! -e "$KEYDIR" ] ; then 514 516 LogIt "Keyboard mapping directory not found. I shall use default map at boot-time." … … 532 534 mkdir -p $bigdir/etc/console 533 535 cp /etc/console/boottime.kmap.gz $bigdir/etc/console 2>> $LOGFILE 536 echo -e "$DONE" 537 return 0 538 elif [ -e "/etc/console-setup/boottime.kmap.gz" ] ; then 539 echo "Ubuntu-style config detected." >> $LOGFILE 540 echo -en "Adding the following keyboard mapping tables: " 541 mkdir -p $bigdir/tmp 542 echo "/etc/console-setup/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE 543 KBDEPTH=0 544 mkdir -p $bigdir/etc/console-setup 545 cp /etc/console-setup/boottime.kmap.gz $bigdir/etc/console-setup 2>> $LOGFILE 534 546 echo -e "$DONE" 535 547 return 0 … … 860 872 local lcMagicCramfs="<3>cramfs: wrong magic" 861 873 local lcMagicExt2fs="<3>EXT2-fs: blocksize too small for device." 862 local lcMagicInitfs="<6>checking if image is initramfs... "874 local lcMagicInitfs="<6>checking if image is initramfs...|<6>Unpacking initramfs..." 863 875 864 876 # local variables … … 874 886 875 887 # Kernel may be gzip compressed 876 file $lvKernelImage 2>&1 | grep -q 888 file $lvKernelImage 2>&1 | grep -q gzip 877 889 if [ $? -eq 0 ]; then 878 lvScanRes=`gzip -cd $lvKernelImage | strings | grep - e "$lcMagicCramfs" -e "$lcMagicExt2fs" -e "$lcMagicInitfs"`890 lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicInitfs"` 879 891 else 880 892 # get offet of gzip magic "1f8b0800" in file … … 885 897 886 898 # scan kernel image for initrd filessystem support 887 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | gunzip -c 2> /dev/null | strings | grep - e "$lcMagicCramfs" -e "$lcMagicExt2fs" -e "$lcMagicInitfs"`899 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | gunzip -c 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicInitfs"` 888 900 fi 889 901 890 902 # determine which filesystem to use for initrd image: ext2fs, gzip'ed cpio (initramfs ) or cramfs 891 if [ `echo $lvScanRes | grep - c "$lcMagicExt2fs"` -eq 1 ]; then903 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 892 904 lvUseFilesystem="ext2fs" 893 elif [ `echo $lvScanRes | grep - c "$lcMagicInitfs"` -eq 1 ]; then905 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 894 906 lvUseFilesystem="initramfs" 895 elif [ `echo $lvScanRes | grep - c "$lcMagicCramfs"` -eq 1 ]; then907 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 896 908 lvUseFilesystem="cramfs" 897 909 else … … 942 954 local res currline partition all_partitions ap_orig remaining i j 943 955 944 grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||^LABEL \=\/|^UUID=/ && !/fdd|cdr|zip|floppy/ {print $1}'956 grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||^LABEL=\/|^UUID=/ && !/fdd|cdr|zip|floppy/ {print $1}' 945 957 [ -e "/etc/raidtab" ] && $AWK '/^ *device/ {print $2}' /etc/raidtab 946 958 return … … 966 978 for i in $DENY_MODS; do 967 979 module_list=`echo ${module_list} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 980 EXTRA_MODS=`echo ${EXTRA_MODS} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 968 981 done 969 982 ### … … 993 1006 LocateDeps() { 994 1007 local incoming fname deps 995 incoming="$ 1"1008 incoming="$*" 996 1009 for fname in $incoming ; do 997 1010 if [ ! -e "$fname" ] ; then … … 1106 1119 1107 1120 echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile 1108 # BERLIOS: That code is duplicated - Should be done once only1109 1121 list_to_echo="$MODULES" 1110 1122 # Remove unwanted modules from list 1111 1123 for i in $DENY_MODS; do 1112 1124 list_to_echo=`echo ${list_to_echo} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 1125 EXTRA_MODS=`echo ${EXTRA_MODS} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 1113 1126 done 1114 1127 … … 1120 1133 infile="/etc/modules.conf" 1121 1134 fi 1135 1122 1136 for module in $list_to_echo $EXTRA_MODS ; do 1123 1137 params=`sed -n "s/^options \\+$module \\+//p" $infile` … … 1184 1198 done 1185 1199 [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`" 1186 printf " %-15s %-15s %-15s %-15s %-15s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABELUUID | tee -a $LOGFILE1200 printf " %-15s %-15s %-15s %-15s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABEL/UUID | tee -a $LOGFILE 1187 1201 useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1" 1188 1202 for c_p in $all_partitions ; do … … 1436 1450 fi 1437 1451 fi 1452 if [ "$redhat_label" ]; then 1453 label="$redhat_label" 1454 elif [ "$uuid" ]; then 1455 label="$uuid" 1456 fi 1438 1457 partition_format="`echo "$partition_format" | cut -d',' -f1`"; # in case user has ext3,ext2 or something dumb like that 1439 1458 [ "$partition_format" = "auto" ] && partition_format="`mount | grep -w $current_partition | $AWK '{print$5;}'`"; # in case user uses 'auto' (dumb!) 1440 unofficial_outstring=`printf "\t%-15s %-15s %-15s %7s %-15s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$redhat_label" $uuid`1459 unofficial_outstring=`printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"` 1441 1460 if [ "$current_partition" = "" ] ; then 1442 1461 echo "Unknown partition (outstring = $unofficial_outstring)" >> $LOGFILE … … 1445 1464 partition_mountpt=raid 1446 1465 partition_format=raid 1447 printf "\t%-15s %-15s %-15s %7s %-15s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$redhat_label" $uuid| tee -a $LOGFILE1448 printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$ redhat_label" $uuid>> $mountlist1466 printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE 1467 printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist 1449 1468 else 1450 1469 echo "Unknown mountpoint (outstring = $unofficial_outstring)" >> $LOGFILE … … 1461 1480 partition_format="vfat" 1462 1481 fi 1463 printf "\t%-15s %-15s %-15s %7s %-15s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$redhat_label" $uuid| tee -a $LOGFILE1464 printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$redhat_label" $uuid>> $mountlist1482 printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE 1483 printf "%s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist 1465 1484 fi 1466 1485 done … … 1608 1627 local i old_pwd 1609 1628 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1610 echo "Shall I make a bootable USB image ?" 1611 echo -en "WARNING: This will erase all content on $USBDEVICE (y/[n]) " 1629 echo "Shall I make a bootable USB image ? (y/[n] " 1612 1630 read i 1613 1631 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1632 if [ "$USBDEVICE" = "" ]; then 1633 echo -en "Please enter the device name of your USB device (e.g. /dev/sda) : " 1634 read dev 1635 USBDEVICE=$dev 1636 fi 1637 echo "WARNING: This will erase all content on $USBDEVICE" 1638 echo -en "Are you sure you want to use $USBDEVICE (y/[n]) " 1614 1639 fi 1615 1640 if [ _"$MINDI_TMP" = _"" ]; then … … 1632 1657 echo -en "." 1633 1658 echo "Unmounting $USBDEVICE just in case" >> $LOGFILE 1634 umount $USB DEVICE 2>&1>> $LOGFILE1659 umount $USBPART 2>> $LOGFILE 1>> $LOGFILE 1635 1660 echo "Erasing $USBDEVICE" >> $LOGFILE 1636 $FDISK $USBDEVICE 2> &1>> $LOGFILE << EOF1661 $FDISK $USBDEVICE 2>> $LOGFILE 1>> $LOGFILE << EOF 1637 1662 d 1638 1663 d … … 1688 1713 cp -f $j $k 2> /dev/null || Die "Failed to copy $j to $k" 1689 1714 cp -f $j $MINDI_TMP 2> /dev/null || Die "Failed to copy $j to $MINDI_TMP" 1690 if [ _"$MONDO_SHARE" != _"" ]; then1691 cp -f $j $MONDO_ROOT 2>> $LOGFILE || Die "Failed to copy $j to $MONDO_ROOT"1692 fi1693 1715 fi 1694 1716 done … … 1708 1730 cd $old_pwd 1709 1731 echo -en "." 1732 umount $MINDI_TMP/usb 1710 1733 if [ "$ARCH" != "ia64" ] ; then 1711 if [ _"$MONDO_SHARE" != _"" ]; then1712 cp -f $MONDO_SHARE/autorun $MONDO_ROOT 2>> $LOGFILE1713 fi1714 umount $MINDI_TMP/usb1715 1734 syslinux $USBPART 2>> $MINDI_TMP/syslinux.log 1716 1735 if [ "$?" -ne "0" ] ; then … … 1725 1744 else 1726 1745 echo "No USB boot support for ia64" | tee -a $LOGFILE 1727 umount $MINDI_TMP/usb1728 1746 MindiExit -1 1729 1747 fi … … 1878 1896 mountefi=1 1879 1897 fi 1880 cp /boot/efi/elilo.efi $mountpoint 1898 el=`find /boot/efi -name elilo.efi` 1899 cp $el $mountpoint 1881 1900 cp $liloconf $mountpoint/elilo.efi $mountpoint/efi/boot 1882 1901 if [ $mountefi -eq 1 ]; then … … 2197 2216 incoming=`echo "$incoming" | awk '{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'` 2198 2217 for f in $incoming ; do 2199 echo "$f `ReadAllLink $f`" 2218 echo "$f" 2219 echo "`ReadAllLink $f`" 2200 2220 done 2201 2221 read incoming … … 2546 2566 echo -en "..." 2547 2567 echo "Creating ext2 filesystem on $tempfile" >> $LOGFILE 2548 mke2fs -b 1024 -m 1 -i 2048 -F $tempfile &> /dev/null|| Die "Unable to create an ext2 file system on $tempfile"2568 mke2fs -b 1024 -m 1 -i 2048 -F $tempfile >> $LOGFILE 2>> $LOGFILE || Die "Unable to create an ext2 file system on $tempfile" 2549 2569 echo -en "..." 2550 2570 mkdir -p $mountpoint … … 2569 2589 mkdir -p tmp 2570 2590 [ -e "/dev/.devfsd" ] && echo "/dev/.devfsd found" > tmp/USE-DEVFS 2591 2592 # Management of udev (which includes modprobe in rules) 2593 ps auxww | grep -v grep | grep -qw udevd 2594 if [ $? -eq 0 ]; then 2595 echo "udev device manager found" > tmp/USE-UDEV 2596 LogIt "udev device manager found" 2597 cp --parents -Rdf /etc/udev . 2> /dev/null 2598 cp --parents -Rdf /lib/udev /lib64/udev . 2> /dev/null 2599 if [ -x /sbin/udevd ]; then 2600 lis=`grep -Ev '^#' $MINDI_CONF/udev.files` 2601 LocateDeps $lis > $MINDI_TMP/udev.lis 2602 for i in $lis; do 2603 if [ "`echo $i | cut -c1`" = "/" ]; then 2604 j=`echo $i | cut -c2-` 2605 rm -f $j 2606 fi 2607 done 2608 cp --parents -Rdf $lis `sort -u $MINDI_TMP/udev.lis` . 2609 rm -f $MINDI_TMP/udev.lis 2610 else 2611 echo "udevd daemon not in standard place (/sbin)" 2>&1 | tee -a $LOGFILE 2612 echo "mindi will use static devices which may cause problems" 2>&1 | tee -a $LOGFILE 2613 rm -f tmp/USE-UDEV 2614 fi 2615 fi 2616 # Management of potential HW info (Proliant only at the moment) 2617 mindi-bkphw $MINDI_CACHE $MINDI_CONF | tee -a $LOGFILE 2618 if [ -d $MINDI_CACHE/bkphw ]; then 2619 LogIt "Hardware Information found and saved ..." 2620 cp -rp $MINDI_CACHE/bkphw . 2621 lis=`grep -Ev '^#' $MINDI_CACHE/tools.files` 2622 LocateDeps $lis > $MINDI_TMP/tools.lis 2623 cp --parents -Rdf $lis `sort -u $MINDI_TMP/tools.lis` . 2624 if [ -f $MINDI_CACHE/mindi-rsthw ]; then 2625 mv -f $MINDI_CACHE/mindi-rsthw . 2626 chmod 755 ./mindi-rsthw 2627 fi 2628 rm -f $MINDI_TMP/tools.lis $MINDI_CACHE/tools.files 2629 fi 2630 2571 2631 for w in cdrom floppy groovy-stuff ; do 2572 2632 mkdir -p mnt/$w … … 2580 2640 2581 2641 cp --parents -Rdf /dev/fd0*[1,2][4,7,8]* . 2> /dev/null 2642 2643 # Handle the case where busybox is dynamically linked 2644 file $MINDI_LIB/rootfs/bin/busybox 2>&1 | grep -q "dynamically" 2645 if [ $? -eq 0 ]; then 2646 LocateDeps $MINDI_LIB/rootfs/bin/busybox > $MINDI_TMP/busy.lis 2647 cp --parents -Rdf `sort -u $MINDI_TMP/busy.lis` . 2648 rm -f $MINDI_TMP/busy.lis 2649 fi 2582 2650 cd $old_pwd 2583 2651 echo -en "..." … … 2604 2672 list_of_groovy_mods="$list_of_groovy_mods $NET_MODS" 2605 2673 fi 2606 [ -e "$needed_modules_path" ] || LogIt "path $needed_modules_path does not exist.\n If you're not using a modular kernel then you're NUTS." 2674 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ "$USBDEVICE" != "" ]; then 2675 list_of_groovy_mods="$list_of_groovy_mods $EXTRA_MODS" 2676 fi 2677 for i in $DENY_MODS; do 2678 echo "Removing $i from the list of modules to load" >> $LOGFILE 2679 list_of_groovy_mods=`echo ${list_of_groovy_mods} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 2680 done 2681 2682 [ -e "$floppy_modules_path" ] || LogIt "path $floppy_modules_path does not exist.\n If you're not using a modular kernel then you're NUTS." 2607 2683 for i in $list_of_groovy_mods ; do 2608 2684 needed_modules="$needed_modules `FindSpecificModuleInPath $needed_modules_path $i`" … … 2612 2688 [ "$YOUR_KERNEL_SUCKS" ] && i=$MINDI_TMP/$i 2613 2689 echo "Adding $i ($s KB) to the rootfs" >> $LOGFILE 2614 cp -df $i $mountpoint/ 2>/dev/null || LogIt "Unable to copy $i to $mountpoint" 2690 cp --parents -pdf $i $mountpoint 2>/dev/null || LogIt "Unable to copy $i to $mountpoint" 2691 if [ "`echo "$i" | grep -F ".gz"`" ]; then 2692 gunzip -f $mountpoint/$i 2693 i=`echo $i | sed 's/.gz//'` 2694 fi 2695 (cd $mountpoint ; ln -s $i . 2>/dev/null) 2615 2696 [ "`echo "$i" | grep -F ".gz"`" ] && gunzip -f $mountpoint/`basename $i` 2616 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" 2617 2701 if [ ! -e "/sbin/devfsd" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then 2618 2702 echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE … … 2830 2914 fi 2831 2915 2832 if ! which mkfs.vfat &> /dev/null ; then2916 if ! which mkfs.vfat 1> /dev/null 2> /dev/null ; then 2833 2917 Die "mkfs.vfat missing from your filesystem - please install your dosfstools RPM or DEB package. Perhaps your PATH environmental variable is broken, too?" 2834 2918 fi … … 2918 3002 echo "-------------" >> $LOGFILE 2919 3003 /usr/sbin/esxcfg-module -l >> $LOGFILE 2920 MODULES="$MODULES ` esxcfg-module -l | awk '{print $1}'`"3004 MODULES="$MODULES `/usr/sbin/esxcfg-module -l | awk '{print $1}'`" 2921 3005 fi 2922 3006 echo "-------------" >> $LOGFILE … … 2925 3009 echo "-------------" >> $LOGFILE 2926 3010 3011 # Compute libata version 3012 laver=`modinfo libata | grep -Ei '^Version:' | cut -d: -f2 | cut -d. -f1 | sed 's/ *//g'` 3013 # If libata v2 is used then remove ide-generic as it will perturbate boot 3014 if [ "`echo $MODULES | grep libata`" ]; then 3015 if [ "$laver" = "2" ]; then 3016 DENY_MODS="$DENY_MODS ide-generic" 3017 echo "ide-generic removed from module list as your system uses libata v2+" >> $LOGFILE 3018 echo "-------------" >> $LOGFILE 3019 fi 3020 fi 2927 3021 2928 3022 FLOPPY_WAS_MOUNTED="" … … 2982 3076 MindiExit 0 2983 3077 fi 3078 elif [ "$1" = "--locatedeps" ] ; then 3079 [ ! "$2" ] && Die "Please specify the binary to look at" 3080 LocateDeps $2 3081 # Avoids logfile content for mondo 3082 export MONDO_SHARE="" 3083 MindiExit $? 2984 3084 elif [ "$1" = "--makemountlist" ] ; then 2985 3085 [ ! "$2" ] && Die "Please specify the output file" … … 3004 3104 export MINDI_TMP=$MONDO_TMP 3005 3105 mkdir -p $MINDI_TMP 3006 # This is the scratch dir in mondo 3106 # This is the scratch dir in mondo - subdir images 3007 3107 MINDI_CACHE=$3 3008 3108 if [ _"$MINDI_CACHE" != _"" ]; then … … 3050 3150 fi 3051 3151 [ "$CDRECOVERY" = "yes" ] && [ "$PROMPT_MAKE_TAPE_IMAGE" = "yes" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time" 3152 # MONDO_ROOT is the real scratchdir 3052 3153 MONDO_ROOT=`echo $MINDI_CACHE | sed 's/\(.*\)\/.*/\1/'` 3053 3154 if [ _"$MONDO_ROOT" != _"" ]; then … … 3208 3309 Die "Cannot find all.tar.gz, to be written to tape" 3209 3310 fi 3210 elif [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] ; then3311 elif [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ "$USBDEVICE" != "" ]; then 3211 3312 OfferToMakeBootableUSB $MINDI_CACHE 3212 3313 else
Note:
See TracChangeset
for help on using the changeset viewer.