Changeset 3403 in MondoRescue
- Timestamp:
- Aug 5, 2015, 8:39:46 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi/mindi
r3402 r3403 113 113 ISO_OPT="-J -r -v -p Mindi -publisher http://www.mondorescue.org -A Mindi" 114 114 115 # Mindi should master this in fact 116 #BOOT_TYPE="BIOS" 117 115 118 # Mandriva system e.g. use cdrkit, which uses genisoimage instead of mkisofs. 116 119 # However, they use exactly the same command line parameters, so just … … 135 138 echo -e "$1" >> $LOGFILE 136 139 if [ _"$2" != _"" ]; then 137 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE140 grep -Ev "tar: Removing [a-z ]*\`/\'" "$2" >> $LOGFILE 138 141 fi 139 142 rm -f "$2" … … 185 188 fi 186 189 if [ _"$2" != _"" ]; then 187 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE190 grep -Ev "tar: Removing [a-z ]*\`/\'" "$2" >> $LOGFILE 188 191 fi 189 192 rm -f "$2" … … 274 277 275 278 CopyDependenciesToDirectory() { 276 local outdir incoming counter d found tdir 279 local outdir incoming counter d found tdir templog 277 280 outdir=$1 281 templog=$MINDI_TMP/$$.log 278 282 mkdir -p $outdir 279 283 incoming=`ReadLine` 280 284 counter=0 285 > $templog 286 281 287 while [ "$incoming" != "" ] ; do 282 288 # Non absolute file names should not arrive till here => skipped … … 297 303 elif [ -e "$incoming" ] && [ $found = "false" ]; then 298 304 if [ ! -h "$incoming" ]; then 299 tar cf - -C / $incoming 2>> $ MINDI_TMP/$$.log | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $MINDI_TMP/$$.log305 tar cf - -C / $incoming 2>> $templog | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $templog 300 306 else 301 307 tdir=`dirname "$incoming"` … … 1427 1433 1428 1434 OfferToMakeBootableISO() { 1429 local i old_pwd 1435 local i old_pwd files 1430 1436 if [ -z "$ISO_CMD" ]; then 1431 1437 LogAll "ERROR: Neither mkisofs nor genisoimage found, unable to make CD image" … … 1440 1446 mkdir -p $MINDI_TMP/iso/{images,archives} 1441 1447 LogFile "INFO: mindi_lib = $MINDI_LIB" 1442 cp -f $MINDI_CACHE/{*.gz,*.img} $MINDI_TMP/iso/images 2>> $LOGFILE || LogAll "WARNING: OfferToMakeBootableISO: Cannot copy $MINDI_CACHE/*.gz to $MINDI_TMP/iso/images" 1448 files=`ls $MINDI_CACHE/{*.gz,*.img}` 1449 cp -f $files $MINDI_TMP/iso/images 2>> $LOGFILE || LogAll "WARNING: OfferToMakeBootableISO: Cannot copy files to $MINDI_TMP/iso/images" 1443 1450 for i in memdisk memtest.bin memtest.img ; do 1444 1451 j=$MINDI_LIB/$i … … 1513 1520 1514 1521 OfferToMakeBootableUSB() { 1515 local i 1522 local i files 1516 1523 if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then 1517 1524 echo -n "Shall I make a bootable USB device ? (y/[n]) " … … 1546 1553 LogFile "INFO: Unmounting $USBPART just in case" 1547 1554 umount $USBPART 2>> $LOGFILE 1>> $LOGFILE 1548 # If your key has no MBR it may cause an issue 1549 # Use dd if=mbr.bin of=$USBDEVICE or ms-sys -s $USBDEVICE 1550 if [ -r $MBRFILE ]; then 1551 LogAll "INFO: Installing an MBR ($MBRFILE) on $USBDEVICE" 1552 dd if=$MBRFILE of=$USBDEVICE 1553 else 1554 LogAll "WARNING: You may need to install an MBR (usually in $MBRFILE, but not found on your system)" 1555 LogAll " on $USBDEVICE with dd if=$MBRFILE of=$USBDEVICE" 1555 if [ $BOOT_TYPE = "BIOS" ]; then 1556 # If your key has no MBR it may cause an issue 1557 # Use dd if=mbr.bin of=$USBDEVICE or ms-sys -s $USBDEVICE 1558 if [ -r $MBRFILE ]; then 1559 LogAll "INFO: Installing an MBR ($MBRFILE) on $USBDEVICE" 1560 dd if=$MBRFILE of=$USBDEVICE 1561 else 1562 LogAll "WARNING: You may need to install an MBR (usually in $MBRFILE, but not found on your system)" 1563 LogAll " on $USBDEVICE with dd if=$MBRFILE of=$USBDEVICE" 1564 fi 1556 1565 fi 1557 1566 LogFile "INFO: Preparing $USBDEVICE" … … 1624 1633 echo -en "." 1625 1634 mkdir -p $MINDI_TMP/usb/images 1626 cp -f $MINDI_CACHE/*.img $MINDI_CACHE/*.gz $MINDI_TMP/usb/images 2>> $LOGFILE || LogAll "ERROR: OfferToMakeBootableUSB: Cannot copy $i to $MINDI_TMP/usb/images" 1635 files=`ls $MINDI_CACHE/{*.gz,*.img}` 1636 cp -f $files $MINDI_TMP/usb/images 2>> $LOGFILE || LogAll "ERROR: OfferToMakeBootableUSB: Cannot copy files to $MINDI_TMP/usb/images" 1627 1637 echo -en "." 1628 1638 LogFile "INFO: mindi_lib = $MINDI_LIB" … … 1916 1926 if [ "$?" -ne "0" ] ; then 1917 1927 LogAll "ERROR: Failed to copy $MINDI_TMP/initrd.img to $mountpoint" 1918 cat $MINDI_TMP/mtpt.$$ >> $LOGFILE1919 1928 LogAll " Please unload some of your modules and try again." 1920 rm -f $MINDI_TMP/mtpt.$$1921 1929 LogAll "ERROR: Cannot incorporate initrd.img in bootdisk (kernel / modules too big?)" 1922 1930 LogAll " Try to increase EXTRA_SPACE and BOOT_SIZE in $MINDI_CONFIG" … … 2051 2059 # master boot record, too 2052 2060 i=`cat $MINDI_TMP/BOOTLOADER.DEVICE 2> /dev/null` 2053 if [ "$i" ] ; then2061 if [ "$i" ] && [ "$BOOT_TYPE" = "BIOS" ]; then 2054 2062 LogAll "INFO: Backing up $i's MBR" 2055 2063 dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE … … 2366 2374 2367 2375 TurnTgzIntoRdz() { 2368 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 2376 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 templog 2369 2377 2370 2378 tgz_dir_fname=$1 … … 2374 2382 maxsize=$(($maxsize*2)); # to allow for compression of 50% 2375 2383 tempfile=$MINDI_TMP/temp.rd 2376 res=0 2384 res=0 2385 templog=$MINDI_TMP/$$.log 2386 > $templog 2387 2377 2388 echo -en "..." 2378 2389 dd if=/dev/zero of=$tempfile bs=1k count=$ramdisk_size &> /dev/null || Die "Not enough room for temporary ramdisk (TurnTgzIntoRdz)" … … 2483 2494 rm -f $MINDI_TMP/minimal.lis $MINDI_TMP/minimal2.lis 2484 2495 2485 #tar cf - $finallist 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log2486 echo "INFO: Copy the minimal env with cp -a --parents $finallist -t $mountpoint" 2>&1 >> $ MINDI_TMP/$$.log2487 cp -a --parents $finallist -t $mountpoint 2>> $ MINDI_TMP/$$.log || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log2496 #tar cf - $finallist 2>> $templog | tar xf - || LogIt "WARNING: Problem in minimal analysis" $templog 2497 echo "INFO: Copy the minimal env with cp -a --parents $finallist -t $mountpoint" 2>&1 >> $templog 2498 cp -a --parents $finallist -t $mountpoint 2>> $templog || LogIt "WARNING: Problem in minimal analysis" $templog 2488 2499 2489 2500 # In case target /bin dir still doesn't exist, create it before using it … … 2510 2521 echo "udev device manager found" > $mountpoint/tmp/USE-UDEV 2511 2522 LogIt "INFO: udev device manager found" 2512 tar cf - -C / /etc/udev 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in /etc/udev analysis" $MINDI_TMP/$$.log2523 tar cf - -C / /etc/udev 2>> $templog | tar xf - || LogIt "ERROR: Problem in /etc/udev analysis" $templog 2513 2524 # This avoids NIC remapping if on another machine at restore time on Debian/Ubuntu at least 2514 2525 rm -f ./etc/udev/rules.d/[z]*[0-9][0-9][-_]persistent-net.rules 2515 2526 # Do not do it if it's a link (Ubuntu 64 bits #503) 2516 2527 if [ -e "/lib64/udev" ] && [ ! -h "/lib64" ] && [ ! -h "/lib64/udev" ]; then 2517 tar cf - -C / /lib64/udev 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in /lib64/udev analysis" $MINDI_TMP/$$.log2528 tar cf - -C / /lib64/udev 2>> $templog | tar xf - || LogIt "ERROR: Problem in /lib64/udev analysis" $templog 2518 2529 fi 2519 2530 if [ -e "/lib32/udev" ] && [ ! -h "/lib32" ] && [ ! -h "/lib32/udev" ]; then 2520 tar cf - -C / /lib32/udev 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in /lib32/udev analysis" $MINDI_TMP/$$.log2531 tar cf - -C / /lib32/udev 2>> $templog | tar xf - || LogIt "ERROR: Problem in /lib32/udev analysis" $templog 2521 2532 fi 2522 2533 if [ -e "/lib/udev" ] && [ ! -h "/lib" ] && [ ! -h "/lib/udev" ]; then 2523 tar cf - -C / /lib/udev 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in /lib/udev analysis" $MINDI_TMP/$$.log2534 tar cf - -C / /lib/udev 2>> $templog | tar xf - || LogIt "ERROR: Problem in /lib/udev analysis" $templog 2524 2535 fi 2525 2536 if [ -e "/usr/lib/udev" ] && [ ! -h "/usr/lib" ] && [ ! -h "/usr/lib/udev" ]; then 2526 tar cf - -C / /usr/lib/udev 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in /usr/lib/udev analysis" $MINDI_TMP/$$.log2537 tar cf - -C / /usr/lib/udev 2>> $templog | tar xf - || LogIt "ERROR: Problem in /usr/lib/udev analysis" $templog 2527 2538 fi 2528 2539 if [ -x /sbin/udevd ] || [ -x /usr/bin/udevd ] || [ -x /usr/lib/systemd/systemd-udevd ]; then … … 2564 2575 fi 2565 2576 done 2566 #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $MINDI_TMP/$$.log2567 echo "INFO: Copying udev related files with cp -a --parents $finallist -t $mountpoint/" 2>&1 >> $ MINDI_TMP/$$.log2568 cp -a --parents $finallist -t $mountpoint/ 2>> $ MINDI_TMP/$$.log || LogIt "ERROR: Problem in udev.lis analysis" $MINDI_TMP/$$.log2577 #tar cf - -C / $lis `sort -u $MINDI_TMP/udev.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in udev.lis analysis" $templog 2578 echo "INFO: Copying udev related files with cp -a --parents $finallist -t $mountpoint/" 2>&1 >> $templog 2579 cp -a --parents $finallist -t $mountpoint/ 2>> $templog || LogIt "ERROR: Problem in udev.lis analysis" $templog 2569 2580 rm -f $MINDI_TMP/udev.lis 2570 2581 else … … 2584 2595 lis=`grep -Ev '^#' $MINDI_CACHE/tools.files` 2585 2596 LocateDeps $lis > $MINDI_TMP/tools.lis 2586 tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in tools.lis analysis" $MINDI_TMP/$$.log2597 tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in tools.lis analysis" $templog 2587 2598 fi 2588 2599 if [ -f $MINDI_CACHE/mindi-rsthw ]; then … … 2594 2605 2595 2606 # Management of perl scripts delivered needed at restore time 2596 LogIt "INFO: Analyzing perl modules dependencies" $MINDI_TMP/$$.log2597 mindi-get-perl-modules `cat $MINDI_CONF/perl-scripts` /usr/[s]*bin/mr-* 2>> $ MINDI_TMP/$$.log > $MINDI_TMP/perl.lis2598 LogIt "DBG4: Perl Modules found:" $MINDI_TMP/$$.log2599 LogIt "-------------------------" $MINDI_TMP/$$.log2600 cat $MINDI_TMP/perl.lis >> $ MINDI_TMP/$$.log2601 LogIt "-------------------------" $MINDI_TMP/$$.log2602 tar cf - `cat $MINDI_TMP/perl.lis` 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in perl scripts analysis" $MINDI_TMP/$$.log2607 LogIt "INFO: Analyzing perl modules dependencies" 2608 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 2609 LogIt "DBG4: Perl Modules found:" 2610 LogIt "-------------------------" 2611 cat $MINDI_TMP/perl.lis >> $LOGFILE 2612 LogIt "-------------------------" 2613 tar cf - `cat $MINDI_TMP/perl.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in perl scripts analysis" $templog 2603 2614 2604 2615 for w in cdrom groovy-stuff ; do … … 2606 2617 done 2607 2618 2608 tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in fd dev analysis" $MINDI_TMP/$$.log2619 tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2>> $templog | tar xf - || LogIt "ERROR: Problem in fd dev analysis" $templog 2609 2620 2610 2621 echo -en "..." … … 2635 2646 2636 2647 LogFile "INFO: Adding $needed_modules to the rootfs with $mkgmopt" 2637 cp --parents -aL $needed_modules $mountpoint/ 2>> $ MINDI_TMP/$$.log || LogIt "ERROR: Unable to copy modules to $mountpoint" $MINDI_TMP/$$.log2648 cp --parents -aL $needed_modules $mountpoint/ 2>> $templog || LogIt "ERROR: Unable to copy modules to $mountpoint" $templog 2638 2649 2639 2650 # Uncompress modules if not using udev and native modprobe … … 2654 2665 2655 2666 # Also copy modules.* in case of udev so that normal modprobe works 2656 tar cf - -C / /$needed_modules_path/modules.* 2>> $ MINDI_TMP/$$.log | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy modules.* to $mountpoint" $MINDI_TMP/$$.log2667 tar cf - -C / /$needed_modules_path/modules.* 2>> $templog | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy modules.* to $mountpoint" $templog 2657 2668 2658 2669 # Copy FW in case some drivers needs it … … 2686 2697 lis="/usr/bin/sg_map /usr/bin/sg_inq /usr/bin/sg_reset /usr/bin/rev" 2687 2698 LocateDeps $lis > $MINDI_TMP/obdr.lis 2688 (cd $mountpoint ; tar cf - $lis -C / `sort -u $MINDI_TMP/obdr.lis` 2>> $ MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in obdr.lis analysis" $MINDI_TMP/$$.log)2699 (cd $mountpoint ; tar cf - $lis -C / `sort -u $MINDI_TMP/obdr.lis` 2>> $templog | tar xf - || LogIt "ERROR: Problem in obdr.lis analysis" $templog) 2689 2700 LogIt "INFO: Copying /usr/bin/sg_reset to ramdisk for improved SCSI OBDR support" 2690 2701 found=1
Note:
See TracChangeset
for help on using the changeset viewer.