Changeset 3149 in MondoRescue
- Timestamp:
- Jun 19, 2013, 8:59:05 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mindi/mindi
r3146 r3149 34 34 MINDI_SBIN=${MINDI_PREFIX}/sbin 35 35 MINDI_LIB=LLL 36 MINDI_CACHE=/var/cache/mindi 36 37 37 38 # Temporary directory for mindi … … 85 86 86 87 LOGFILE=/var/log/mindi.log 87 MINDI_CACHE=/var/cache/mindi88 88 BOOT_MEDIA_MESSAGE="\ 89 89 To format and restore all files automatically, type 'nuke' <enter>.\n\ … … 156 156 # Should be declared here as used immediately below potentialy 157 157 MindiExit() { 158 echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE159 echo "End date : `date`" >> $LOGFILE158 LogFile "Mindi $MINDI_VERSION is exiting" 159 LogFile "End date : `date`" 160 160 if [ _"$MONDO_SHARE" != _"" ] ; then 161 161 echo "------------- mindi logfile included -------------------------" >> /var/log/mondoarchive.log … … 181 181 local i 182 182 if [ "$1" = "" ] ; then 183 Log It"FATAL ERROR"184 else 185 Log It"FATAL ERROR. $1"183 LogAll "FATAL ERROR" 184 else 185 LogAll "FATAL ERROR. $1" 186 186 fi 187 187 if [ _"$2" != _"" ]; then … … 190 190 rm -f "$2" 191 191 192 Log It"Please e-mail a copy of $LOGFILE to the mailing list."193 Log It"See http://www.mondorescue.org for more information."194 Log It"WE CANNOT HELP unless you enclose that file.\n"192 LogAll "Please e-mail a copy of $LOGFILE to the mailing list." 193 LogAll "See http://www.mondorescue.org for more information." 194 LogAll "WE CANNOT HELP unless you enclose that file.\n" 195 195 MindiExit -1 196 196 } … … 238 238 [ "$KBDEPTH" -gt "128" ] && Die "Edit $MINDI_SBIN/mindi and disable FindAndAddUserKeyboardMappingFile (line 2160, approx.)" 239 239 if [ -e "$bigdir/$mappath" ] ; then 240 LogFile "INFO: $mappath already added" >> $LOGFILE240 LogFile "INFO: $mappath already added" 241 241 return 242 242 elif [ -d "$bigdir/$mappath" ] ; then … … 244 244 return 245 245 fi 246 LogFile "INFO: Added kbd map $mappath" >> $LOGFILE246 LogFile "INFO: Added kbd map $mappath" 247 247 if [ ! -e "$mappath" ] ; then 248 248 mappath=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"` 249 249 if [ ! -e "$mappath" ] ; then 250 Log It"WARNING: Cannot add $mappath: kbd map file not found"250 LogAll "WARNING: Cannot add $mappath: kbd map file not found" 251 251 return 252 252 fi … … 255 255 fi 256 256 257 # TODO: Why that 257 258 mkdir -p $bigdir/etc 258 tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || Log It"WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log259 tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogAll "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log 259 260 if [ "`echo $mappath | grep -F ".gz"`" ] ; then 260 261 included_list=`gzip -dc $mappath | grep -Fi include | sed s/'"'//g | cut -d' ' -f2` … … 264 265 for included_item in $included_list ; do 265 266 if [ ! -e "$included_item" ] ; then 266 267 sss=`grep -F "${included_item}.inc" $MINDI_TMP/keymaps.find` 267 268 [ "$sss" = "" ] && sss=`grep -F "$included_item" $MINDI_TMP/keymaps.find` 268 269 for ii in $sss ; do … … 285 286 # Non absolute file names should not arrive till here => skipped 286 287 if [ `echo "$incoming" | cut -c1` != '/' ]; then 287 Log It"WARNING: Unable to handle $incoming"288 LogAll "WARNING: Unable to handle $incoming" 288 289 incoming=`ReadLine` 289 290 continue … … 297 298 done 298 299 if [ -d "$incoming" ]; then 299 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 300 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 300 301 elif [ -e "$incoming" ] && [ $found = "false" ]; then 301 302 if [ ! -h "$incoming" ]; then … … 310 311 # Only uncompress modules if not using udevd 311 312 if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then 312 gunzip -f $outdir/$incoming || Log It"WARNING: Cannot gunzip $outdir/$incoming"313 gunzip -f $outdir/$incoming || LogAll "WARNING: Cannot gunzip $outdir/$incoming" 313 314 fi 314 315 [ -x "$outdir" ] && StripExecutable $outdir 315 316 counter=$(($counter+1)) 316 if [ "$counter" -ge "5" ] ; then 317 counter=0 318 echo -en "." 319 fi 317 LogProgress $counter $2 320 318 fi 321 319 incoming=`ReadLine` … … 357 355 LogFile "INFO: Adding as deps $resolved to filelist" 358 356 vanilla_resolved_name=`echo "$resolved" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'` 359 mkdir -p $outdir$resolved> /dev/null 2> /dev/null 360 rmdir $outdir$resolved > /dev/null 2> /dev/null 361 ln -sf $vanilla_resolved_name $outdir$resolved 362 LogFile "INFO: Excluding deps $resolved" 363 grep -Fvx "$resolved" "$filelist" > $filelist.tmp 364 LogFile "INFO: Replacing it with $vanilla_resolved_name" 365 echo "$vanilla_resolved_name" >> $filelist.tmp 366 mv -f $filelist.tmp $filelist 357 if [ "$vanilla_resolved_name" != "$resolved" ]; then 358 mkdir -p $outdir$resolved> /dev/null 2> /dev/null 359 rmdir $outdir$resolved > /dev/null 2> /dev/null 360 ln -sf $vanilla_resolved_name $outdir$resolved 361 LogFile "INFO: Excluding deps $resolved" 362 grep -Fvx "$resolved" "$filelist" > $filelist.tmp 363 LogFile "INFO: Replacing it with $vanilla_resolved_name" 364 echo "$vanilla_resolved_name" >> $filelist.tmp 365 mv -f $filelist.tmp $filelist 366 fi 367 367 done 368 368 done … … 375 375 FindAndAddUserKeyboardMappingFile() { 376 376 local r res mapfile mappath included_item included_list keyfile mp locale 377 Log It"INFO: Analyzing your keyboard's configuration."377 LogAll "INFO: Analyzing your keyboard's configuration." 378 378 KEYDIR=/lib/kbd 379 379 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share/kbd # Slackware … … 383 383 [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole-setup 384 384 if [ ! -e "$KEYDIR" ] ; then 385 Log It"WARNING: Keyboard mapping directory not found. I shall use default map at boot-time."385 LogAll "WARNING: Keyboard mapping directory not found. I shall use default map at boot-time." 386 386 return 0 387 387 fi … … 397 397 elif [ -e "/etc/console/boottime.kmap.gz" ] ; then 398 398 LogFile "INFO: Debian-style config detected." 399 echo -en "INFO: Adding the following keyboard mapping tables: "400 399 mkdir -p $bigdir/tmp 401 400 echo "/etc/console/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE … … 408 407 elif [ -e "/etc/console-setup/boottime.kmap.gz" ] || [ -e "/etc/console-setup/cached.kmap.gz" ] ; then 409 408 LogFile "INFO: Ubuntu-style config detected." 410 echo -en "INFO: Adding the following keyboard mapping tables: "411 409 mkdir -p $bigdir/tmp 412 410 if [ -e "/etc/console-setup/boottime.kmap.gz" ] ; then … … 429 427 keyfile=/etc/conf.d/keymaps 430 428 else 431 echo -en"Searching for rc.config ..."429 LogFile "Searching for rc.config ..." 432 430 keyfile=`find /etc -name rc.config | head -n1` 433 431 if [ "$keyfile" = "" ] || [ ! -e "$keyfile" ] ; then 434 Log It"WARNING: Unknown config detected. Default keyboard map will be used."432 LogAll "WARNING: Unknown config detected. Default keyboard map will be used." 435 433 return 436 434 else … … 439 437 fi 440 438 if [ ! -e "$KEYDIR/keymaps" ] ; then 441 Log It"WARNING: Keyboard mapping directory not found. Default keyboard map will be used."439 LogAll "WARNING: Keyboard mapping directory not found. Default keyboard map will be used." 442 440 return 443 441 fi … … 456 454 [ ! "$mp" ] && mp=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"` 457 455 # If we have multiple keymaps then log it !! 458 echo "$mp" | grep -q " " 456 echo "$mp" | grep -q " " >> $LOGFILE 459 457 if [ $? -eq 0 ]; then 460 458 LogAll "WARNING: Multiple keymaps found: $mp" … … 470 468 LogFile "INFO: mappath = $mappath" 471 469 if [ ! -e "$mappath" ] || [ -d "$mappath" ] ; then 472 Log It"WARNING: Keyboard mapping file not found. Default keyboard map will be used."470 LogAll "WARNING: Keyboard mapping file not found. Default keyboard map will be used." 473 471 return 474 472 fi 475 echo -en"INFO: Adding the following keyboard mapping tables: "473 LogAll "INFO: Adding the following keyboard mapping tables: " 476 474 mkdir -p $bigdir/tmp 477 475 echo "$mappath" > $bigdir/tmp/KEYMAP-LIVES-HERE … … 519 517 fi 520 518 if [ ! -e "$1" ] ; then 521 Log It"WARNING: cannot search specific path '$1'"519 LogAll "WARNING: cannot search specific path '$1'" 522 520 return 1 523 521 fi 524 522 # Find all files and links (required for some VMWare VMs) 525 modpaths=`find $1-name $2.*o -o -name $2.o.gz -o -name $2.ko.gz -o -name $2.ko.xz -o -name $2 -type f -o -type l`523 modpaths=`find "$1" -name $2.*o -o -name $2.o.gz -o -name $2.ko.gz -o -name $2.ko.xz -o -name $2 -type f -o -type l` 526 524 echo "$modpaths" 527 525 cd "$pwd" … … 551 549 filelist=`GenerateListForFile "$incoming"` 552 550 r=$? 553 [ "$r" -ne "0" ] && Log It"WARNING: $incoming not found"551 [ "$r" -ne "0" ] && LogAll "WARNING: $incoming not found" 554 552 res=$(($res+$r)) 555 553 # LogFile "INFO: '$incoming' generates filelist '$filelist'" … … 558 556 done 559 557 progress=$(($progress+1)) 560 echo -en "\r\t\t\t\t\t\t\t\t" 561 i=$(($progress*100)) 562 i=$(($i/$noof_lines)) 563 echo -en "$i" 564 echo -en "%" 565 modres=$(($progress%4)) 566 [ "$modres" -eq "0" ] && echo -en "\t/" 567 [ "$modres" -eq "1" ] && echo -en "\t-" 568 [ "$modres" -eq "2" ] && echo -en "\t\\" 569 [ "$modres" -eq "3" ] && echo -en "\t|" 558 LogProgress $progress $noof_lines 570 559 incoming=`ReadLine` 571 560 done … … 618 607 done 619 608 progress=$(($progress+1)) 620 echo -en "\r\t\t\t\t\t\t\t\t" 621 i=$(($progress*100)) 622 i=$(($i/$noof_lines)) 623 echo -en "$i" 624 echo -en "%" 625 modres=$(($progress%4)) 626 [ "$modres" -eq "0" ] && echo -en "\t/" 627 [ "$modres" -eq "1" ] && echo -en "\t-" 628 [ "$modres" -eq "2" ] && echo -en "\t\\" 629 [ "$modres" -eq "3" ] && echo -en "\t|" 609 LogProgress $progress $noof_lines 630 610 incoming=`ReadLine` 631 611 done … … 645 625 LocateDeps $fname | tee -a $LOGFILE >> $outfile.pre 646 626 progress=$(($progress+1)) 647 echo -en "\r\t\t\t\t\t\t\t\t" 648 i=$(($progress*100)) 649 i=$(($i/$noof_lines)) 650 echo -en "$i" 651 echo -en "%" 652 modres=$(($progress%4)) 653 [ "$modres" -eq "0" ] && echo -en "\t/" 654 [ "$modres" -eq "1" ] && echo -en "\t-" 655 [ "$modres" -eq "2" ] && echo -en "\t\\" 656 [ "$modres" -eq "3" ] && echo -en "\t|" 627 LogProgress $progress $noof_lines 657 628 done 658 629 if [ _"$MONDO_SHARE" != _"" ]; then … … 661 632 mkdir -p $bigdir/bin 662 633 if [ -e "$MINDI_TMP/post-nuke.tgz" ] ; then 663 Log It"\nINFO: Incorporating post-nuke tarball"634 LogAll "\nINFO: Incorporating post-nuke tarball" 664 635 old_pwd=`pwd` 665 636 cd "$bigdir" 666 tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || Log It"ERROR: when untarring post-nuke tarball" $MINDI_TMP/$$.log637 tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || LogAll "ERROR: when untarring post-nuke tarball" $MINDI_TMP/$$.log 667 638 cd "$old_pwd" 668 639 fi … … 679 650 cp -f $MINDI_TMP/BOOTLOADER.* $bigdir 2>> $LOGFILE || LogIt "\nINFO: Mondo v1.2x defaults to LILO as the bootloader, BTW." 680 651 if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then 681 Log It"\nINFO: Incorporating Network-related settings"652 LogAll "\nINFO: Incorporating Network-related settings" 682 653 for r in NETFS-* ISO-PREFIX ; do 683 654 cp -f $MINDI_TMP/$r $bigdir/tmp 2>> $LOGFILE || Die "Cannot copy $r - did you run out of disk space?" … … 718 689 du -sk $i 719 690 done 720 }721 722 723 GetHomeDir() {724 local res loc725 loc=`which $1 2>/dev/null`726 res=`file $loc | $AWK '{print $NF;}'`727 dirname $res728 691 } 729 692 … … 806 769 } 807 770 808 # Searches parent raid device of given disk device809 # $1: disk device (i.e. /dev/hda1)810 GetParentRaidDev() {811 if [ ! -f /etc/raidtab ]; then812 return813 fi814 $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {dev=\$2} /^[[:space:]]*device/ {if(\$2==\"$1\") {print dev; exit}}" < /etc/raidtab815 }816 817 818 771 # Searches members of raid device 819 772 # $1: raid device (/dev/md...) … … 888 841 ### Sq-Mod End 889 842 ### 843 noof_lines=0 890 844 # Get rid of duplicates, so that if a live kernel module also appears 891 845 # in $EXTRA_MODS that it won't get reported as "live module file not found" twice. 846 for module in `echo $module_list $EXTRA_MODS | tr ' ' '\n' | sort -u` ; do 847 noof_lines=$(($noof_lines+1)) 848 done 849 progress=0 892 850 for module in `echo $module_list $EXTRA_MODS | tr ' ' '\n' | sort -u` ; do 893 851 r=`find /lib/modules/$kern -type f | grep "/${module}\..*o" | tail -n1` … … 902 860 fi 903 861 LogFile "INFO: module $module --> $r" 862 progress=$(($progress+1)) 863 LogProgress $progress $noof_lines 904 864 done 905 865 find /lib/modules/$kern/modules.* -type f 2> /dev/null … … 994 954 } 995 955 956 LogProgress() { 957 local i progress modres noof_lines 958 959 progress=$1 960 noof_lines=$2 961 962 echo -en "\r\t\t\t\t\t\t\t\t" 963 i=$(($progress*100)) 964 if [ $noof_lines -ne 0 ]; then 965 i=$(($i/$noof_lines)) 966 else 967 i=0 968 fi 969 echo -en "$i" 970 echo -en "%" 971 modres=$(($progress%4)) 972 [ "$modres" -eq "0" ] && echo -en "\t/" 973 [ "$modres" -eq "1" ] && echo -en "\t-" 974 [ "$modres" -eq "2" ] && echo -en "\t\\" 975 [ "$modres" -eq "3" ] && echo -en "\t|" 976 } 996 977 997 978 # Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg … … 1008 989 use_lzo=$USE_LZO; [ "$use_lzo" = "" ] && use_lzo="no" 1009 990 use_gzip=$USE_GZIP; [ "$use_gzip" = "" ] && use_gzip="no" 991 use_lzma=$USE_LZMA; [ "$use_lzma" = "" ] && use_lzma="no" 1010 992 use_comp=$USE_COMP; [ "$use_comp" = "" ] && use_comp="yes" 1011 993 use_star=$USE_STAR; [ "$use_star" = "" ] && use_star="no" … … 1013 995 echo "use-gzip $use_gzip" >> $outfile 1014 996 echo "use-star $use_star" >> $outfile 997 echo "use-lzma $use_lzma" >> $outfile 1015 998 echo "use-comp $use_comp" >> $outfile 1016 999 echo "datestamp `date`" >> $outfile 1017 1000 [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile 1001 AddFileToCfgIfExists $MINDI_TMP/NETFS-DEV netfs-dev $outfile 1002 AddFileToCfgIfExists $MINDI_TMP/NETFS-PROTO netfs-proto $outfile 1018 1003 AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-IPADDR netfs-client-ipaddr $outfile 1019 1004 AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-NETMASK netfs-client-netmask $outfile … … 1024 1009 AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-USER netfs-server-user $outfile 1025 1010 AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-PATH netfs-server-path $outfile 1026 AddFileToCfgIfExists $MINDI_TMP/NETFS-DEV netfs-dev $outfile1027 AddFileToCfgIfExists $MINDI_TMP/NETFS-PROTO netfs-proto $outfile1028 1011 AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-IPADDR netfs-server-ipaddr $outfile 1029 1012 AddFileToCfgIfExists $MINDI_TMP/ISO-DEV iso-dev $outfile … … 1061 1044 absolute_partition old_partition_fmt current_lvolume uname skip 1062 1045 1046 LogFile "------------------------------------" 1063 1047 LogFile "Your raw fstab file looks like this:" 1064 1048 LogFile "------------------------------------" 1065 1049 cat $MY_FSTAB >> $LOGFILE 1050 LogAll "-----------------------------------" 1066 1051 LogAll "Your mountlist will look like this:" 1067 Log File"-----------------------------------"1052 LogAll "-----------------------------------" 1068 1053 1069 1054 # mountlist(OUT) … … 1080 1065 1081 1066 if [ $LVM != "false" ]; then 1082 echo -en "Analyzing LVM...\n"1067 LogAll "INFO: Analyzing LVM..." 1083 1068 $MINDI_LIB/analyze-my-lvm > $MINDI_TMP/lvm.res 1084 1069 if [ $? -ne 0 ]; then … … 1093 1078 done 1094 1079 [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`" 1095 printf " %-15s %-15s %-15s %-13s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABEL/UUID | tee -a $LOGFILE 1080 printf "%-15s %-15s %-15s %-13s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE MB" LABEL/UUID | tee -a $LOGFILE 1081 printf "%-15s %-15s %-15s %-13s %-15s\n" ------ ---------- ------ ------- ---------- | tee -a $LOGFILE 1096 1082 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 tmpfs devpts sysfs proc debugfs" 1097 1083 for c_p in $all_partitions ; do … … 1415 1401 partition_format="compaq" 1416 1402 elif [ ! "`grep -F device /etc/raidtab 2> /dev/null | grep -w $current_partition`" ] ; then 1417 Log It"WARNING: Unable to find mountpoint of $current_partition - ignoring"1403 LogAll "WARNING: Unable to find mountpoint of $current_partition - ignoring" 1418 1404 continue 1419 1405 fi … … 1426 1412 partition_format="`echo "$partition_format" | cut -d',' -f1`"; # in case user has ext3,ext2 or something dumb like that 1427 1413 [ "$partition_format" = "auto" ] && partition_format="`mount | grep -w $current_partition | $AWK '{print$5;}'`"; # in case user uses 'auto' (dumb!) 1428 unofficial_outstring=`printf " \t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"`1414 unofficial_outstring=`printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"` 1429 1415 if [ "$current_partition" = "" ] ; then 1430 1416 LogFile "WARNING: Unknown partition (outstring = $unofficial_outstring)" … … 1433 1419 partition_mountpt=raid 1434 1420 partition_format=raid 1435 printf " \t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE1421 printf "%-15s %-15s %-15s %7s %15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE 1436 1422 printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist 1437 1423 else … … 1449 1435 partition_format="vfat" 1450 1436 fi 1451 printf " \t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE1437 printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE 1452 1438 printf "%s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist 1453 1439 fi 1454 1440 done 1441 LogAll "-----------------------------------" 1455 1442 } 1456 1443 … … 1474 1461 } 1475 1462 1476 MakeSureNumberIsInteger() {1477 res=`echo "$1" | tr -s '\-[0-9]' ' '`1478 if [ "$res" != " " ] && [ "$res" != "" ] ; then1479 echo "result = '$res'"1480 Die "$1 should be an integer"1481 fi1482 }1483 1484 1485 1463 OfferToMakeBootableISO() { 1486 1464 local i old_pwd 1487 1465 if [ -z "$ISO_CMD" ]; then 1488 Log It"ERROR: Neither mkisofs nor genisoimage found, unable to make CD image"1466 LogAll "ERROR: Neither mkisofs nor genisoimage found, unable to make CD image" 1489 1467 return 1490 1468 fi … … 1496 1474 rm -Rf $MINDI_TMP/iso 1497 1475 mkdir -p $MINDI_TMP/iso/{images,archives} 1498 cp -f $MINDI_CACHE/{*.gz,*.img} $MINDI_TMP/iso/images 2>> $LOGFILE || LogIt "WARNING: OfferToMakeBootableISO: Cannot copy $MINDI_CACHE/*.gz to $MINDI_TMP/iso/images"1499 1476 LogFile "INFO: mindi_lib = $MINDI_LIB" 1477 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" 1500 1478 for i in memdisk memtest.bin memtest.img ; do 1501 1479 j=$MINDI_LIB/$i 1502 1480 k=$MINDI_TMP/iso 1503 1481 if [ -e "$j" ] ; then 1504 Log It"INFO: Copying $j to $k"1482 LogAll "INFO: Copying $j to $k" 1505 1483 cp -f $j $k 2>> $LOGFILE || Die "Failed to copy $j to $k" 1506 1484 cp -f $j $MINDI_TMP 2>> $LOGFILE || Die "Failed to copy $j to $MINDI_TMP" … … 1548 1526 LogAll "$ISO_CMD returned the following errors:" 1549 1527 cat $MINDI_TMP/mkisofs.log | tee -a $LOGFILE 1550 Log It"ERROR: Failed to create ISO image."1528 LogAll "ERROR: Failed to create ISO image." 1551 1529 else 1552 1530 LogAll "INFO: Created bootable ISO image at $MINDI_CACHE/mindi.iso" … … 1588 1566 fi 1589 1567 echo -en "." 1568 # Some distro do auto mount at that point (Ubuntu) 1590 1569 LogFile "INFO: Unmounting $USBPART just in case" 1591 1570 umount $USBPART 2>> $LOGFILE 1>> $LOGFILE … … 1668 1647 echo -en "." 1669 1648 mkdir -p $MINDI_TMP/usb/images 1670 cp -f $MINDI_CACHE/*.img $MINDI_CACHE/*.gz $MINDI_TMP/usb/images 2>> $LOGFILE || Log It"ERROR: OfferToMakeBootableUSB: Cannot copy $i to $MINDI_TMP/usb/images"1649 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" 1671 1650 echo -en "." 1672 1651 LogFile "INFO: mindi_lib = $MINDI_LIB" … … 1856 1835 1857 1836 retval=0 1837 1858 1838 [ ! -e "$kernelpath" ] && Die "PBDI lilo - cannot find $kernelpath kernel" 1859 1839 echo -en "Making "$BOOT_SIZE"KB boot disk..." … … 1864 1844 mkdir -p $mountpoint 1865 1845 dd if=/dev/zero of=$imagefile bs=1k count=$BOOT_SIZE &> /dev/null || Die "Cannot dd blank file" 1846 LogFile "Creating vfat filesystem on $imagefile" 1866 1847 mkdosfs $imagefile >> $LOGFILE 2>> $LOGFILE 1867 mount -t vfat -o loop $imagefile $mountpoint || LogIt "ERROR: Cannot mount (PBDI)" 1848 mount -t vfat -o loop $imagefile $mountpoint || LogAll "ERROR: Cannot mount (PBDI)" 1849 1868 1850 # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it 1869 1851 mkdir -p $mountpoint/etc … … 2024 2006 cd "$old_pwd" 2025 2007 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)" 2026 rmdir $mountpoint || Log It"ERROR: Cannot rmdir (PBDI)"2008 rmdir $mountpoint || LogAll "ERROR: Cannot rmdir (PBDI)" 2027 2009 2028 2010 LogIt "ERROR: Sorry, your kernel is too big for your image" … … 2039 2021 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)" 2040 2022 echo -en "..." 2041 rmdir $mountpoint || Log It"ERROR: Cannot rmdir (PBDI)"2023 rmdir $mountpoint || LogAll "ERROR: Cannot rmdir (PBDI)" 2042 2024 2043 2025 if [ "$retval" -eq "0" ] ; then … … 2045 2027 if [ "$KERN_DISK_MADE" ] ; then 2046 2028 [ "$imagefile" != "" ] && rm -f $imagefile 2047 Log It"INFO: $BOOT_SIZE KB boot disks were created OK\n"2029 LogAll "INFO: $BOOT_SIZE KB boot disks were created OK\n" 2048 2030 fi 2049 2031 else 2050 2032 echo -en "...failed\n" 2051 Log It"WARNING: $BOOT_SIZE""KB boot disk was NOT created\n"2033 LogAll "WARNING: $BOOT_SIZE""KB boot disk was NOT created\n" 2052 2034 [ "$imagefile" != "" ] && rm -f $imagefile 2053 2035 fi 2054 [ "$retval" -ne "0" ] && Log It"ERROR: PrepareBootDiskImage() is returning nonzero"2036 [ "$retval" -ne "0" ] && LogAll "ERROR: PrepareBootDiskImage() is returning nonzero" 2055 2037 return $retval 2056 2038 } … … 2088 2070 includefile=$MINDI_TMP/$$.includefile.txt 2089 2071 2072 lfiles=`ls $DEPLIST_DIR/* | grep -v /minimal` 2090 2073 if [ -e "$DEPLIST_FILE" ]; then 2091 lfiles="$DEPLIST_FILE $DEPLIST_DIR/*" 2092 else 2093 lfiles="$DEPLIST_DIR/*" 2074 lfiles="$DEPLIST_FILE $lfiles" 2094 2075 fi 2095 2076 lines=`grep -vx " *#.*" $lfiles | grep -vx "" | wc -l` … … 2129 2110 DropOptimizedLibraries $needlist $bigdir 2130 2111 echo -en "Assembling dependency files" 2131 CopyDependenciesToDirectory < $needlist $bigdir 2112 2113 CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 2132 2114 2133 2115 # also copy io.sys and msdos.sys, if we can find them … … 2141 2123 i=`cat $MINDI_TMP/BOOTLOADER.DEVICE 2> /dev/null` 2142 2124 if [ "$i" ] ; then 2143 Log It"INFO: Backing up $i's MBR"2125 LogAll "INFO: Backing up $i's MBR" 2144 2126 dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE 2145 2127 sleep 1 … … 2147 2129 j=$i 2148 2130 [ -h "$j" ] && j=`readlink -f $j` 2149 Log It"INFO: Creating /dev/boot_device ($j)"2131 LogAll "INFO: Creating /dev/boot_device ($j)" 2150 2132 mkdir -p $bigdir/dev 2151 2133 cp -pRdf $j $bigdir/dev/boot_device 2>> $LOGFILE || Die "Unable to create /dev/boot_device on ramdisk" … … 2159 2141 if [ -d /$ti ]; then 2160 2142 mkdir -p $ti 2161 cp -Rdf /$ti/* $ti 2>> $LOGFILE || Log It"ERROR: issue copying terminfo"2143 cp -Rdf /$ti/* $ti 2>> $LOGFILE || LogAll "ERROR: issue copying terminfo" 2162 2144 fi 2163 2145 if [ -e "$MONDO_SHARE/restore-scripts" ]; then … … 2166 2148 fi 2167 2149 if [ -d "/lib/dev-state" ]; then 2168 tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || Log It"ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log2150 tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log 2169 2151 fi 2170 2152 cd "$old_pwd" … … 2206 2188 echo -en "Tarring and zipping the data content..." 2207 2189 size_of_all_tools=`du -sk $bigdir | cut -f1` 2208 (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $imagesdir/all.tar.gz || LogIt "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log) 2190 (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $imagesdir/all.tar.gz || LogAll "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log) 2191 LogFile "Size of the data content" 2192 LogFile "------------------------" 2209 2193 du -sk $imagesdir/*gz >> $LOGFILE 2194 LogFile "------------------------" 2210 2195 echo -e "$DONE" 2211 2196 … … 2308 2293 2309 2294 2310 StripComments()2311 {2312 local tempfile2313 2314 tempfile=$MINDI_TMP/$$.strip.txt2315 cp -f $1 $tempfile 2>> $LOGFILE2316 $AWK '{if (substr($0,0,1)!="#" || substr($0,0,3)=="#!/") {print $0;};}' $tempfile > $12317 rm -f $tempfile2318 LogFile "INFO: Stripped comments from $2"2319 }2320 2321 2322 2323 2295 StripExecutable() 2324 2296 { … … 2407 2379 fi 2408 2380 if [ ! "$possible_kernels" ] ; then 2409 Log File"INFO: No kernel matches exactly. Are there any duff kernels?"2381 LogAll "INFO: No kernel matches exactly. Are there any duff kernels?" 2410 2382 possible_kernels="$duff_kernels" 2411 2383 if [ ! "$possible_kernels" ] ; then 2412 Log File"INFO: Sorry, no duff kernels either"2384 LogAll "INFO: Sorry, no duff kernels either" 2413 2385 else 2414 Log File"INFO: I bet you're running Debian or Gentoo, aren't you?"2415 Log File"INFO: Your kernel doesn't have a sane builddate. Oh well..."2386 LogAll "INFO: I bet you're running Debian or Gentoo, aren't you?" 2387 LogAll "INFO: Your kernel doesn't have a sane builddate. Oh well..." 2416 2388 fi 2417 2389 fi … … 2424 2396 noof_kernels=`CountItemsIn "$possible_kernels"` 2425 2397 if [ "$noof_kernels" -eq "0" ] ; then 2426 Log File"Could not find your kernel."2398 LogAll "Could not find your kernel." 2427 2399 if [ -e "/boot/vmlinuz" ] ; then 2428 Log File"INFO: Using /boot/vmlinuz as a last resort."2400 LogAll "INFO: Using /boot/vmlinuz as a last resort." 2429 2401 output=/boot/vmlinuz 2430 2402 else … … 2438 2410 for i in $possible_kernels ; do 2439 2411 if [ "`echo $i | grep "$KERVERRUN"`" ]; then 2440 Log File"INFO: OK, I used my initiative and found that "2441 Log File"INFO: $i is probably your kernel. "2412 LogAll "INFO: OK, I used my initiative and found that " 2413 LogAll "INFO: $i is probably your kernel. " 2442 2414 output="$i" 2443 2415 break … … 2892 2864 LogFile "-----------------------------" 2893 2865 2894 [ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && ln -sf /sbin/mkdosfs /sbin/mkfs.vfat2866 [ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && LogAll "/sbin/mkfs.vfat is missing!" 2895 2867 2896 2868 # Log some capital variables 2897 2869 [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly." 2870 [ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly." 2898 2871 LogFile "MONDO_SHARE = $MONDO_SHARE" 2899 2872 LogFile "MINDI_LIB = $MINDI_LIB" 2900 2873 LogFile "MINDI_SBIN = $MINDI_SBIN" 2901 [ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."2902 2874 LogFile "MINDI_CONF = $MINDI_CONF" 2903 2875 if [ -f $MINDI_CONFIG ]; then … … 2953 2925 fi 2954 2926 2955 ### BERLIOS2927 ### TODO 2956 2928 ### Fix as it's not mandatory on ia64 2957 2929 if [ "$ARCH" = "ia64" ] ; then … … 2981 2953 LVM="false" 2982 2954 fi 2955 2956 if [ -e "/proc/cmdline" ]; then 2957 CMDLINE="/proc/cmdline" 2958 elif [ -e "/tmp/cmdline" ]; then 2959 CMDLINE="/tmp/cmdline" 2960 else 2961 CMDLINE="/dev/null" 2962 fi 2963 2983 2964 LogFile "INFO: LVM set to $LVM" 2984 2965 LogFile "----------" … … 3000 2981 cat /etc/mdadm.conf >> $LOGFILE 3001 2982 else 2983 LogFile "-------------" 3002 2984 LogFile "No file /etc/mdadm.conf" 3003 2985 fi 3004 2986 LogFile "-------------" 3005 LogFile "cat /proc/cmdline:"2987 LogFile "cat $CMDLINE" 3006 2988 LogFile "-------------" 3007 cat /proc/cmdline>> $LOGFILE2989 cat $CMDLINE >> $LOGFILE 3008 2990 LogFile "-------------" 3009 2991 LogFile "cat /proc/swaps:" … … 3040 3022 MODULES="$MODULES `/usr/sbin/esxcfg-module -l | $AWK '{print $1}'`" 3041 3023 fi 3024 LogFile "Liste of extra modules is:" 3025 LogFile "-------------" 3026 LogFile "$EXTRA_MODS" 3027 LogFile "-------------" 3042 3028 LogFile "FORCE_MODS:" 3043 3029 LogFile "-------------" … … 3218 3204 ### 3219 3205 if [ $KERNEL_IS_XEN = "yes" ]; then 3220 Log It"INFO: xenkernelpath = $xenkernelpath"3206 LogAll "INFO: xenkernelpath = $xenkernelpath" 3221 3207 fi 3222 3208 kernelname=`echo $kernelpath | cut -d'-' -f2- | sed 's/.[bg]z[2]*$//'` 3223 3209 if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ] 3224 3210 then 3225 Log It"WARNING: Module path for ${kernelpath} not found..."3226 Log It" using running kernel\'s modules."3211 LogAll "WARNING: Module path for ${kernelpath} not found..." 3212 LogAll " using running kernel\'s modules." 3227 3213 kernelname=$KERVERRUN 3228 fi 3229 LogIt "INFO: kernelname = $kernelname" 3230 LogIt "INFO: kernelpath = $kernelpath" 3214 else 3215 LogAll "Using modules for kernel: ${kernelname}" 3216 fi 3217 LogAll "INFO: kernelname = $kernelname" 3218 LogAll "INFO: kernelpath = $kernelpath" 3231 3219 ### 3232 3220 ### end of Sq-Modification … … 3244 3232 if [ "${11}" ] ; then 3245 3233 LILO_OPTIONS="" 3246 # Log It"INFO: LILO will use conservative settings, to be compatible with older BIOSes."3234 # LogAll "INFO: LILO will use conservative settings, to be compatible with older BIOSes." 3247 3235 fi 3248 3236 LAST_FILELIST_NUMBER=${12} … … 3268 3256 fi 3269 3257 else 3270 echo "Syntax: mindi (--custom ....)" >> /dev/stderr3258 LogScreen "Syntax: mindi (--custom ....)" 3271 3259 MindiExit -1 3272 3260 fi … … 3400 3388 OfferToMakeBootableUSB 3401 3389 fi 3390 LogAll "Finished." 3402 3391 elif [ "$TAPEDEV" ] ; then 3403 3392 if [ "$ARCH" != "ia64" ] ; then … … 3422 3411 fi 3423 3412 # cleanup 3424 Log It"INFO: $FRIENDLY_OUTSTRING"3413 LogAll "INFO: $FRIENDLY_OUTSTRING" 3425 3414 for mtpt in $FLOPPY_WAS_MOUNTED ; do 3426 3415 mount $mtpt
Note:
See TracChangeset
for help on using the changeset viewer.