Changeset 3522 in MondoRescue
- Timestamp:
- Mar 3, 2016, 9:06:23 AM (8 years ago)
- Location:
- branches/3.2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/MondoRescue/bin/mr-label
r3501 r3522 151 151 pb_log(1,"Previous hex was ***$hex***\n"); 152 152 my @loc = ($hex =~ m/../g); 153 print Dumper(@loc);153 #print Dumper(@loc); 154 154 $hex = join('',reverse(@loc)); 155 155 pb_log(1,"Previous uuid was ***$hex***\n"); -
branches/3.2/mindi/mindi
r3520 r3522 44 44 fi 45 45 46 EXTRA_SPACE=120000 # increase if you run out of ramdisk space 47 BOOT_SIZE=86000 # size of the boot disk in KB 46 EXTRA_SPACE=150000 # increase if you run out of ramdisk space 48 47 49 48 PROMPT_MAKE_CD_IMAGE="yes" 50 49 # Ask if you want to make a CD Image to be written? 51 # if this is set to 'no' , then the image will be created automatically50 # if this is set to 'no' in the conf file, then the image will be created automatically 52 51 53 52 PROMPT_MAKE_USB_IMAGE="yes" 54 53 # Ask if you want to make a USB Image to be written? 55 # if this is set to 'no' , then the image will be created automatically54 # if this is set to 'no' in the conf file, then the image will be created automatically 56 55 57 56 USE_OWN_KERNEL="yes" … … 128 127 fi 129 128 130 ISO_OPT="-J -r -v -p Mindi -publisher http://www.mondorescue.org -A Mindi "129 ISO_OPT="-J -r -v -p Mindi -publisher http://www.mondorescue.org -A Mindi -V Mindi_Image -no-emul-boot -o $MINDI_CACHE/mindi.iso " 131 130 132 131 # Mindi set this as default in case it's invoked alone … … 183 182 # Should be declared here as used immediately below potentialy 184 183 MindiExit() { 185 LogFile " Mindi $MINDI_VERSION is exiting"186 LogFile " End date : `date`"184 LogFile "INFO: Mindi $MINDI_VERSION is exiting" 185 LogFile "INFO: End date : `date`" 187 186 if [ _"$MONDO_SHARE" != _"" ] ; then 188 187 echo "------------- mindi logfile included -------------------------" >> /var/log/mondoarchive.log … … 307 306 mkdir -p $outdir 308 307 incoming=`ReadLine` 309 counter= 0308 counter=$3 310 309 > $templog 311 310 312 311 while [ "$incoming" != "" ] ; do 312 if [ "$3" = "1" ]; then 313 counter=$(($counter+1)) 314 LogProgress $counter $2 315 fi 313 316 # Non absolute file names should not arrive till here => skipped 314 317 if [ `echo "$incoming" | cut -c1` != '/' ]; then … … 325 328 done 326 329 if [ -d "$incoming" -a ! -h "$incoming" ]; then 327 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 330 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 0 328 331 elif [ -e "$incoming" ] && [ $found = "false" ]; then 329 332 if [ ! -h "$incoming" ]; then … … 341 344 fi 342 345 [ -x "$outdir" ] && StripExecutable $outdir 343 counter=$(($counter+1))344 LogProgress $counter $2345 346 fi 346 347 incoming=`ReadLine` … … 586 587 587 588 GenerateGiantDependencyList() { 588 local incoming loc fname list_of_files i tempfile outfile progress filelist res r mapfile mappath included_list included_item old_pwdtempdepfile modres noof_lines lvmversion lvmresolved589 590 echo -en " Analyzing dependency requirements"589 local incoming loc fname list_of_files i tempfile outfile progress filelist res r mapfile mappath included_list included_item tempdepfile modres noof_lines lvmversion lvmresolved 590 591 echo -en "INFO: Analyzing dependency requirements" 591 592 outfile=$1 592 593 tempfile=$MINDI_TMP/$$.txt … … 669 670 done 670 671 fi 671 echo -en "$DONE\n Making complete dependency list"672 echo -en "$DONE\nINFO: Making complete dependency list" 672 673 673 674 tr -s '/' '/' < $tempfile | sort -u > $tempfile.new … … 690 691 if [ -e "$MINDI_TMP/post-nuke.tgz" ] ; then 691 692 LogAll "\nINFO: Incorporating post-nuke tarball" 692 old_pwd=`pwd` 693 cd "$bigdir" 694 tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || LogAll "ERROR: when untarring post-nuke tarball" $MINDI_TMP/$$.log 695 cd "$old_pwd" 693 (cd "$bigdir" ; tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || LogAll "ERROR: when untarring post-nuke tarball" $MINDI_TMP/$$.log) 696 694 fi 697 695 if cp -f $MINDI_TMP/mondo*restore $bigdir/usr/bin 2>> $LOGFILE ; then … … 850 848 851 849 852 ListImagesForUser() {853 local path fname854 path=$MINDI_CACHE855 echo -en "In the directory '$path' you will find the images:-\n"856 for fname in `ls $path | grep -F mindi-` ; do857 printf "%19s " $fname858 done859 echo " "860 }861 862 863 850 ListKernelModulePaths() { 864 851 local module_list module fname r kern … … 993 980 } 994 981 995 # Called by TurnTgzIntoRdz, to make /tmp/$MRCFG982 # Called by MakeBootInitFile, to make /tmp/$MRCFG 996 983 MakeMondoConfigFile() { 997 984 local outfile use_lzo use_comp use_star … … 1056 1043 1057 1044 LogFile "------------------------------------" 1058 LogFile " Your raw fstab file looks like this:"1045 LogFile "INFO: Your raw fstab file looks like this:" 1059 1046 LogFile "------------------------------------" 1060 1047 cat $MY_FSTAB >> $LOGFILE 1061 1048 LogAll "-----------------------------------" 1062 LogAll " Your mountlist will look like this:"1049 LogAll "INFO: Your mountlist will look like this:" 1063 1050 LogAll "-----------------------------------" 1064 1051 … … 1298 1285 1299 1286 # We want a single unique list 1300 list_of_devices="`echo $l | sort -u`"1287 list_of_devices="`echo $l | tr ' ' '\n' | sort -u`" 1301 1288 1302 1289 for d in `echo $MINDI_EXCLUDE_DEVS | sed 's/|/ /g'`; do … … 1452 1439 else 1453 1440 if [ "$partition_format" = "dos" ] || [ "$partition_format" = "msdos" ] ; then 1454 1441 LogFile "WARNING: vfat should be used instead of dos/msdos as a partition format" 1455 1442 partition_format="vfat" 1456 1443 fi … … 1481 1468 } 1482 1469 1483 OfferToMakeBootableISO() {1484 local i old_pwd files1485 if [ -z "$ISO_CMD" ]; then1486 LogAll "ERROR: Neither mkisofs nor genisoimage nor xorriso found, unable to make CD image"1487 return1488 fi1489 if [ "$PROMPT_MAKE_CD_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then1490 echo -en "Shall I make a bootable CD image? (y/[n]) "1491 read i1492 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 01493 fi1494 rm -Rf $MINDI_TMP/iso1495 mkdir -p $MINDI_TMP/iso/{images,archives}1496 files=`ls $MINDI_CACHE/{*.gz,*.img}`1497 cp -f $files $MINDI_TMP/iso/images 2>> $LOGFILE || LogAll "WARNING: OfferToMakeBootableISO: Cannot copy files to $MINDI_TMP/iso/images"1498 for i in memdisk memtest.bin memtest.img ; do1499 j=$MINDI_LIB/$i1500 k=$MINDI_TMP/iso1501 if [ -e "$j" ] ; then1502 LogAll "INFO: Copying $j to $k"1503 cp -f $j $k 2>> $LOGFILE || Die "Failed to copy $j to $k"1504 cp -f $j $MINDI_TMP 2>> $LOGFILE || Die "Failed to copy $j to $MINDI_TMP"1505 if [ _"$MONDO_SHARE" != _"" ]; then1506 cp -f $j $MONDO_ROOT 2>> $LOGFILE || Die "Failed to copy $j to $MONDO_ROOT"1507 fi1508 fi1509 done1510 1511 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?"1512 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?"1513 1514 # copy boot stuff now generated in PrepareDataDiskImage1515 if [ "$BOOT_TYPE" = "UEFI" ]; then1516 (cd $MINDI_TMP/iso ; tar xfz $MINDI_CACHE/all.tar.gz ./EFI)1517 tbc="EFI"1518 else1519 (cd $MINDI_TMP/iso ; tar xfz $MINDI_CACHE/all.tar.gz ./syslinux)1520 tbc="syslinux"1521 fi1522 1523 MakeMessageFile $MINDI_TMP/iso/$tbc | cut -c1-80 > $MINDI_TMP/iso/$tbc/message.txt1524 1525 if [ "$ARCH" != "ia64" ] ; then1526 if [ $KERNEL_IS_XEN = "yes" ]; then1527 FindMboot32Binary1528 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?"1529 cp $MBOOTC32 $MINDI_TMP/iso/$tbc/mboot.c32 2>> $LOGFILE || Die "Cannot copy mboot.c32 ($MBOOTC32) to mindi tmp ($MINDI_TMP/iso/$tbc/mboot.c32). Did you run out of disk space?"1530 fi1531 1532 cp $ISOLINUX $MINDI_TMP/iso/$tbc/isolinux.bin 2>> $LOGFILE || Die "Cannot copy isolinux.bin ($ISOLINUX) to $MINDI_TMP/iso - did you run out of disk space?"1533 1534 if [ -e "$LDLINUXC32" ]; then1535 cp $LDLINUXC32 $MINDI_TMP/iso/$tbc 2>> $LOGFILE || Die "Cannot copy $LDLINUXC32 to $MINDI_TMP/iso/$tbc. Did you run out of disk space?"1536 fi1537 1538 if [ _"$MONDO_SHARE" != _"" ]; then1539 cp -rf $MINDI_TMP/iso/{initrd.img,vmlinuz,$tbc} $MONDO_ROOT 2>> $LOGFILE || Die "Cannot copy core files to ramdisk for boot disk (under $MONDO_ROOT). Did you run out of disk space?"1540 if [ $KERNEL_IS_XEN = "yes" ]; then1541 cp -f $MINDI_TMP/iso/xen.gz $MONDO_ROOT 2>> $LOGFILE || Die "Cannot copy Xen kernel to $MONDO_ROOT. Did you run out of disk space?"1542 fi1543 cp -f $MONDO_SHARE/autorun $MINDI_TMP/iso 2>> $LOGFILE1544 fi1545 CMD="$ISO_CMD -U $ISO_OPT -V Mindi_Image -o $MINDI_CACHE/mindi.iso -b $tbc/isolinux.bin -c $tbc/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"1546 else1547 CMD="$ISO_CMD $ISO_OPT -V Mindi_Image -o $MINDI_CACHE/mindi.iso -b images/mindi-bootroot.img -c images/boot.cat -no-emul-boot"1548 fi1549 1550 old_pwd=`pwd`1551 cd "$MINDI_TMP/iso"1552 LogFile "Invoking $CMD"1553 $CMD . > /dev/null 2> $MINDI_TMP/mkisofs.log1554 if [ "$?" -ne "0" ] ; then1555 if [ "$BOOT_TYPE" = "UEFI" ]; then1556 CMD=`echo $CMD | perl -p -e 's|--efi-boot |-eltorito-platform 0xEF -eltorito-boot |'`1557 CMD=`echo $CMD | perl -p -e 's|-efi-boot |-eltorito-platform 0xEF -eltorito-boot |'`1558 $CMD . > /dev/null 2> $MINDI_TMP/mkisofs.log1559 if [ "$?" -eq "0" ] ; then1560 LogAll "INFO: Created bootable ISO image at $MINDI_CACHE/mindi.iso"1561 else1562 MakeISOErrors1563 fi1564 else1565 MakeISOErrors1566 fi1567 else1568 LogAll "INFO: Created bootable ISO image at $MINDI_CACHE/mindi.iso"1569 fi1570 rm -f $MINDI_TMP/mkisofs.log1571 cd "$old_pwd"1572 }1573 1470 1574 1471 MakeISOErrors() { 1575 1472 1576 1473 LogFile "----------- $ISO_CMD's errors --------------" 1577 LogAll "$ CMD returned the following errors:"1474 LogAll "$ISO_CMD returned the following errors:" 1578 1475 cat $MINDI_TMP/mkisofs.log | tee -a $LOGFILE 1579 1476 LogAll "ERROR: Failed to create ISO image." 1580 1477 } 1581 1478 1582 1583 OfferToMakeBootableUSB() { 1584 local i files 1585 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1586 echo -n "Shall I make a bootable USB device ? (y/[n]) " 1587 read i 1588 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1589 if [ "$USBDEVICE" = "" ]; then 1590 echo -en "Please enter the device name of your USB device (e.g. /dev/sda) : " 1591 read dev 1592 USBDEVICE=$dev 1593 fi 1594 echo "WARNING: This will erase all content on $USBDEVICE" 1595 echo -en "Are you sure you want to use $USBDEVICE (y/[n]) " 1596 read i 1597 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1598 fi 1599 rm -Rf $MINDI_TMP/usb 1600 mkdir -p $MINDI_TMP/usb 1601 USBPART="${USBDEVICE}1" 1602 1603 echo -en "Transforming $USBDEVICE in a Bootable device " 1604 echo -en "." 1605 LogFile "INFO: Transforming $USBDEVICE in a Bootable device" 1606 LogFile "INFO: Checking $USBDEVICE" 1479 MakeBootableDevice() { 1480 1481 local target tbc retval part size mount_opt 1482 1483 target="$1" 1484 1485 rm -Rf $MINDI_TMP/target 1486 mkdir -p $MINDI_TMP/target/{images,archives,tmp} 1487 1488 LogAll "INFO: Copying $MINDI_CACHE/*.gz to $MINDI_TMP/target/images" 1489 cp -f $MINDI_CACHE/*.gz $MINDI_TMP/target/images 2>> $LOGFILE || LogAll "WARNING: MakeBootableDevice: Cannot copy files to $MINDI_TMP/target/images" 1490 for i in memdisk memtest.bin memtest.img ; do 1491 j=$MINDI_LIB/$i 1492 k=$MINDI_TMP/target 1493 if [ -e "$j" ] ; then 1494 LogAll "INFO: Copying $j to $k" 1495 cp -f $j $k 2>> $LOGFILE || LogAll "Failed to copy $j to $k" 1496 cp -f $j $MINDI_TMP 2>> $LOGFILE || LogAll "Failed to copy $j to $MINDI_TMP" 1497 if [ _"$MONDO_SHARE" != _"" ]; then 1498 cp -f $j $MONDO_ROOT 2>> $LOGFILE || LogAll "Failed to copy $j to $MONDO_ROOT" 1499 fi 1500 fi 1501 done 1502 1503 retval=0 1504 LogAll "INFO: Copying $kernelpath to $MINDI_TMP/target/vmlinuz" 1505 cp $kernelpath $MINDI_TMP/target/vmlinuz 2>> $LOGFILE 1506 if [ "$?" -ne "0" ] ; then 1507 LogAll "ERROR: Failed to copy $kernelpath $MINDI_TMP/target/" 1508 retval=$(($retval+1)) 1509 fi 1510 LogAll "INFO: Copying $MINDI_TMP/initrd.img to $MINDI_TMP/target/initrd.img" 1511 cp $MINDI_TMP/initrd.img $MINDI_TMP/target/ 2>> $LOGFILE 1512 if [ "$?" -ne "0" ] ; then 1513 LogAll "ERROR: Failed to copy $MINDI_TMP/initrd.img to $MINDI_TMP/target/" 1514 retval=$(($retval+1)) 1515 fi 1516 1517 # copy boot stuff now generated in PrepareDataDiskImage 1518 if [ "$BOOT_TYPE" = "UEFI" ]; then 1519 (cd $MINDI_TMP/target ; tar xfz $MINDI_CACHE/all.tar.gz ./EFI) 1520 tbc="EFI" 1521 else 1522 (cd $MINDI_TMP/target ; tar xfz $MINDI_CACHE/all.tar.gz ./syslinux) 1523 tbc="syslinux" 1524 if [ -f "$MINDI_TMP/target/$tbc/syslinux.cfg" ]; then 1525 LogFile "----------- syslinux's conf --------------" 1526 cat $MINDI_TMP/target/$tbc/syslinux.cfg >> $LOGFILE 1527 LogFile "------------------------------------------" 1528 fi 1529 if [ "$target" = "ISO" ]; then 1530 cp $ISOLINUX $MINDI_TMP/target/$tbc/ 2>> $LOGFILE 1531 if [ "$?" -ne "0" ] ; then 1532 LogAll "ERROR: Failed to copy $ISOLINUX to $MINDI_TMP/target/$tbc" 1533 retval=$(($retval+1)) 1534 fi 1535 fi 1536 fi 1537 1538 if [ "$ARCH" != "ia64" ] ; then 1539 if [ $KERNEL_IS_XEN = "yes" ]; then 1540 FindMboot32Binary 1541 cp $xenkernelpath $MINDI_TMP/target/xen.gz 2>> $LOGFILE 1542 if [ "$?" -ne "0" ] ; then 1543 LogAll "ERROR: Failed to copy $xenkernelpath to $MINDI_TMP/target/" 1544 retval=$(($retval+1)) 1545 fi 1546 cp $MBOOTC32 $MINDI_TMP/target/$tbc/mboot.c32 2>> $LOGFILE 1547 if [ "$?" -ne "0" ] ; then 1548 LogAll "ERROR: Failed to copy $MBOOTC32 to $MINDI_TMP/target/$tbc" 1549 retval=$(($retval+1)) 1550 fi 1551 fi 1552 fi 1553 1554 MakeMessageFile $MINDI_TMP/target/$tbc | cut -c1-80 > $MINDI_TMP/target/$tbc/message.txt 1555 1556 if [ _"$MONDO_SHARE" != _"" ]; then 1557 cp -rf $MINDI_TMP/target/$tbc $MONDO_ROOT 2>> $LOGFILE 1558 if [ "$?" -ne "0" ] ; then 1559 LogAll "ERROR: Failed to copy $MINDI_TMP/target/$tbc to $MONDO_ROOT" 1560 LogAll " Please check the target directory." 1561 retval=$(($retval+1)) 1562 fi 1563 if [ $KERNEL_IS_XEN = "yes" ]; then 1564 cp -f $MINDI_TMP/target/xen.gz $MONDO_ROOT 2>> $LOGFILE 1565 if [ "$?" -ne "0" ] ; then 1566 LogAll "ERROR: Failed to copy $MINDI_TMP/target/xen.gz to $MONDO_ROOT" 1567 LogAll " Please check the target directory." 1568 retval=$(($retval+1)) 1569 fi 1570 fi 1571 cp -f $MONDO_SHARE/autorun $MINDI_TMP/target 2>> $LOGFILE 1572 fi 1573 1574 if [ -f "$MINDI_TMP/$MRCFG" ]; then 1575 cp -f $MINDI_TMP/$MRCFG $MINDI_TMP/target/tmp 1576 fi 1577 1578 LogFile "----------- target dir content -----------" 1579 LogFile "------------------------------------------" 1580 ls -lR $MINDI_TMP/target >> $LOGFILE 1581 LogFile "------------------------------------------" 1582 LogFile "----------- target dir sizes -------------" 1583 du -sk $MINDI_TMP/target/* >> $LOGFILE 1584 LogFile "------------------------------------------" 1585 1586 if [ "$retval" -ne "0" ] ; then 1587 LogFile "--------------------------------" 1588 LogFile "INFO: Size of $MINDI_TMP/target:" 1589 du -sk $MINDI_TMP/target/* >> $LOGFILE 1590 LogFile "--------------------------------" 1591 echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n" >> $LOGFILE 1592 umount $MINDI_TMP/target 1593 LogAll "ERROR: Problems while creating boot media." 1594 LogAll " Please unload some of your modules and try again." 1595 Die " Try to increase EXTRA_SPACE in $MINDI_CONFIG" 1596 fi 1597 1598 mkdir -p $MINDI_TMP/mpt 1599 1600 if [ "$target" = "USB" ]; then 1601 LogAll "INFO: Transforming $USBDEVICE in a Bootable device" 1602 LogAll "INFO: Checking $USBDEVICE" 1607 1603 $FDISK -l $USBDEVICE 2>&1 >> $LOGFILE 1608 1604 if [ $? -ne 0 ]; then … … 1611 1607 MindiExit -1 1612 1608 fi 1613 echo -en "."1614 1609 # Some distro do auto mount at that point (Ubuntu) 1615 Log File"INFO: Unmounting $USBPART just in case"1610 LogAll "INFO: Unmounting $USBPART just in case" 1616 1611 umount $USBPART 2>> $LOGFILE 1>> $LOGFILE 1617 1612 if [ "$BOOT_TYPE" = "BIOS" ]; then … … 1620 1615 if [ -r $MBRFILE ]; then 1621 1616 LogAll "INFO: Installing an MBR ($MBRFILE) on $USBDEVICE" 1622 dd if=$MBRFILE of=$USBDEVICE 1617 dd if=$MBRFILE of=$USBDEVICE >> $LOGFILE 2>> $LOGFILE 1623 1618 else 1624 1619 LogAll "WARNING: You may need to install an MBR (usually in $MBRFILE, but not found on your system)" … … 1626 1621 fi 1627 1622 fi 1628 Log File"INFO: Preparing $USBDEVICE"1623 LogAll "INFO: Preparing $USBDEVICE" 1629 1624 cat > $MINDI_TMP/fdisk.txt << EOF 1630 1625 d … … 1655 1650 LogFile "----------------" 1656 1651 rm -f $MINDI_TMP/fdisk.txt 1657 Log File"INFO: The USB device $USBDEVICE now looks like this:"1652 LogAll "INFO: The USB device $USBDEVICE now looks like this:" 1658 1653 $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE 1659 echo -en "."1660 1654 # Calling kpartx in case devices were not created 1661 1655 if [ -x "/sbin/kpartx" ]; then … … 1663 1657 fi 1664 1658 # Some distro do auto mount at that point (Ubuntu) 1665 Log File"INFO: Unmounting $USBPART just in case again"1659 LogAll "INFO: Unmounting $USBPART just in case again" 1666 1660 umount $USBPART 2>> $LOGFILE 1>> $LOGFILE 1667 echo -en "."1668 1661 # Some distro have a dmsetup conf at that point so removing it Cf: http://trac.mondorescue.org/ticket/651 1669 1662 if [ "`which dmsetup`" != "" ]; then 1670 1663 block_id="`echo $USBPART | sed 's/\/dev\///g'`" 1671 1664 if [[ "`dmsetup ls | awk '{print $1}' | grep $block_id`" != "" ]]; then 1672 Log File"INFO: Removing $block_id from device mapper."1665 LogAll "INFO: Removing $block_id from device mapper." 1673 1666 sleep 1 1674 1667 dmsetup remove $block_id 1675 1668 fi 1676 1669 fi 1677 echo -en "." 1678 LogFile "INFO: Creating a vfat filesystem on $USBPART" 1679 mkdosfs -F 32 $USBPART 2>&1 >> $LOGFILE 1680 if [ $? -ne 0 ]; then 1681 LogAll "ERROR: Unable to create a vfat filesystem on $USBPART" 1682 LogAll " Make sure your USB device is plugged in and partitioned ($USBPART must exist on it)" 1670 part=$USBPART 1671 mount_opt="" 1672 else 1673 # ISO image 1674 part=$MINDI_TMP/mindi-bootroot.img 1675 size=`du -sk $MINDI_TMP/target 2> /dev/null | cut -f1` 1676 # Adds 10 MB to allow for additional space 1677 size=$(($size+10000)) 1678 LogAll "INFO: Creating a $size KB empty file for boot device of the ISO image" 1679 dd if=/dev/zero of=$part bs=1k count=$size &> /dev/null || Die "Cannot dd blank $part" 1680 mount_opt="-o loop" 1681 fi 1682 1683 LogAll "INFO: Creating a vfat filesystem on $part" 1684 mkdosfs -F 32 $part 2>&1 >> $LOGFILE 1685 if [ $? -ne 0 ]; then 1686 LogAll "ERROR: Unable to create a vfat filesystem on $part" 1687 if [ "$target" = "USB" ]; then 1688 LogAll " Make sure your USB device is plugged in and partitioned ($part must exist on it)" 1683 1689 $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE 1684 MindiExit -1 1685 fi 1686 echo -en "." 1687 LogFile "INFO: Mounting $USBPART on $MINDI_TMP/usb" 1688 mount $USBPART $MINDI_TMP/usb 2>> $LOGFILE 1689 if [ $? -ne 0 ]; then 1690 LogAll "ERROR: Unable to mount $USBPART on $MINDI_TMP/usb" 1691 LogAll " Make sure your USB device is plugged in, partitioned and formated ($USBPART must exist on it)" 1690 fi 1691 MindiExit -1 1692 fi 1693 LogAll "INFO: Mounting $part on $MINDI_TMP/mpt" 1694 mount -t vfat $mount_opt $part $MINDI_TMP/mpt 2>> $LOGFILE 1695 if [ $? -ne 0 ]; then 1696 LogAll "ERROR: Unable to mount $part on $MINDI_TMP/mpt" 1697 if [ "$target" = "USB" ]; then 1698 LogAll " Make sure your USB device is plugged in, partitioned and formated ($part must exist on it)" 1692 1699 $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE 1693 MindiExit -1 1694 fi 1695 echo -en "." 1696 mkdir -p $MINDI_TMP/usb/images 1697 files=`ls $MINDI_CACHE/{*.gz,*.img}` 1698 cp -f $files $MINDI_TMP/usb/images 2>> $LOGFILE || LogAll "ERROR: OfferToMakeBootableUSB: Cannot copy files to $MINDI_TMP/usb/images" 1699 echo -en "." 1700 for i in memdisk memtest.bin memtest.img ; do 1701 j=$MINDI_LIB/$i 1702 k=$MINDI_TMP/usb 1703 if [ -e "$j" ] ; then 1704 LogFile "INFO: Copying $j to $k" 1705 cp -f $j $k 2>> $LOGFILE || Die "Failed to copy $j to $k" 1706 cp -f $j $MINDI_TMP 2>> $LOGFILE || Die "Failed to copy $j to $MINDI_TMP" 1707 fi 1708 done 1709 echo -en "." 1710 MakeMessageFile $MINDI_TMP/usb | cut -c1-80 > $MINDI_TMP/usb/message.txt 1711 echo -en "." 1712 cp $kernelpath $MINDI_TMP/usb/vmlinuz 2>> $LOGFILE || Die "Cannot copy vmlinuz ($kernelpath) to mindi tmp ($MINDI_TMP/usb/vmlinuz). Did you run out of disk space?" 1713 echo -en "." 1714 cp $MINDI_TMP/initrd.img $MINDI_TMP/usb/initrd.img 2>> $LOGFILE 1715 echo -en "." 1716 MakeBootConfFile syslinux > $MINDI_TMP/usb/syslinux.cfg 1717 echo -en "." 1718 LogAll "----------- syslinux's conf --------------" 1719 cat $MINDI_TMP/usb/syslinux.cfg |tee -a $LOGFILE 1720 LogAll "------------------------------------------" 1721 umount $MINDI_TMP/usb 1700 fi 1701 MindiExit -1 1702 fi 1703 1704 LogAll "INFO: Moving boot info on $MINDI_TMP/mpt" 1705 mv $MINDI_TMP/target/* $MINDI_TMP/mpt 1706 if [ "$?" -ne "0" ] ; then 1707 LogFile "--------------------------------" 1708 LogFile "INFO: Size of $MINDI_TMP/mpt:" 1709 du -sk $MINDI_TMP/mpt/* >> $LOGFILE 1710 LogFile "--------------------------------" 1711 umount $MINDI_TMP/mpt 1712 LogAll "ERROR: Problems while creating boot media." 1713 LogAll " Please unload some of your modules and try again." 1714 Die " Try to increase EXTRA_SPACE in $MINDI_CONFIG" 1715 fi 1716 1717 if [ "$target" = "ISO" ]; then 1718 # ISO 1719 if [ "$ARCH" != "ia64" ] ; then 1720 CMD="$ISO_CMD $ISO_OPT -b $tbc/isolinux.bin -c $tbc/boot.cat -U -boot-load-size 4 -boot-info-table" 1721 else 1722 CMD="$ISO_CMD $ISO_OPT -b images/mindi-bootroot.img -c images/boot.cat" 1723 fi 1724 LogAll "INFO: Invoking $CMD" 1725 (cd "$MINDI_TMP/mpt" ; $CMD .) > /dev/null 2> $MINDI_TMP/mkisofs.log 1726 if [ "$?" -ne "0" ] ; then 1727 if [ "$BOOT_TYPE" = "UEFI" ]; then 1728 CMD=`echo $CMD | perl -p -e 's|--efi-boot |-eltorito-platform 0xEF -eltorito-boot |; s|-efi-boot |-eltorito-platform 0xEF -eltorito-boot |;'` 1729 (cd "$MINDI_TMP/mpt" ; $CMD .) > /dev/null 2> $MINDI_TMP/mkisofs.log 1730 if [ "$?" -eq "0" ] ; then 1731 LogAll "INFO: Created bootable ISO image at $MINDI_CACHE/mindi.iso" 1732 else 1733 MakeISOErrors 1734 fi 1735 else 1736 MakeISOErrors 1737 fi 1738 else 1739 LogAll "INFO: Created bootable ISO image at $MINDI_CACHE/mindi.iso" 1740 fi 1741 rm -f $MINDI_TMP/mkisofs.log 1742 fi 1743 1744 umount $MINDI_TMP/mpt || Die "Unable to unmount $MINDI_TMP/mpt" 1745 1746 if [ "$target" = "ISO" ]; then 1747 # ISO 1748 if [ "$BOOT_TYPE" = "BIOS" ]; then 1749 # syslinux should be run on a local file (doen't work through NFS Cf: #297) 1750 # and run after the formating for versions > 6 it seems 1751 syslinux $part >> $LOGFILE 2>> $LOGFILE 1752 fi 1753 cp $part $MINDI_CACHE 1754 else 1755 # USB 1722 1756 if [ "$ARCH" != "ia64" ] ; then 1723 1757 syslinux -v 2>&1 | grep -q 4.02 … … 1736 1770 LogIt "ERROR: Failed to create USB image." 1737 1771 else 1738 echo -e "$DONE"1739 1772 LogFile "INFO: Created bootable USB image on $USBDEVICE" 1740 1773 fi … … 1744 1777 MindiExit -1 1745 1778 fi 1779 fi 1780 } 1781 1782 1783 OfferToMakeBootableUSB() { 1784 1785 local i files 1786 1787 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1788 echo -en "\nShall I make a bootable USB device ? (y/[n]) " 1789 read i 1790 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1791 if [ "$USBDEVICE" = "" ]; then 1792 echo -en "Please enter the device name of your USB device (e.g. /dev/sda) : " 1793 read dev 1794 USBDEVICE=$dev 1795 fi 1796 echo "WARNING: This will erase all content on $USBDEVICE" 1797 echo -en "Are you sure you want to use $USBDEVICE (y/[n]) " 1798 read i 1799 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1800 else 1801 if [ "$PROMPT_MAKE_USB_IMAGE" = "no" ] && [ _"$MONDO_SHARE" = _"" ] && [ "$USBDEVICE" = "" ]; then 1802 Die "No USBDEVICE environment variable declared, aborting" 1803 fi 1804 fi 1805 USBPART="${USBDEVICE}1" 1806 1807 MakeBootableDevice USB 1808 } 1809 1810 1811 OfferToMakeBootableISO() { 1812 1813 local i files 1814 1815 if [ -z "$ISO_CMD" ]; then 1816 LogAll "ERROR: Neither mkisofs nor genisoimage nor xorriso found, unable to make CD image" 1817 return 1818 fi 1819 1820 if [ "$PROMPT_MAKE_CD_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1821 echo -en "\nShall I make a bootable CD image? (y/[n]) " 1822 read i 1823 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1824 fi 1825 1826 MakeBootableDevice ISO 1827 1746 1828 } 1747 1829 … … 1777 1859 echo -en "$BOOT_MEDIA_MESSAGE" 1778 1860 elif [ ! "$MINDI_TMP" ] ; then 1779 echo -en "FYI, this is _not_ a Mondo 1780 1781 1782 1861 echo -en "FYI, this is _not_ a MondoRescue CD.\n" 1862 if [ -e "$MINDI_LIB/memtest.img" ] ; then 1863 echo -en "Type 'memtest' <Enter> to test your PC's memory intensively.\nJust press <Enter> to go to the main test menu.\n" 1864 fi 1783 1865 else 1784 1866 echo -en "$BOOT_MEDIA_MESSAGE" … … 1918 2000 } 1919 2001 1920 PrepareBootDiskImage() {1921 # LILO originally1922 local dev imagefile fname i kernelpath cfg_file testpath options retval outstr old_pwd ooo max_kernel_size bootconf bootimage1923 kernelpath=$11924 retval=01925 1926 old_pwd=`pwd`1927 [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"1928 TurnTgzIntoRdz $MINDI_LIB/rootfs $MINDI_TMP/initrd.img `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into initrd.img; are you SURE your kernel supports loopfs?"1929 echo -en "Making "$BOOT_SIZE"KB boot disk..."1930 imagefile=$MINDI_TMP/mindi-bootroot.img1931 mkdir -p $mountpoint1932 dd if=/dev/zero of=$imagefile bs=1k count=$BOOT_SIZE &> /dev/null || Die "Cannot dd blank file"1933 echo -en "..."1934 #if [ "$BOOT_TYPE" = "UEFI" ]; then1935 # Should be GPT in that case to allow direct boot1936 #parted -s $imagefile mklabel gpt1937 #parted -s $imagefile mkpart fat32 1 ${BOOT_SIZE}k 2> /dev/null1938 #kpartx -a $imagefile1939 #imagefile2=/dev/mapper/`kpartx -l $imagefile | awk '{print $1}'`1940 #else1941 #imagefile2=$imagefile1942 #fi1943 LogFile "INFO: Creating vfat filesystem on $imagefile"1944 mkfs.vfat $imagefile >> $LOGFILE 2>> $LOGFILE1945 1946 if [ "$BOOT_TYPE" = "BIOS" ]; then1947 # syslinux should be run on a local file (doen't work through NFS Cf: #297)1948 # and run after the formating for versions > 6 it seems1949 syslinux $imagefile >> $LOGFILE 2>> $LOGFILE1950 fi1951 1952 # Only move it now to its final destination and use it now1953 mv $imagefile $MINDI_CACHE1954 imagefile=$MINDI_CACHE/mindi-bootroot.img1955 1956 mount -t vfat -o loop $imagefile $mountpoint || Die "ERROR: Cannot mount $imagefile on $mountpoint (PBDI)"1957 1958 LogFile "INFO: Copying $MINDI_TMP/initrd.img to $mountpoint/initrd.img..."1959 cp -f $MINDI_TMP/initrd.img $mountpoint/initrd.img 2>> $LOGFILE1960 if [ "$?" -ne "0" ] ; then1961 LogAll "ERROR: Failed to copy $MINDI_TMP/initrd.img to $mountpoint"1962 LogAll " Please unload some of your modules and try again."1963 LogAll "ERROR: Cannot incorporate initrd.img in bootdisk (kernel / modules too big?)"1964 LogAll " Try to increase EXTRA_SPACE and BOOT_SIZE in $MINDI_CONFIG"1965 retval=$(($retval+1))1966 fi1967 #MakeMessageFile $mountpoint | cut -c1-80 > $mountpoint/message.txt1968 1969 mkdir -p $mountpoint/tmp1970 if [ -f "$MINDI_TMP/$MRCFG" ]; then1971 cp -f $MINDI_TMP/$MRCFG $mountpoint/tmp1972 fi1973 1974 # copy the kernel across1975 [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found1976 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null1977 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`1978 1979 retval=01980 cp -f $kernelpath $mountpoint/vmlinuz > /dev/null 2>> $LOGFILE1981 retval=$?1982 if [ $KERNEL_IS_XEN = "yes" ]; then1983 cp -f $xenkernelpath $mountpoint/xenkernel &> /dev/null1984 let retval+=$?1985 fi1986 1987 if [ "$retval" -ne "0" ] ; then1988 LogFile "INFO: Files at mountpoint ($mountpoint) :"1989 du -sk $mountpoint/* >> $LOGFILE1990 LogFile "--- end of list of files ---"1991 echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n" >> $LOGFILE1992 [ "$mountpoint" != "" ] && rm -f $mountpoint/vmlinuz1993 cd "$old_pwd"1994 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"1995 rmdir $mountpoint || LogAll "ERROR: Cannot rmdir (PBDI)"1996 [ "$imagefile" != "" ] && rm -f $imagefile1997 LogIt "ERROR: Sorry, your kernel is too big for your image"1998 Die "Try to increase EXTRA_SPACE and BOOT_SIZE in $MINDI_CONFIG"1999 fi2000 max_kernel_size=$(($free_space+`du -sk $kernelpath | cut -f1`))2001 LogFile "INFO: Free space left on image = $free_space KB"2002 LogFile "INFO: Max kernel size on $BOOT_SIZE KB image (est'd) = $max_kernel_size K"2003 2004 # make it bootable2005 [ "$mountpoint" != "" ] && rm -f $mountpoint/zero2006 [ -e "$MINDI_LIB/memdisk" ] && cp -f $MINDI_LIB/memdisk $mountpoint 2>> $LOGFILE2007 2008 # copy boot stuff now generated in PrepareDataDiskImage2009 if [ "$BOOT_TYPE" = "UEFI" ]; then2010 (cd $mountpoint ; tar xfz $MINDI_CACHE/all.tar.gz ./EFI)2011 else2012 (cd $mountpoint ; tar xfz $MINDI_CACHE/all.tar.gz ./syslinux)2013 fi2014 2015 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"2016 echo -en "..."2017 rmdir $mountpoint || LogAll "ERROR: Cannot rmdir (PBDI)"2018 2019 if [ "$retval" -eq "0" ] ; then2020 echo -en "...$DONE\n"2021 LogAll "INFO: $BOOT_SIZE KB boot disks were created OK\n"2022 else2023 echo -en "...failed\n"2024 LogAll "WARNING: $BOOT_SIZE""KB boot disk was NOT created\n"2025 fi2026 [ "$retval" -ne "0" ] && LogAll "ERROR: PrepareBootDiskImage() is returning $retval"2027 return $retval2028 }2029 2030 2002 ParseModprobeForIncludes() { 2031 2003 local MODPROBE_CONF mpincfile includes include … … 2049 2021 2050 2022 PrepareDataDiskImages() { 2051 local needlist bigdir diskdir res i j k old_pwdlines lfiles includefile2023 local needlist bigdir diskdir res i j k lines lfiles includefile 2052 2024 2053 2025 rm -f $MINDI_CACHE/mindi.iso … … 2084 2056 [ -d "/mnt/.boot.d" ] && echo "GENTOO" > $bigdir/tmp/DUMBASS-GENTOO 2085 2057 DropOptimizedLibraries $needlist $bigdir 2086 echo -en "Assembling dependency files" 2087 2088 CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 2058 echo -en "INFO: Assembling dependency files" 2059 2060 CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 1 2061 echo -e "$DONE" 2089 2062 2090 2063 # also copy io.sys and msdos.sys, if we can find them … … 2109 2082 fi 2110 2083 2111 old_pwd=`pwd`2112 cd "$bigdir"2113 2114 2084 # Get terminfo content 2115 2085 ti="usr/share/terminfo/l" 2116 2086 if [ -d /$ti ]; then 2117 mkdir -p $ ti2118 cp -Rdf /$ti/* $ ti 2>> $LOGFILE || LogAll "ERROR: issue copying terminfo"2087 mkdir -p $bigdir/$ti 2088 cp -Rdf /$ti/* $bigdir/$ti 2>> $LOGFILE || LogAll "ERROR: issue copying terminfo" 2119 2089 fi 2120 2090 if [ -e "$MONDO_SHARE/restore-scripts" ]; then … … 2125 2095 cp -a /lib/dev-state ./lib/ 2>> $MINDI_TMP/$$.log || LogAll "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log 2126 2096 fi 2127 cd "$old_pwd"2128 echo -e "$DONE"2129 2097 TOTAL_BIGDIR_SIZE=`du -sk $bigdir | cut -f1` 2130 2098 MakeMountlist $MINDI_TMP/mountlist.txt … … 2147 2115 fi 2148 2116 fi 2149 LogFile " Your mountlist.txt file content is:"2117 LogFile "INFO: Your mountlist.txt file content is:" 2150 2118 LogFile "-----------------------------------" 2151 2119 cat $bigdir/tmp/mountlist.txt >> $LOGFILE … … 2206 2174 bootconf="$efidir/elilo.conf" 2207 2175 fi 2208 LogAll " Found $boottype boot type"2176 LogAll "INFO: Found $boottype boot type" 2209 2177 2210 2178 # Copy it so that CD-ROM menu entry is satisfied … … 2214 2182 mount /boot/efi 2215 2183 if [ $? -ne 0 ]; then 2216 echo " You have to mount your (U)EFI partition when using mindi"2184 echo "ERROR: You have to mount your (U)EFI partition when using mindi" 2217 2185 MindiExit -1 2218 2186 fi … … 2237 2205 if [ -e "$LDLINUXC32" ]; then 2238 2206 LogFile "INFO: Copying $LDLINUXC32 to $bootdir" 2239 cp $LDLINUXC32 $bootdir 2>> $LOGFILE || Die "Cannot copy $LDLINUXC32 to $bootdir ). Did you run out of disk space?"2207 cp $LDLINUXC32 $bootdir 2>> $LOGFILE || Die "Cannot copy $LDLINUXC32 to $bootdir. Did you run out of disk space?" 2240 2208 fi 2241 2209 fi … … 2243 2211 MakeBootConfFile $boottype > $bootconf 2244 2212 2245 echo -en " Tarring and zipping the data content..."2213 echo -en "INFO: Tarring and zipping the data content..." 2246 2214 size_of_all_tools=`du -sk $bigdir | cut -f1` 2247 2215 (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $MINDI_CACHE/all.tar.gz || LogAll "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log) … … 2252 2220 echo -e "$DONE" 2253 2221 2254 FRIENDLY_OUTSTRING="Boot and data disk images were created."2255 2222 rm -rf $bigdir 2256 2223 rm -f $needlist … … 2493 2460 2494 2461 2495 TurnTgzIntoRdz() {2496 local tgz_dir_fname rdz_fname tempfile old_pwd nodes kernelsize maxsize res currsize not_copied j k s w needed_modules_path d thelink templog2462 MakeBootInitFile() { 2463 local tgz_dir_fname rdz_fname tempfile nodes kernelsize res currsize not_copied j k s w needed_modules_path d thelink templog 2497 2464 2498 2465 tgz_dir_fname=$1 2499 2466 rdz_fname=$2 2500 2467 kernelsize=$3 2501 maxsize=$(($BOOT_SIZE-$kernelsize))2502 maxsize=$(($maxsize*2)); # to allow for compression of 50%2503 2468 tempfile=$MINDI_TMP/temp.rd 2504 2469 res=0 … … 2506 2471 > $templog 2507 2472 2508 echo -en "..." 2509 dd if=/dev/zero of=$tempfile bs=1k count=$ramdisk_size &> /dev/null || Die "Not enough room for temporary ramdisk (TurnTgzIntoRdz)" 2510 echo -en "..." 2511 LogFile "INFO: Creating ext2 filesystem on $tempfile" 2473 LogAll "INFO: Making Boot RAM Disk ($ramdisk_size KB)" 2474 dd if=/dev/zero of=$tempfile bs=1k count=$ramdisk_size &> /dev/null || Die "Not enough room for temporary ramdisk (MakeBootInitFile)" 2475 LogAll "INFO: Creating ext2 filesystem on $tempfile" 2512 2476 mke2fs -b 1024 -m 1 -i 2048 -F $tempfile >> $LOGFILE 2>> $LOGFILE || Die "Unable to create an ext2 file system on $tempfile" 2513 echo -en "..."2514 2477 mkdir -p $mountpoint 2515 2478 mount -t ext2 -o loop $tempfile $mountpoint || Die "Cannot loopmount $tempfile to $mountpoint! The reason may be missing support for loopfs or ext2 (or both) in the running kernel." 2516 echo -en "..."2517 old_pwd=`pwd`2518 cd "$mountpoint"2519 2479 2520 2480 # Check whether /lib64 or /lib or /sbin or /bin is a link and if so explicitly create one in rootfs (Fedora 17 crazyness) … … 2535 2495 2536 2496 LogFile "INFO: what is now in $mountpoint" 2537 ls -al R$mountpoint >> $LOGFILE2497 ls -al $mountpoint >> $LOGFILE 2538 2498 2539 2499 # Check files before copying to discover configuration issues or McAfee preventing mindi reading these files 2540 2500 # copy from rootfs into mountpoint 2501 LogAll "INFO: Copying Mindi files onto $mountpoint" 2541 2502 for f in $tgz_dir_fname/*; do 2542 2503 if [ ! -r $f ]; then 2543 2504 Die "ERROR: Unable to copy $f to the target dir. Check your installation or McAfee presence" 2544 2505 else 2545 cp -af $f .2>&1 >> $LOGFILE2506 cp -af $f $mountpoint 2>&1 >> $LOGFILE 2546 2507 fi 2547 2508 done 2548 (cd etc ; ln -sf bashrc profile ; ln -sf bashrc shrc ; ln -sf ../proc/mounts mtab ; ln -sf ../usr/sbin/init linuxrc) 2549 ln -sf usr/sbin/init linuxrc 2550 2551 cd dev || Die "Can't cd to dev" 2552 tar -zxf dev-entries.tgz || Die "Cannot untar dev-entries.tgz" 2553 rm -f dev-entries.tgz 2554 cd .. 2509 (cd $mountpoint/etc ; ln -sf bashrc profile ; ln -sf bashrc shrc ; ln -sf ../proc/mounts mtab ; ln -sf ../usr/sbin/init linuxrc) 2510 (cd $mountpoint ; ln -sf usr/sbin/init linuxrc) 2511 2512 (cd $mountpoint/dev ; tar -zxf dev-entries.tgz || Die "Cannot untar dev-entries.tgz" ; rm -f dev-entries.tgz) 2555 2513 2556 2514 for w in insmod.static insmod.static.old ; do 2557 2515 s=`which $w 2> /dev/null` 2558 2516 if [ -e "$s" ] ; then 2559 tar cf - -C / $s 2> /dev/null | tar xf -2517 tar cf - -C / $s 2> /dev/null | (cd $mountpoint ; tar xf -) 2560 2518 fi 2561 2519 done … … 2581 2539 fi 2582 2540 2583 # Copy of files from the minimal env needed as per the deplist.d/minimal.conf & udev.conf file (which includes all busybox deps) 2541 # Copy of files from the minimal env needed as per the deplist.d/minimal.conf (which includes all busybox deps) 2542 echo -en "INFO: Gathering dependencies of required files..." 2584 2543 rm -f $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis 2585 for f in `cat $DEPLIST_DIR/minimal.conf $DEPLIST_DIR/udev.conf | grep -vE " *#.*|^#" | sort -u` ; do 2544 lines=`cat $DEPLIST_DIR/minimal.conf | grep -vE " *#.*|^#" | sort -u` 2545 noof_lines=`echo $lines | wc -w` 2546 progress=0 2547 for f in $lines; do 2586 2548 if [ -d $f ]; then 2587 2549 for g in `find $f`; do … … 2595 2557 fi 2596 2558 fi 2559 progress=$(($progress+1)) 2560 LogProgress $progress $noof_lines 2597 2561 done 2598 LogAll "Processing all dependencies of required files..." 2599 for f in `sort -u $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis`; do 2562 echo -e "$DONE" 2563 echo -en "INFO: Processing all dependencies links..." 2564 lines=`sort -u $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis` 2565 noof_lines=`echo $lines | tr ' ' '\n' | wc -l` 2566 progress=0 2567 for f in $lines; do 2600 2568 mr-read-all-link $f >> $MINDI_TMP/minimal.lis 2569 progress=$(($progress+1)) 2570 LogProgress $progress $noof_lines 2601 2571 done 2572 echo -e "$DONE" 2602 2573 # Initial / are trucated by tar 2603 2574 finallist="" … … 2615 2586 rm -f $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis 2616 2587 2617 fnllist=`echo $finallist | sort -u` 2618 #tar cf - $finallist 2> $templog | tar xf - || LogIt "WARNING: Problem in minimal analysis" $templog 2619 echo "INFO: Copy the minimal env with cp -a --parents $finallist -t $mountpoint" 2>&1 >> $templog 2588 fnllist=`echo $finallist | tr ' ' '\n' | sort -u | tr '\n' ' '` 2589 LogFile "INFO: Copy the minimal env with cp -a --parents $fnllist -t $mountpoint" 2620 2590 cp -a --parents $fnllist -t $mountpoint 2> $templog || LogIt "WARNING: Problem in minimal analysis" $templog 2621 2591 … … 2627 2597 # For older distributions expecting /sbin/init provides it 2628 2598 if [ ! -e "sbin/init" ]; then 2629 (cd sbin ; ln -sf ../usr/sbin/init .)2599 (cd $mountpoint/sbin ; ln -sf ../usr/sbin/init .) 2630 2600 fi 2631 2601 2632 2602 # To improve support for distribution scripts, we now prefer to use bash as the std shell. Also fixes #600 2633 ln -sf /bin/bash bin/sh2603 (cd $mountpoint ; ln -sf /bin/bash bin/sh) 2634 2604 LogFile "INFO: Using bash as default shell" 2635 2605 … … 2637 2607 rm -f $mountpoint/etc/ld.so.conf.d/kernelcap* 2638 2608 2639 mkdir -p $mountpoint/tmp2640 2609 # Management of udev (which includes modprobe in rules) 2641 2610 ps auxww | grep -v grep | grep -qw udevd … … 2697 2666 fi 2698 2667 done 2699 #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2> $templog | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $templog2700 echo "INFO: Copying udev related files with cp -a --parents $finallist -t $mountpoint/" 2>&1 >> $templog2701 cp -a --parents $f inallist -t $mountpoint/ 2> $templog || LogIt "ERROR: Problem in udev.lis analysis" $templog2668 fnllist=`echo $finallist | tr ' ' '\n' | sort -u | tr '\n' ' '` 2669 LogFile "INFO: Copying udev related files with cp -a --parents $fnllist -t $mountpoint/" 2670 cp -a --parents $fnllist -t $mountpoint/ 2> $templog || LogIt "ERROR: Problem in udev.lis analysis" $templog 2702 2671 rm -f $MINDI_TMP/udev.lis 2703 2672 else … … 2713 2682 if [ -d $MINDI_CACHE/bkphw ]; then 2714 2683 LogIt "INFO: Hardware Information found and saved ..." 2715 cp -rp $MINDI_CACHE/bkphw .2684 cp -rp $MINDI_CACHE/bkphw $mountpoint 2716 2685 if [ -f $MINDI_CACHE/tools.files ]; then 2717 2686 lis=`grep -Ev '^#' $MINDI_CACHE/tools.files` 2718 2687 LocateDeps $lis > $MINDI_TMP/tools.lis 2719 tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2> $templog | tar xf -|| LogIt "ERROR: Problem in tools.lis analysis" $templog2688 tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2> $templog | (cd $mountpoint ; tar xf -) || LogIt "ERROR: Problem in tools.lis analysis" $templog 2720 2689 fi 2721 2690 if [ -f $MINDI_CACHE/mindi-rsthw ]; then 2722 mv -f $MINDI_CACHE/mindi-rsthw .2723 chmod 755 ./mindi-rsthw2691 mv -f $MINDI_CACHE/mindi-rsthw $mountpoint 2692 chmod 755 $mountpoint/mindi-rsthw 2724 2693 fi 2725 2694 rm -f $MINDI_TMP/tools.lis $MINDI_CACHE/tools.files … … 2727 2696 2728 2697 # Management of perl scripts delivered needed at restore time 2729 LogAll " Analyzing perl modules dependencies..."2698 LogAll "INFO: Analyzing perl modules dependencies..." 2730 2699 mindi-get-perl-modules `cat $MINDI_CONF/perl-scripts` /usr/[s]*bin/mr-* 2> $templog > $MINDI_TMP/perl.lis || LogIt "ERROR: Problem in mindi-get-perl-modules" $templog 2731 2700 LogFile "DBG4: Perl Modules found:" … … 2733 2702 cat $MINDI_TMP/perl.lis >> $LOGFILE 2734 2703 LogFile "-------------------------" 2735 tar cf - `cat $MINDI_TMP/perl.lis` 2> $templog | tar xf -|| LogIt "ERROR: Problem in perl scripts analysis" $templog2704 tar cf - `cat $MINDI_TMP/perl.lis` 2> $templog | (cd $mountpoint ; tar xf -) || LogIt "ERROR: Problem in perl scripts analysis" $templog 2736 2705 2737 2706 for w in cdrom groovy-stuff ; do … … 2739 2708 done 2740 2709 2741 tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2> $templog | tar xf - || LogIt "ERROR: Problem in fd dev analysis" $templog 2742 2743 echo -en "..." 2744 cd / 2710 tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2> $templog | (cd $mountpoint ; tar xf -) || LogIt "ERROR: Problem in fd dev analysis" $templog 2745 2711 2746 2712 needed_modules="" … … 2764 2730 fi 2765 2731 2766 [ -e " $needed_modules_path" ] || LogIt "WARNING: path $needed_modules_path does not exist.\n If you're not using a modular kernel then mindi won't probably work."2767 LogAll " Analyzing kernel modules dependencies..."2732 [ -e "/$needed_modules_path" ] || LogIt "WARNING: path $needed_modules_path does not exist.\n If you're not using a modular kernel then mindi won't probably work." 2733 LogAll "INFO: Analyzing kernel modules dependencies..." 2768 2734 needed_modules=`mr-kernel-get-modules $mkgmopt $list_of_groovy_mods` 2769 2735 … … 2820 2786 lis="/usr/bin/sg_map /usr/bin/sg_inq /usr/bin/sg_reset /usr/bin/rev" 2821 2787 LocateDeps $lis > $MINDI_TMP/obdr.lis 2822 (cd $mountpoint ; tar cf - $lis -C / `sort -u $MINDI_TMP/obdr.lis` 2> $templog | tar xf - || LogIt "ERROR: Problem in obdr.lis analysis" $templog)2788 tar cf - $lis -C / `sort -u $MINDI_TMP/obdr.lis` 2> $templog | (cd $mountpoint ; tar xf -) || LogIt "ERROR: Problem in obdr.lis analysis" $templog 2823 2789 LogIt "INFO: Copying /usr/bin/sg_reset to ramdisk for improved SCSI OBDR support" 2824 2790 found=1 … … 2835 2801 rm -f $mountpoint/sbin/devfsd 2836 2802 fi 2837 cd "$old_pwd"2838 2803 [ "$TAPEDEV" ] && echo -en "$TAPEDEV" > $mountpoint/tmp/TAPEDEV-LIVES-HERE 2839 2804 if [ _"$MONDO_SHARE" != _"" ]; then … … 2850 2815 echo $m >> $mountpoint/tmp/modules 2851 2816 done 2852 2853 # copy boot stuff now generated in PrepareDataDiskImage2854 if [ "$BOOT_TYPE" = "UEFI" ]; then2855 (cd $mountpoint ; tar xfz $MINDI_CACHE/all.tar.gz ./EFI)2856 else2857 (cd $mountpoint ; tar xfz $MINDI_CACHE/all.tar.gz ./syslinux)2858 fi2859 2817 2860 2818 mkdir -p $mountpoint/proc … … 2877 2835 LogFile "INFO: Creating an $gvFileSystem initrd image..." 2878 2836 # kernel expects linuxrc in ext2 filesystem 2879 ( cd "$mountpoint" && ln -sf usr/sbin/init linuxrc)2837 (cd "$mountpoint" && ln -sf usr/sbin/init linuxrc) 2880 2838 # unmount loop filesystem and create image file using the standard approach 2881 2839 umount $mountpoint || Die "Cannot unmount $tempfile" 2882 dd if=$tempfile bs=1k 2> /dev/null > ${rdz_fname}.tmp2> /dev/null2840 dd if=$tempfile bs=1k of=${rdz_fname}.tmp > /dev/null 2> /dev/null 2883 2841 if [ "$gvFileSystem" = "ext4fs" ] && [ -x "/sbin/tune4fs" ]; then 2884 2842 bs=`/sbin/tune4fs -l ${rdz_fname}.tmp | grep -E '^Block size:' | cut -d: -f2 | sed 's/^ *//'` … … 2890 2848 rm -f ${rdz_fname}.tmp 2891 2849 # log that we are done 2892 LogFile " ...done."2893 2850 elif [ "$gvFileSystem" = "initramfs" ]; then 2894 2851 # say what will be used … … 2896 2853 # make sure that cpio is there 2897 2854 which cpio &> /dev/null; [ $? -eq 0 ] || Die "cpio not found. Please install package cpio and try again." 2898 # go into filesystem2899 cd "$mountpoint"2900 2855 # kernel expects init in cpio filesystem 2901 ln -sf usr/sbin/init init2856 (cd "$mountpoint" ; ln -sf usr/sbin/init init) 2902 2857 # create cpio image file and unmount loop filesystem 2903 find . -print | cpio -o -H newc | gzip -9 > $rdz_fname 2> /dev/null 2904 cd "$old_pwd" 2858 (cd "$mountpoint" ; find . -print | cpio -o -H newc | gzip -9 > $rdz_fname 2> /dev/null) 2905 2859 umount $mountpoint || Die "Cannot unmount $tempfile" 2906 2860 # log that we are done 2907 LogFile " ...done."2908 2861 else 2909 2862 Die "Filesystem $gvFileSystem not supported for initrd image. Terminating." … … 2911 2864 2912 2865 if [ "$res" -eq "0" ] ; then 2913 echo -en " ..."2866 echo -en "\rINFO: MakeBootInitFile finished without error. \n" 2914 2867 else 2915 echo -en "\r Made an rdzWITH ERRORS. \n"2868 echo -en "\rWARNING: MakeBootInitFile exits WITH ERRORS. \n" 2916 2869 fi 2917 2870 return 0 … … 2979 2932 LogFile "--------" 2980 2933 LogFile "EXTRA_SPACE = $EXTRA_SPACE" 2981 LogFile "BOOT_SIZE = $BOOT_SIZE"2982 2934 LogFile "--------" 2983 2935 … … 3197 3149 LogFile "WARNING: - Disable the scanner during the backup" 3198 3150 fi 3199 3200 FLOPPY_WAS_MOUNTED=""3201 for mtpt in /media/floppy /mnt/floppy /floppy ; do3202 if mount | grep -w $mtpt &> /dev/null ; then3203 FLOPPY_WAS_MOUNTED="$FLOPPY_WAS_MOUNTED $mtpt"3204 umount $mtpt3205 fi3206 done3207 3151 3208 3152 # … … 3409 3353 if [ "$kernelpath" = "" ] ; then 3410 3354 [ _"$MONDO_SHARE" != _"" ] && Die "Please use -k <path> to specify kernel." 3411 echo -en " Do you want to use your own kernel to build the boot disk ([y]/n) ?"3355 echo -en "\nDo you want to use your own kernel to build the boot disk ([y]/n) ?" 3412 3356 read ch 3413 3357 if [ "$ch" != "n" ] && [ "$ch" != "N" ] ; then … … 3432 3376 3433 3377 export ramdisk_size=$(($size_of_all_tools+$EXTRA_SPACE)) 3434 3435 3378 LogFile "INFO: Ramdisk will be $ramdisk_size KB" 3436 PrepareBootDiskImage $kernelpath || Die "Failed to create boot disk image." 3379 3380 MakeBootInitFile $MINDI_LIB/rootfs $MINDI_TMP/initrd.img `du -sk $kernelpath | cut -f1` || Die "Could not create initrd.img" 3437 3381 3438 3382 [ -e "$MINDI_LIB/memtest.img" ] && BOOT_MEDIA_MESSAGE="$BOOT_MEDIA_MESSAGE\n\ … … 3440 3384 3441 3385 if [ _"$MONDO_SHARE" = _"" ]; then 3442 ListImagesForUser3443 3386 OfferToMakeBootableISO 3444 3387 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then 3445 3388 OfferToMakeBootableUSB 3446 3389 fi 3447 LogAll " Finished."3390 LogAll "INFO: Mindi Finished" 3448 3391 elif [ "$TAPEDEV" ] ; then 3449 3392 if [ "$ARCH" != "ia64" ] ; then … … 3479 3422 fi 3480 3423 # cleanup 3481 LogAll "INFO: $FRIENDLY_OUTSTRING"3482 for mtpt in $FLOPPY_WAS_MOUNTED ; do3483 mount $mtpt3484 done3485 3424 MindiExit 0 -
branches/3.2/mindi/mindi.conf
r3521 r3522 11 11 # 12 12 # EXTRA_SPACE=80152 # increase if you run out of ramdisk space 13 # BOOT_SIZE=32768 # size of the boot disk14 13 # MINDI_ADDITIONAL_BOOT_PARAMS="devfs=nomount noresume selinux=0 barrier=off udevtimeout=10 acpi=off" 15 14 # MINDI_DEFAULT_BOOT_OPTION="interactive ipconf=eth0:10.0.0.1:255.0.0.0:10.255.255.255:10.2.3.4"
Note:
See TracChangeset
for help on using the changeset viewer.