Changeset 925 in MondoRescue for branches/stable/mindi/mindi
- Timestamp:
- Nov 13, 2006, 10:14:22 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi/mindi
r884 r925 14 14 15 15 ### Which arch are we on (useful for ia64 port) 16 exportARCH=`/bin/arch`16 ARCH=`/bin/arch` 17 17 18 18 ADDITIONAL_BOOT_PARAMS="acpi=off apm=off devfs=nomount noresume selinux=0 barrier=off" 19 19 20 RUN_AFTER_INITIAL_BOOT_PHASE="echo \"Who lives in a pineapple under the sea?\" > /tmp/spongebob.squarepants.txt"20 #RUN_AFTER_INITIAL_BOOT_PHASE="echo \"Who lives in a pineapple under the sea?\" > /tmp/spongebob.squarepants.txt" 21 21 # after booting from floppy/CD image but before 22 22 # accessing auxiliary data disks (or the rest of … … 43 43 fi 44 44 45 # Temporary directory for mindi 46 TMPDIR=/tmp 47 45 48 EXTRA_SPACE=24576 ; # increase if you run out of ramdisk space 46 49 IA64_BOOT_SIZE=8192 ; # size of the ia64 boot disk 47 TMP_ROOT=/tmp48 50 WRITE_BOOT_FLOPPIES="yes" ; # do you want to be propted to write floppy images 49 51 PROMPT_WRITE_BOOT_FLOPPIES="yes" … … 60 62 # you want to use your own kernel, or the supplied default. 61 63 # If "yes" mindi will automatically use your own kernel. 62 MINDI_CONFIG="$MINDI_CONF/mindi.conf" 63 if [ -f $MINDI_CONFIG ]; then 64 . $MINDI_CONFIG 65 fi 64 66 65 MY_FSTAB=/etc/fstab 67 66 FLOPPY_MODS="ide-floppy floppy" … … 76 75 NET_MODS="sunrpc nfs nfs_acl lockd loop mii 3c59x e100 bcm5700 bnx2 e1000 eepro100 ne2k-pci tg3 pcnet32 8139cp 8139too 8390 vmxnet" 77 76 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 lvm-mod dm-mod jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd" 77 78 78 LOGFILE=/var/log/mindi.log 79 79 FDDEVICE=/dev/fd0 ; # 1.44MB floppy #0 80 CACHE_LOC=/var/cache/m ondo-archive80 CACHE_LOC=/var/cache/mindi 81 81 FORCE_DUAL_FLOPPIES=no 82 83 82 BOOT_MEDIA_MESSAGE="\ 84 83 To format and restore all files automatically, type 'nuke' <enter>.\n\ … … 96 95 a PC whose CD-ROM drive tray would be damaged if it unexpectedly ejected.\n\ 97 96 " 98 97 FDISK=$MINDI_SBIN/parted2fdisk 98 FDISKLOG=$MONDOTMP/parted2fdisk.log 99 touch $FDISKLOG 100 101 # Using a config file allow to overwrite some values 102 MINDI_CONFIG="$MINDI_CONF/mindi.conf" 103 if [ -f $MINDI_CONFIG ]; then 104 . $MINDI_CONFIG 105 fi 106 107 # Now we can create what we nedd 108 MONDOTMP=`mktemp -d $TMPDIR/mondobuild.XXXXXXXXXX` 109 mkdir -p $MONDOTMP 110 mkdir -p $CACHE_LOC 99 111 # ---------------------------------------------------------------------------- 100 101 102 103 112 104 113 … … 107 116 Die "Program is terminating in response to signal received from OS/user" 108 117 } 109 110 118 111 119 … … 122 130 done 123 131 if [ -e "$MINDI_LIB/memtest.img" ] ; then 124 # echo -en "label memtest\n kernel memtest.bin\n\n"125 132 echo -en "label memtest\n kernel memdisk\n append initrd=memtest.img\n\n" 126 # echo "Yep, this is a multi-function CD" > $2/MULTIFUNC 127 fi 128 } 129 133 fi 134 } 130 135 131 136 … … 136 141 which gawk > /dev/null 2> /dev/null && AWK=`which gawk 2>/dev/null` || AWK="`which awk 2>/dev/null`" 137 142 if which awk &> /dev/null ; then 138 if ! which gawk &> /dev/null ; then139 LogIt "You have awk but not gawk.\nPlease note that mindi works fine with a _sane_ awk binary.\nIf your awk binary misbehaves then please contact your vendor\nor distribution's mailing list for technical support.\n"140 fi143 if ! which gawk &> /dev/null ; then 144 LogIt "You have awk but not gawk.\nPlease note that mindi works fine with a _sane_ awk binary.\nIf your awk binary misbehaves then please contact your vendor\nor distribution's mailing list for technical support.\n" 145 fi 141 146 fi 142 147 which mke2fs > /dev/null 2> /dev/null || Die "Please put mke2fs in system path" 143 which afio > /dev/null 2> /dev/null || LogIt "afio not found... mindi doesn't need afio but Mondo does... Be aware...\n"144 [ ! -e "/etc/issue.net" ] && > /etc/issue.net145 FDISK=$MINDI_SBIN/parted2fdisk146 FDISKLOG=/tmp/parted2fdisk.log147 touch $FDISKLOG148 148 [ ! -e "$FDISK" ] && Die "Cannot find (s)fdisk" 149 149 } 150 151 150 152 151 … … 160 159 161 160 162 163 164 165 161 Aborted() { 166 162 trap SIGHUP SIGTERM SIGTRAP SIGINT 167 [ "$ imagesdir" != "" ] && rm -f $imagesdir/mindi*img $imagesdir/*gz $imagesdir/mindi.iso163 [ "$CACHE_LOC" != "" ] && rm -f $CACHE_LOC/mindi*img $CACHE_LOC/*gz $CACHE_LOC/mindi.iso 168 164 [ "$minidir_root" != "" ] && rm -Rf $minidir_root/* 169 165 Die "User abort." … … 174 170 [ -e "$1" ] && echo -en "$2 `cat $1`\n" >> $3 175 171 } 176 177 172 178 173 … … 183 178 noof_disks=$3 184 179 185 # diskno=1186 180 diskno=$noof_disks 187 181 mkdir -p $minidir_root/$diskno 188 182 [ "$LAST_COMPRESSED_SIZE" = "" ] && LAST_COMPRESSED_SIZE=0 189 183 if [ ! -e "$filename" ] ; then 190 if [ -h "$filename" ] ; then 191 cp --parents -pRdf $filename $minidir_root/$diskno 192 return $noof_disks 193 else 194 Die "AddFileToDir asked me to add $filename, which does not exist. Oops! Did you run out of disk space or is your Linux distro severely broken?" 195 fi 196 fi 197 # move to the disk that has room on it (or end up using the last, if all full) 184 if [ -h "$filename" ] ; then 185 cp --parents -pRdf $filename $minidir_root/$diskno 186 return $noof_disks 187 else 188 Die "AddFileToDir asked me to add $filename, which does not exist. Oops! Did you run out of disk space or is your Linux distro severely broken?" 189 fi 190 fi 191 192 # move to the disk that has room on it (or end up using the last, if all full) 198 193 while [ "$diskno" -lt "40" ] ; do 199 mkdir -p $minidir_root/$diskno194 mkdir -p $minidir_root/$diskno 200 195 filesize=`du -sk $filename | cut -f1` 201 cp --parents -Rdf $filename $minidir_root/$diskno196 cp --parents -Rdf $filename $minidir_root/$diskno 202 197 if [ "$filesize" -le "4" ] ; then 203 198 siz=$filesize … … 209 204 siz=$(($siz-2));# to allow for sectors & the fact that they round up 210 205 fi 211 [ ! "$siz" ] && siz=4212 [ "$siz" -lt "0" ] && siz=0206 [ ! "$siz" ] && siz=4 207 [ "$siz" -lt "0" ] && siz=0 213 208 LAST_COMPRESSED_SIZE=$(($LAST_COMPRESSED_SIZE+$siz)) 214 [ "$LAST_COMPRESSED_SIZE" -le "$MAX_COMPRESSED_SIZE" ] &&return $diskno215 echo "disk=$diskno siz=$LAST_COMPRESSED_SIZE" >> $LOGFILE216 LAST_COMPRESSED_SIZE=0217 rm -f $minidir_root/$diskno/$filename209 [ "$LAST_COMPRESSED_SIZE" -le "$MAX_COMPRESSED_SIZE" ] &&return $diskno 210 echo "disk=$diskno siz=$LAST_COMPRESSED_SIZE" >> $LOGFILE 211 LAST_COMPRESSED_SIZE=0 212 rm -f $minidir_root/$diskno/$filename 218 213 diskno=$(($diskno+1)) 219 214 done 220 215 return 0 ; # failed 221 216 } 222 223 224 217 225 218 … … 255 248 fi 256 249 for included_item in $included_list ; do 257 if [ ! -e "$included_item" ] ; then250 if [ ! -e "$included_item" ] ; then 258 251 sss=`find $KEYDIR/keymaps | grep -F "${included_item}.inc"` 259 [ "$sss" = "" ] && sss=`find $KEYDIR/keymaps | grep -F "$included_item"`260 for ii in $sss ; do252 [ "$sss" = "" ] && sss=`find $KEYDIR/keymaps | grep -F "$included_item"` 253 for ii in $sss ; do 261 254 [ -e "$ii" ] && AddKeyboardMappingFile $ii 262 done 263 else 264 AddKeyboardMappingFile $included_item 265 fi 266 done 267 } 268 269 270 271 272 255 done 256 else 257 AddKeyboardMappingFile $included_item 258 fi 259 done 260 } 273 261 274 262 … … 284 272 285 273 sliceno=0 286 scratchfile=$ TMP_ROOT/blah.$$.dat274 scratchfile=$MONDOTMP/blah.$$.dat 287 275 cp -f $filename $scratchfile || Die "CUACF -- cannot copy $filename to $scratchfile - did you run out of disk space?" 288 276 [ "`head $scratchfile -n1 | grep -F "bin/sh"`" != "" ] && StripComments $scratchfile "-$filename-" 289 277 [ "`echo "$filename" | grep -F "etc/termcap"`" != "" ] && StripComments $scratchfile "-$filename-" 290 278 if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] ; then 291 mv $scratchfile $scratchfile.gz292 gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz\n"293 filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'`279 mv $scratchfile $scratchfile.gz 280 gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz\n" 281 filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'` 294 282 fi 295 283 filesize=`du -sk $scratchfile | cut -f1` … … 332 320 333 321 334 335 336 322 CopyDependenciesToDirectory() { 337 323 local outdir incoming fname filesize counter … … 341 327 counter=0 342 328 while [ "$incoming" != "" ] ; do 343 if [ -d "$incoming" ] ; then329 if [ -d "$incoming" ] ; then 344 330 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 345 331 elif [ -e "$incoming" ] ; then … … 350 336 else 351 337 cp --parents -Rdf $incoming $outdir || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" 352 if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then353 gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming\n"354 fi355 [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"356 357 counter=$(($counter+1))358 if [ "$counter" -ge "5" ] ; then359 counter=0360 echo -en "."361 fi338 if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then 339 gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming\n" 340 fi 341 [ -x "$outdir" ] && StripExecutable $outdir "-$filename-" 342 fi 343 counter=$(($counter+1)) 344 if [ "$counter" -ge "5" ] ; then 345 counter=0 346 echo -en "." 347 fi 362 348 fi 363 349 incoming=`ReadLine` 364 350 done 365 351 } 366 367 352 368 353 … … 376 361 echo -en "Formatting disk..." 377 362 if which fdformat > /dev/null ; then 378 fdformat -n $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"363 fdformat -n $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?" 379 364 elif which superformat > /dev/null ; then 380 superformat $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?"381 else 382 Die "Please install either fdformat or superformat."365 superformat $dev > /dev/null 2> /dev/null || Die "Cannot format $dev - is your Linux distro broken?" 366 else 367 Die "Please install either fdformat or superformat." 383 368 fi 384 369 echo -en "\rWriting $comment" 385 370 if echo $image | grep "mindi-[r|b]oot\.1440" &> /dev/null ; then 386 cat $image > $dev &387 else 388 dd if=$image of=$dev &> /dev/null &371 cat $image > $dev & 372 else 373 dd if=$image of=$dev &> /dev/null & 389 374 fi 390 375 procno=$! … … 400 385 401 386 402 403 404 405 387 CountItemsIn() { 406 388 local r … … 413 395 414 396 415 416 417 418 419 397 CreateDataDiskImagesFromTarballs() { 420 398 local tardir outdir diskno noof_disks kp … … 427 405 echo -en "Creating data disk " 428 406 while [ "$diskno" -le "$noof_disks" ] ; do 429 echo -en "#$diskno..."430 cp -f $tardir/$diskno.tar.gz $outdir || LogIt "[line 424] Cannot copy $tardir/$diskno.tar.gz to $outdir\n"407 echo -en "#$diskno..." 408 cp -f $tardir/$diskno.tar.gz $outdir || LogIt "[line 424] Cannot copy $tardir/$diskno.tar.gz to $outdir\n" 431 409 CreateOneDataDiskImage $tardir/$diskno.tar.gz $outdir/mindi-data-$diskno.img $diskno $noof_disks 432 410 diskno=$(($diskno+1)) … … 446 424 noof_disks=$4 447 425 448 mountpoint=$ TMP_ROOT/mountpoint.$$426 mountpoint=$MONDOTMP/mountpoint.$$ 449 427 mkdir -p $mountpoint 450 428 dd if=/dev/zero of=$imagefile bs=1k count=1440 &> /dev/null || LogIt "Cannot dd (CODI)\n" 451 mke2fs -N 12 -F $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$452 [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$453 rm -f /tmp/mke2fs.$$429 mke2fs -N 12 -F $imagefile > $MONDOTMP/mke2fs.$$ 2>> $MONDOTMP/mke2fs.$$ 430 [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.$$ 431 rm -f $MONDOTMP/mke2fs.$$ 454 432 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." 455 433 mv $tarball $mountpoint/ 456 434 if [ "$?" -ne "0" ] ; then 457 umount $mountpoint458 Die "Tarball $tarball is too big for disk! (CODI)\nTell Dev Team to adjust MAX_COMPRESSED_SIZE"435 umount $mountpoint 436 Die "Tarball $tarball is too big for disk! (CODI)\nTell Dev Team to adjust MAX_COMPRESSED_SIZE" 459 437 fi 460 438 [ "$diskno" -eq "$noof_disks" ] && echo "This is the last disk ($diskno=$noof_disks)" >> $mountpoint/LAST-DISK … … 462 440 rmdir $mountpoint || LogIt "Cannot rmdir (CODI)\n" 463 441 } 464 465 442 466 443 … … 474 451 } 475 452 476 477 453 # Last function called before exiting 454 # Parameter is exit code value 455 MindiExit { 456 local my_partitions 457 458 echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE 459 echo "End date : `date`" >> $LOGFILE 460 461 sync 462 cd / 463 464 # Unmount whtat could remain mounted 465 my_partitions=`mount | grep -F $$ | cut -f1 -d' '` 466 [ "$my_partitions" != "" ] && umount $my_partitions 467 # Clean temporary files 468 rm -Rf $MONDOTMP $FDISKLOG 469 exit $1 470 } 478 471 479 472 Die() { 480 local my_partitions i 481 echo "MINDI_VERSION is $MINDI_VERSION" >> $LOGFILE 482 echo "End date : `date`" >> $LOGFILE 473 local i 483 474 if [ "$1" = "" ] ; then 484 475 LogIt "Fatal error\n" … … 486 477 LogIt "Fatal error. $1\n" 487 478 fi 488 sync 489 cd / 490 491 my_partitions=`mount | grep -F $$ | cut -f1 -d' '` 492 [ "$my_partitions" != "" ] && umount $my_partitions 493 [ "$TMP_ROOT" != "/tmp" ] && rm -Rf $TMP_ROOT 494 cd /tmp 495 mkdir -p mindi.err 496 for i in /etc/fstab /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log /tmp/mountlist.txt.$$ $FDISKLOG ; do 497 [ -e "$i" ] && cp -f $i mindi.err/ 498 done 499 rm -f mindi.err.*.tgz 500 tar -cf - mindi.err | gzip -9 > mindi.err.$$.tgz 501 rm -Rf mindi.err /tmp/mountlist.txt.$$ mindilinux $FDISKLOG 502 LogIt "Please e-mail a copy of /tmp/mindi.err.$$.tgz to the mailing list.\n" 479 480 # Creates a tar file containing all required files 481 for i in /etc/fstab /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log $FDISKLOG ; do 482 [ -e "$i" ] && cp -f $i $MONDOTMP 483 done 484 rm -f $TMPDIR/mindi.err.*.tgz 485 tar -cf - $MONDOTMP | gzip -9 > $TMPDIR/mindi.err.$$.tgz 486 LogIt "Please e-mail a copy of $TMPDIR/mindi.err.$$.tgz to the mailing list.\n" 503 487 LogIt "See http://www.mondorescue.org for more information.\n" 504 488 LogIt "WE CANNOT HELP unless you enclose that file.\n" 505 exit 1 506 } 507 508 489 MindiExit -1 490 } 509 491 510 492 … … 537 519 mv -f $filelist.tmp $filelist 538 520 done 539 sort $filelist | $AWK '{ print $1; }' | uniq> $filelist.tmp521 $AWK '{ print $1; }' $filelist | sort -u > $filelist.tmp 540 522 mv -f $filelist.tmp $filelist 541 523 echo -e "$DONE" 542 524 } 543 544 545 525 546 526 … … 623 603 624 604 625 626 627 628 605 FindHomeOfMindiAndMondo() { 629 606 [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly." … … 633 610 echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE 634 611 echo "MONDO_SHARE = $MONDO_SHARE" >> $LOGFILE 635 mkdir -p $CACHE_LOC 636 } 637 638 639 612 } 640 613 641 614 … … 651 624 652 625 653 654 626 FindLiloBinary() { 655 627 if which lilo &> /dev/null ; then 656 if which lilo.real > /dev/null 2> /dev/null ; then 657 LILO_EXE=lilo.real 658 LogIt "lilo.real found; will be used instead of lilo (*grumble* *mutter*)\n" 659 else 660 LILO_EXE=lilo 661 fi 662 $LILO_EXE -V | grep -F "21.6" > /dev/null && Die "Please upgrade LILO. Your verison has a serious bug. If you're not _using_ LILO, fine, uninstall it. :)" 663 else 664 LILO_EXE=`which false` 665 fi 666 } 628 if which lilo.real > /dev/null 2> /dev/null ; then 629 LILO_EXE=lilo.real 630 LogIt "lilo.real found; will be used instead of lilo (*grumble* *mutter*)\n" 631 else 632 LILO_EXE=lilo 633 fi 634 $LILO_EXE -V | grep -F "21.6" > /dev/null && Die "Please upgrade LILO. Your version has a serious bug. If you're not _using_ LILO, fine, uninstall it. :)" 635 else 636 LILO_EXE=`which false` 637 fi 638 } 639 667 640 668 641 FindELiloBinary() { 669 642 if which elilo &> /dev/null ; then 670 LILO_EXE=elilo671 else 672 LILO_EXE=`which false`643 LILO_EXE=elilo 644 else 645 LILO_EXE=`which false` 673 646 fi 674 647 } … … 676 649 677 650 FixPathIfBroken() { 678 651 if [ -e "/sbin/mkfs" ] && ! which mkfs &> /dev/null ; then 679 652 PATH=$PATH:/sbin:/usr/sbin 680 653 export PATH … … 684 657 fi 685 658 } 686 687 659 688 660 … … 694 666 if [ "`strings $i 2> /dev/null | head -n1`" = "LILO" ] ; then 695 667 out="$out $i" 696 668 last="$i" 697 669 fi 698 670 done 699 671 echo "$last" 700 672 } 701 702 673 703 674 … … 706 677 pwd=`pwd` 707 678 if [ "$YOUR_KERNEL_SUCKS" ] ; then 708 cd $ TMP_ROOT679 cd $MONDOTMP 709 680 else 710 681 cd / … … 724 695 725 696 726 727 697 GenerateGiantDependencyList() { 728 698 local incoming loc fname list_of_files i tempfile outfile progress filelist res r mapfile mappath included_list included_item old_pwd tempdepfile modres noof_lines lvmversion lvmresolved … … 730 700 echo -en "Analyzing dependency requirements" 731 701 outfile=$1 732 tempfile=$ TMP_ROOT/$$.txt702 tempfile=$MONDOTMP/$$.txt 733 703 incoming=`ReadLine` 734 704 … … 739 709 while [ "$incoming" != "" ] ; do 740 710 if echo "$incoming" | grep -x " *#.*" &> /dev/null ; then 741 # echo "Skipping '$incoming'"742 711 incoming=`ReadLine` 743 712 continue … … 746 715 break 747 716 fi 748 # echo "Processing '$incoming'."749 # sleep 1750 717 filelist=`GenerateListForFile "$incoming"` 751 718 r=$? … … 838 805 noof_lines=`cat $tempfile | wc -l` 839 806 for fname in `cat $tempfile` ; do 840 tempdepfile=`mktemp /tmp/mindilinux/tempdepfile.XXXXXX` 841 LocateDeps $fname > $tempdepfile 842 echo "$fname" >> $outfile.pre 843 cat $tempdepfile >> $outfile.pre 844 # echo "$fname ----> dependencies:-" >> $LOGFILE 845 # cat $tempdepfile | tr -s '/' '/' | sort -u >> $LOGFILE 846 # echo -en "(end of deplist of $fname)\n\n" >> $LOGFILE 847 rm -f $tempdepfile 848 progress=$(($progress+1)) 807 echo "$fname" >> $outfile.pre 808 LocateDeps $fname >> $outfile.pre 809 progress=$(($progress+1)) 849 810 echo -en "\r\t\t\t\t\t\t\t\t" 850 811 i=$(($progress*100)) … … 852 813 echo -en "$i" 853 814 echo -en "%" 854 modres=$(($progress%4))815 modres=$(($progress%4)) 855 816 [ "$modres" -eq "0" ] && echo -en "\t/" 856 817 [ "$modres" -eq "1" ] && echo -en "\t-" … … 859 820 done 860 821 if [ "`DidMondoCallMe`" ] ; then 861 mkdir -p $bigdir/tmp862 mkdir -p $bigdir/sbin863 mkdir -p $bigdir/bin864 if [ -e "$MONDO_TMP/post-nuke.tgz" ] ; then865 LogIt "\nIncorporating post-nuke tarball\n"866 old_pwd=`pwd`867 cd $bigdir868 tar -zxf $MONDO_TMP/post-nuke.tgz || LogIt "Error occurred when untarring post-nuke tarball\n"869 cd $old_pwd870 fi871 if cp -f $MONDO_TMP/mondo*restore $bigdir/usr/bin ; then872 873 else874 LogIt "Cannot find mondo*restore in mondo's tempdir, $MONDO_TMP\n"875 LogIt "I bet you've got a spare copy of Mondo or Mindi floating around on your system.\n"876 877 878 fi 879 cp -f $MONDO _TMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW.\n"880 if [ -e "$MONDO_TMP/NFS-DEV" ] ; then881 LogIt "Incorporating NFS-related settings\n"882 for r in NFS-* ISO-PREFIX ; do883 cp -f $MONDO_TMP/$r $bigdir/tmp || Die "Cannot copy $r - did you run out of disk space?"884 echo "Copying $r to ramdisk" >> $LOGFILE885 done886 fi887 fi 888 822 mkdir -p $bigdir/tmp 823 mkdir -p $bigdir/sbin 824 mkdir -p $bigdir/bin 825 if [ -e "$MONDOTMP/post-nuke.tgz" ] ; then 826 LogIt "\nIncorporating post-nuke tarball\n" 827 old_pwd=`pwd` 828 cd $bigdir 829 tar -zxf $MONDOTMP/post-nuke.tgz || LogIt "Error occurred when untarring post-nuke tarball\n" 830 cd $old_pwd 831 fi 832 if cp -f $MONDOTMP/mondo*restore $bigdir/usr/bin ; then 833 LocateDeps $bigdir/usr/bin/mondo*restore >> $outfile.pre 834 else 835 LogIt "Cannot find mondo*restore in mondo's tempdir, $MONDOTMP\n" 836 LogIt "I bet you've got a spare copy of Mondo or Mindi floating around on your system.\n" 837 LogIt "If Mindi was called by Mondo then send me a bug report.\n It not, type 'ps ax' to see which Mondo-related process is still running;\n then kill it. :-)\n Finally, run Mindi again." 838 Die "Odd." 839 fi 840 cp -f $MONDOTMP/BOOTLOADER.* $bigdir 2> /dev/null || LogIt "\nMondo v1.2x defaults to LILO as the bootloader, BTW.\n" 841 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 842 LogIt "Incorporating NFS-related settings\n" 843 for r in NFS-* ISO-PREFIX ; do 844 cp -f $MONDOTMP/$r $bigdir/tmp || Die "Cannot copy $r - did you run out of disk space?" 845 echo "Copying $r to ramdisk" >> $LOGFILE 846 done 847 fi 848 fi 849 tr ' ' '\n' < $outfile.pre | tr -s '/' '/' | grep -Fvx "" | sort -u | grep -Ev "/libX11|/libXext|/libXi|/libgtk|/libgdk" > $outfile 889 850 rm -f $tempfile $outfile.pre 890 851 [ "$res" -eq "0" ] && echo -e "\r\t\t\t\t\t\t\t\t$DONE" || echo "\nFailed." 891 852 return $res 892 853 } 893 894 895 896 854 897 855 … … 910 868 911 869 912 913 870 # Returns all disk devices which are part of a raid array 914 915 871 GetAllRaidMembers() { 916 872 $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*device/ if(\$2) {print \$2}" < /etc/raidtab … … 924 880 done 925 881 } 926 927 882 928 883 … … 935 890 936 891 937 938 939 940 892 # Searches parent raid device of given disk device 941 893 # $1: disk device (i.e. /dev/hda1) 942 943 894 GetParentRaidDev() { 944 895 $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {dev=\$2} /^[[:space:]]*device/ {if(\$2==\"$1\") {print dev; exit}}" < /etc/raidtab … … 946 897 947 898 948 949 899 # Searches members of raid device 950 900 # $1: raid device (/dev/md...) 951 952 901 GetRaidDevMembers() { 953 902 $AWK "/^[[:space:]]*#/ {next} /^[[:space:]]*raiddev/ {if(dev) exit; if(\$2 == \"$1\") dev=\$2} /^[[:space:]]*device/ {if(dev) {print \$2}}" < /etc/raidtab 954 903 } 955 956 957 HackAwk() {958 local pathname filename dir old_pwd new_fname959 pathname=$1960 filename=$2961 dir=`echo "$pathname" | sed s/$filename//`962 old_pwd=`pwd`963 cd $dir964 [ -f "$filename" ] || Die "Can't find $filename at $dir"965 new_fname="an.icky.icky.spider.ewww"966 [ "$filename" = "gawk" ] && new_fname="awk"967 [ "$filename" = "awk" ] && new_fname="gawk"968 ln -s $filename $new_fname969 cd $old_pwd970 }971 972 973 974 975 HackMountlist() {976 local scratchdir outfile partlist pst partstr \977 res partition swapsize978 scratchdir=$TMP_ROOT979 outfile=$1980 981 mkdir -p $outfile982 rm -Rf $outfile983 > $outfile984 partlist=$(mount | cut -d' ' -f1,3,5 \985 | grep -Ev "((none|/tmp|/ISOs|/proc|/dev/root) )|/mnt/" \986 | tr ' ' '|')987 988 echo -n "Modifying mountlist..."989 990 if [ ! -f "/mountlist.hacked" ] ; then991 Die "Can't find modified mountlist.hacked!"992 else993 cp /mountlist.hacked "$outfile"994 LogIt "Done. (Created by auto-archive, I assume?)\n"995 fi996 }997 998 999 904 1000 905 … … 1004 909 incoming=`ReadLine` 1005 910 pwd=`pwd` 1006 cd $ TMP_ROOT911 cd $MONDOTMP 1007 912 while [ "$incoming" != "" ] ; do 1008 stub=`basename $incoming`1009 newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`1010 for i in $newpath ; do1011 echo "$i"1012 done1013 read incoming913 stub=`basename $incoming` 914 newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub` 915 for i in $newpath ; do 916 echo "$i" 917 done 918 read incoming 1014 919 done 1015 920 cd $pwd 1016 921 } 1017 1018 922 1019 923 … … 1022 926 1023 927 grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}' 1024 # for partition in `$FDISK -l | tr -s ' ' '\n' | grep /dev` ; do1025 # [ -e "$i" ] && all_partitions=echo "$i"1026 # done1027 928 [ -e "/etc/raidtab" ] && $AWK '/^ *device/ {print $2}' /etc/raidtab 1028 929 return 1029 930 } 1030 1031 1032 1033 931 1034 932 … … 1042 940 echo " " 1043 941 } 1044 1045 942 1046 943 … … 1071 968 [ -f "$oss" ] && find $oss.* 2> /dev/null 1072 969 } 1073 1074 1075 #ListKernelModules() {1076 #local output q1077 #output=""1078 #for q in `lsmod | sed -n '2,$s/ .*//p'` ; do1079 #output="$q $output"1080 #done1081 #echo "`lsmod | sed -n '2,$s/ .*//p'`"1082 #}1083 1084 970 1085 971 … … 1107 993 } 1108 994 995 1109 996 # Give all symlinks recursively of a full path name 1110 997 ReadAllLink() { … … 1128 1015 fi 1129 1016 } 1017 1130 1018 1131 1019 LocateFile() { … … 1160 1048 1161 1049 1162 1163 1050 LogIt() { 1164 1051 if [ -e /dev/stderr ] ; then 1165 echo -e "$1" >> /dev/stderr1052 echo -e "$1" >> /dev/stderr 1166 1053 elif [ -e /usr/bin/logger ] ; then 1167 /usr/bin/logger -s $11054 /usr/bin/logger -s $1 1168 1055 fi 1169 1056 echo -en "$1" >> $LOGFILE … … 1171 1058 1172 1059 1173 1174 1175 1176 1177 1178 1060 # Called by TurnTgzIntoRdz, to make /tmp/mondo-restore.cfg 1179 1180 1061 MakeMondoConfigFile() { 1181 1062 local outfile use_lzo use_comp use_star … … 1195 1076 echo "datestamp `date`" >> $outfile 1196 1077 [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile 1197 AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile 1198 AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile 1199 AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile 1200 AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-DEFGW nfs-client-defgw $outfile 1201 AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-MOUNT nfs-server-mount $outfile 1202 AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-PATH nfs-server-path $outfile 1203 AddFileToCfgIfExists $MONDO_TMP/NFS-DEV nfs-dev $outfile 1204 AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile 1205 AddFileToCfgIfExists $MONDO_TMP/ISO-DEV iso-dev $outfile 1206 AddFileToCfgIfExists $MONDO_TMP/ISO-MNT iso-mnt $outfile 1207 AddFileToCfgIfExists $MONDO_TMP/ISO-PREFIX iso-prefix $outfile 1208 AddFileToCfgIfExists $MONDO_TMP/ISODIR isodir $outfile 1209 AddFileToCfgIfExists $MONDO_TMP/BOOTLOADER.DEVICE bootloader.device $outfile 1210 AddFileToCfgIfExists $MONDO_TMP/BOOTLOADER.NAME bootloader.name $outfile 1211 AddFileToCfgIfExists $MONDO_TMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile 1212 AddFileToCfgIfExists $MONDO_TMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile 1213 AddFileToCfgIfExists $MONDO_TMP/BACKUP-MEDIA-TYPE backup-media-type $outfile 1214 AddFileToCfgIfExists $MONDO_TMP/DIFFERENTIAL differential $outfile 1215 } 1216 1217 1078 AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile 1079 AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile 1080 AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile 1081 AddFileToCfgIfExists $MONDOTMP/NFS-CLIENT-DEFGW nfs-client-defgw $outfile 1082 AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-MOUNT nfs-server-mount $outfile 1083 AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-PATH nfs-server-path $outfile 1084 AddFileToCfgIfExists $MONDOTMP/NFS-DEV nfs-dev $outfile 1085 AddFileToCfgIfExists $MONDOTMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile 1086 AddFileToCfgIfExists $MONDOTMP/ISO-DEV iso-dev $outfile 1087 AddFileToCfgIfExists $MONDOTMP/ISO-MNT iso-mnt $outfile 1088 AddFileToCfgIfExists $MONDOTMP/ISO-PREFIX iso-prefix $outfile 1089 AddFileToCfgIfExists $MONDOTMP/ISODIR isodir $outfile 1090 AddFileToCfgIfExists $MONDOTMP/BOOTLOADER.DEVICE bootloader.device $outfile 1091 AddFileToCfgIfExists $MONDOTMP/BOOTLOADER.NAME bootloader.name $outfile 1092 AddFileToCfgIfExists $MONDOTMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile 1093 AddFileToCfgIfExists $MONDOTMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile 1094 AddFileToCfgIfExists $MONDOTMP/BACKUP-MEDIA-TYPE backup-media-type $outfile 1095 AddFileToCfgIfExists $MONDOTMP/DIFFERENTIAL differential $outfile 1096 } 1218 1097 1219 1098 … … 1227 1106 if [ "$YOUR_KERNEL_SUCKS" ] ; then 1228 1107 kver=$FAILSAFE_KVER 1229 cd $ TMP_ROOT1108 cd $MONDOTMP 1230 1109 searchpath=lib/modules/$kver 1231 1110 else … … 1236 1115 if [ "${kernelname}" != "" ] 1237 1116 then 1238 1117 kver=${kernelname} 1239 1118 else 1240 1119 kver=`uname -r` 1241 1120 fi 1242 1121 ### … … 1248 1127 echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile 1249 1128 list_to_echo="`lsmod | sed -n '2,$s/ .*//p'`" 1250 # LTE=`echo "$list_to_echo" | tr ' ' '\n' | grep -n "" | cut -d':' -f2,3,4 | tr '\n' ' '` 1251 # lte_old="$LTE" 1252 # LTE="" 1253 # for q in $lte_old ; do 1254 # LTE="$q $LTE" 1255 # done 1256 #echo "LTE = '$LTE'" >> $LOGFILE 1129 1257 1130 # Make temporary modprobe.conf file if we are told so 1258 1131 if [ $tmpmodprobe_flag == "Y" ] ; then 1259 infile=" /tmp/modprobe.conf.mindi.$$"1132 infile="$MONDOTMP/modprobe.conf.mindi" 1260 1133 find /etc/modprobe.d -maxdepth 1 -name "*" -xtype f -print0 | xargs -0 cat > $infile 1261 1134 else … … 1279 1152 echo "echo \"Done.\"" >> $outfile 1280 1153 chmod +x $outfile 1281 # cp $outfile /tmp/out.txt1282 1154 cd / 1283 1155 # Remove temporary modprobe.conf file if we have created one … … 1286 1158 fi 1287 1159 } 1288 1289 1290 1291 1160 1292 1161 … … 1302 1171 1303 1172 # scratchdir, mountlist(OUT) 1304 scratchdir=$ TMP_ROOT1173 scratchdir=$MONDOTMP 1305 1174 mountlist=$1 1306 1175 … … 1330 1199 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" 1331 1200 for c_p in $all_partitions ; do 1332 # echo "c_p = $c_p" > /dev/stderr1333 1201 [ "`echo "$useless_dev" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] && continue 1334 1202 [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue … … 1419 1287 current_partition=$actual_dev 1420 1288 else 1421 1289 Die "Your system uses a labelled partition ($current_partition), but you lack the tool to support it.\nPlease replace labels with their correct devices in /etc/fstab or install findfs|blkid|vol_id\n" 1422 1290 fi 1423 1291 else … … 1556 1424 1557 1425 1558 1559 1560 1561 1562 1426 MakeSureNumberIsInteger() { 1563 1427 res=`echo "$1" | tr -s '\-[0-9]' ' '` … … 1567 1431 fi 1568 1432 } 1569 1570 1571 1572 1433 1573 1434 … … 1584 1445 rm -f $1.tmp 1585 1446 if [ "$CDRECOVERY" != "yes" ] ; then 1586 if [ -e "$MONDO _TMP/NFS-DEV" ] ; then1447 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 1587 1448 echo -en "Press <enter> to continue.\n" >> $1 1588 elif [ ! "$MONDO _TMP" ] ; then1449 elif [ ! "$MONDOTMP" ] ; then 1589 1450 echo -en "FYI, this is _not_ a Mondo Rescue CD.\n" >> $1 1590 1451 if [ -e "$MINDI_LIB/memtest.img" ] ; then … … 1600 1461 fi 1601 1462 } 1602 1603 1604 1463 1605 1464 … … 1638 1497 boot_dev=$2 1639 1498 data_dev=$3 1499 1640 1500 echo -en "Would you like to create boot+data floppy disks now (y/n) ?" 1641 1501 read i … … 1647 1507 i=`find $imagesdir -type f | grep -F "/mindi-root.1" 2> /dev/null` 1648 1508 j=`find $imagesdir -type f | grep -F "/mindi-boot" | grep -Ev '2880|5760'` 1649 # echo "i=$i"1650 # echo "j=$j"1651 1509 if [ "$i" ] ; then 1652 1510 CopyImageToDisk $j $data_dev "boot disk" … … 1661 1519 done 1662 1520 } 1663 1664 1521 1665 1522 … … 1671 1528 [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0 1672 1529 fi 1673 if [ ! "$MONDO _TMP" ] ; then1530 if [ ! "$MONDOTMP" ] ; then 1674 1531 LogIt "NB: Mindi's bootable CD always uses isolinux.\n" 1675 1532 LogIt "For a bootable CD w/LILO, please use Mondo.\n" 1676 1533 fi 1677 rm -Rf $ TMP_ROOT/iso1678 mkdir -p $ TMP_ROOT/iso/{images,archives,isolinux}1679 cp -f $1/*.img $1/*.gz $ TMP_ROOT/iso/images || LogIt "OfferToMakeBootableISO: Cannot copy $i to $TMP_ROOT/iso/images\n"1534 rm -Rf $MONDOTMP/iso 1535 mkdir -p $MONDOTMP/iso/{images,archives,isolinux} 1536 cp -f $1/*.img $1/*.gz $MONDOTMP/iso/images || LogIt "OfferToMakeBootableISO: Cannot copy $i to $MONDOTMP/iso/images\n" 1680 1537 old_pwd=`pwd` 1681 cd $ TMP_ROOT/iso1538 cd $MONDOTMP/iso 1682 1539 mkdir -p $MONDO_ROOT/iso/isolinux 1683 1540 echo "mindi_lib = $MINDI_LIB" >> $LOGFILE … … 1685 1542 for i in memdisk memtest.bin memtest.img ; do 1686 1543 j=$MINDI_LIB/$i 1687 k=$ TMP_ROOT/iso/isolinux1544 k=$MONDOTMP/iso/isolinux 1688 1545 if [ -e "$j" ] ; then 1689 1546 LogIt "Copying $j to $k\n" 1690 1547 cp -f $j $k || Die "Failed to copy $j to $k" 1691 cp -f $j $ TMP_ROOT|| Die "Failed to copy $j to $k"1692 fi 1693 done 1694 MakeSyslinuxMessageFile $ TMP_ROOT/iso/isolinux/message.txt1695 cp $kernelpath $ TMP_ROOT/iso/isolinux/vmlinuz || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/isolinux/vmlinuz). Did you run out of disk space?"1696 cp $ TMP_ROOT/mindi.rdz $TMP_ROOT/iso/isolinux/initrd.img1697 cp $ TMP_ROOT/mindi.rdz $imagesdir/initrd.img1548 cp -f $j $MONDOTMP || Die "Failed to copy $j to $k" 1549 fi 1550 done 1551 MakeSyslinuxMessageFile $MONDOTMP/iso/isolinux/message.txt 1552 cp $kernelpath $MONDOTMP/iso/isolinux/vmlinuz || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/isolinux/vmlinuz). Did you run out of disk space?" 1553 cp $MONDOTMP/mindi.rdz $MONDOTMP/iso/isolinux/initrd.img 1554 cp $MONDOTMP/mindi.rdz $CACHE_LOC/initrd.img 1698 1555 [ -e "$iso_cfg_file" ] || Die "FIXME - unable to find $iso_cfg_file - this should never occur" 1699 cd $ TMP_ROOT/iso/isolinux1700 cat $iso_cfg_file | HackSyslinuxFile $ramdisk_size $ TMP_ROOT/iso > isolinux.cfg || Die "Cannot copy isolinux.cfg from mindi_home to tmp_root - did you run out of disk space?"1701 if [ -e "$MONDO _TMP/NFS-DEV" ] ; then1556 cd $MONDOTMP/iso/isolinux 1557 cat $iso_cfg_file | HackSyslinuxFile $ramdisk_size $MONDOTMP/iso > isolinux.cfg || Die "Cannot copy isolinux.cfg from mindi_home to tmp_root - did you run out of disk space?" 1558 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 1702 1559 mv isolinux.cfg isolinux.cfg.old 1703 1560 sed s/interactive/iso/ isolinux.cfg.old > isolinux.cfg … … 1707 1564 cp $ISOLINUX ../ 1708 1565 fi 1709 cd $ TMP_ROOT/iso1566 cd $MONDOTMP/iso 1710 1567 if [ "$ARCH" != "ia64" ] ; then 1711 cp -f $ TMP_ROOT/iso/isolinux/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt} $MONDO_ROOT || Die "Cannot copy core files to ramdisk for boot disk. Did you run out of disk space?"1568 cp -f $MONDOTMP/iso/isolinux/{isolinux.cfg,initrd.img,vmlinuz,isolinux.bin,message.txt} $MONDO_ROOT || Die "Cannot copy core files to ramdisk for boot disk. Did you run out of disk space?" 1712 1569 fi 1713 1570 [ "$MONDO_SHARE" ] && cp -f $MONDO_SHARE/autorun . 1714 if [ -d "/home/MondoCD" ] ; then1715 cp -pRdu /home/MondoCD/* .1716 fi1717 1571 if [ "$ARCH" != "ia64" ] ; then 1718 mkisofs -U -J -r -o $ imagesdir/mindi.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table . > /dev/null 2> /tmp/$$.mk1719 else 1720 mkisofs -J -r -o $ imagesdir/mindi.iso -b images/mindi-bootroot.$IA64_BOOT_SIZE.img -c isolinux/boot.cat -no-emul-boot . > /dev/null 2> /tmp/$$.mk1572 mkisofs -U -J -r -o $CACHE_LOC/mindi.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table . > /dev/null 2> $MONDOTMP/mkisofs.log 1573 else 1574 mkisofs -J -r -o $CACHE_LOC/mindi.iso -b images/mindi-bootroot.$IA64_BOOT_SIZE.img -c isolinux/boot.cat -no-emul-boot . > /dev/null 2> $MONDOTMP/mkisofs.log 1721 1575 fi 1722 1576 if [ "$?" -ne "0" ] ; then 1723 echo "----------- mkisofs's errors --------------" >> $LOGFILE1724 cat /tmp/$$.mk>> $LOGFILE1725 echo "mkisofs returned the following errors:-"1726 cat /tmp/$$.mk1727 LogIt "Failed to create ISO image.\n"1728 else 1729 echo "Created bootable ISO image at $imagesdir/mindi.iso" >> $LOGFILE1730 fi 1731 rm -f /tmp/$$.mk1577 echo "----------- mkisofs's errors --------------" >> $LOGFILE 1578 cat $MONDOTMP/mkisofs.log >> $LOGFILE 1579 echo "mkisofs returned the following errors:-" 1580 cat $MONDOTMP/mkisofs.log 1581 LogIt "Failed to create ISO image.\n" 1582 else 1583 echo "Created bootable ISO image at $CACHE_LOC/mindi.iso" >> $LOGFILE 1584 fi 1585 rm -f $MONDOTMP/mkisofs.log 1732 1586 cd $old_pwd 1733 1587 } 1734 1735 1588 1736 1589 … … 1738 1591 [ "$1" -gt "1" ] && echo -en "s" 1739 1592 } 1740 1741 1742 1593 1743 1594 … … 1751 1602 fi 1752 1603 if [ "$disksize" -gt "2880" ] ; then 1753 if [ "`DidMondoCallMe`" ] ; then 1754 if [ "$CDRECOVERY" != "yes" ] ; then 1755 if [ -e "$MONDO_TMP/NFS-DEV" ] ; then 1756 echo -en "Press <enter> to continue.\n" 1757 elif [ ! "$MONDO_TMP" ] ; then 1758 echo -en "FYI, this is _not_ a Mondo Rescue CD.\n" 1759 else 1760 echo -en "$BOOT_MEDIA_MESSAGE" 1604 if [ "`DidMondoCallMe`" ] ; then 1605 if [ "$CDRECOVERY" != "yes" ] ; then 1606 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 1607 echo -en "Press <enter> to continue.\n" 1608 elif [ ! "$MONDOTMP" ] ; then 1609 echo -en "FYI, this is _not_ a Mondo Rescue CD.\n" 1610 else 1611 echo -en "$BOOT_MEDIA_MESSAGE" 1612 fi 1761 1613 fi 1762 1614 fi 1763 fi1764 1615 fi 1765 1616 if [ "$CDRECOVERY" = "yes" ] ; then … … 1770 1621 echo -en "\n\n\n" 1771 1622 } 1772 1773 1774 1623 1775 1624 … … 1783 1632 rand1=$RANDOM 1784 1633 rand2=$RANDOM 1785 image= /tmp/$rand1.$rand2.img1786 mtpt= /tmp/$rand1.$rand2.mtpt1634 image=$MONDOTMP/$rand1.$rand2.img 1635 mtpt=$MONDOTMP/$rand1.$rand2.mtpt 1787 1636 dd if=/dev/zero of=$image bs=1k count=$disksize 1788 1637 mke2fs -N 26 -F $image > /dev/null … … 1810 1659 CopyBootBFile $mtpt/boot.b 1811 1660 1812 # echo "root=/dev/loop0" > bdlilo.conf1813 1661 MakeLiloConfFile $disksize >> bdlilo.conf 1814 1815 # cat bdlilo.conf > /tmp/bdlilo.conf1816 1817 # cat /home/mondostuff/bdlc > bdlilo.conf1818 1662 1819 1663 chmod 644 bdlilo.conf … … 1822 1666 res=$? 1823 1667 1824 #echo "lilo -v -C bdlilo.conf -r $mtpt"1825 #echo -en "Press enter"; read line1826 1827 1668 cd $old_pwd 1828 1669 umount $mtpt … … 1831 1672 1832 1673 return $res 1833 1834 # --- the kernel-only method NO LONGER WORKS. Not since Apr 2002. 1835 # It should work, according to the Boot Disk HOWTO, but it doesn't. 1836 # It works for my failsafe kernel & for RH7.2 but not RH7.3, 8.0, etc. 1837 # -Hugo, Apr 19th 2004 1838 # dd if=$1 of=$2 bs=1k &> /dev/null || Die "Cannot dd blank file" 1839 # dd if=/dev/zero bs=1k count=$3 >> $2 2> /dev/null || Die "Cannot dd blank file" 1840 # mv -f $2 $2.old 1841 # dd if=$2.old bs=1k count=$3 of=$2 &> /dev/null || Die "Cannot dd blank file" 1842 # rm -f $2.old 1843 # if [ "$3" = "1440" ] ; then 1844 # rdev $2 "/dev/fd0H"$3 1845 # else 1846 # rdev $2 "/dev/fd0u"$3 1847 # fi 1848 # rdev -R $2 0 1849 # rdev -r $2 49152 1850 } 1851 1852 1853 1854 1674 } 1855 1675 1856 1676 … … 1859 1679 disksize=$1 1860 1680 options="" 1861 if [ "$ARCH" != "ia64" ] ; then 1862 echo -en "boot=/dev/loop0\ndisk=/dev/loop0\n" 1863 fi 1864 if [ "$disksize" -eq "2880" ] ; then 1865 echo -en "bios=0x00\nsectors=36\nheads=2\ncylinders=80\n" 1866 elif [ "$disksize" -eq "1722" ] ; then 1867 echo -en "bios=0x00\nsectors=21\nheads=2\ncylinders=82\n" 1868 elif [ "$disksize" -gt "2880" ] ; then 1869 /bin/true 1870 else 1871 echo -en "bios=0x00\nsectors=18\nheads=2\ncylinders=80\n" 1872 fi 1873 if [ "$ARCH" != "ia64" ] ; then 1874 echo -en "install=/boot.b\nmap=/boot.map\n" 1875 fi 1681 1682 if [ "$ARCH" != "ia64" ] ; then 1683 echo -en "boot=/dev/loop0\ndisk=/dev/loop0\n" 1684 fi 1685 if [ "$disksize" -eq "2880" ] ; then 1686 echo -en "bios=0x00\nsectors=36\nheads=2\ncylinders=80\n" 1687 elif [ "$disksize" -eq "1722" ] ; then 1688 echo -en "bios=0x00\nsectors=21\nheads=2\ncylinders=82\n" 1689 elif [ "$disksize" -gt "2880" ] ; then 1690 /bin/true 1691 else 1692 echo -en "bios=0x00\nsectors=18\nheads=2\ncylinders=80\n" 1693 fi 1694 if [ "$ARCH" != "ia64" ] ; then 1695 echo -en "install=/boot.b\nmap=/boot.map\n" 1696 fi 1876 1697 if [ "$CDRECOVERY" = "yes" ] ; then 1877 1698 echo -en "default=RESTORE\n" 1878 1699 elif [ "$disksize" -gt "2880" ] && [ "`DidMondoCallMe`" ] ; then 1879 if [ -e "$MONDO _TMP/NFS-DEV" ] ; then1700 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 1880 1701 echo -en "default=iso\n" 1881 1702 else … … 1891 1712 fi 1892 1713 if [ "$CDRECOVERY" != "yes" ] ; then 1893 echo -en "timeout=300\n"1714 echo -en "timeout=300\n" 1894 1715 fi 1895 1716 echo -en "\n" 1896 1717 if [ "$CDRECOVERY" = "yes" ] ; then 1897 options="RESTORE expert"1718 options="RESTORE expert" 1898 1719 elif [ "$disksize" -gt "2880" ] ; then 1899 1720 if [ "`DidMondoCallMe`" ] ; then 1900 if [ -e "$MONDO _TMP/NFS-DEV" ] ; then1721 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 1901 1722 options="iso" 1902 1723 else … … 1906 1727 else 1907 1728 options="expert" 1908 fi1729 fi 1909 1730 else 1910 1731 options="expert" 1911 1732 fi 1912 1733 for i in $options ; do 1913 ooo=$i1914 [ "$ooo" = "RESTORE" ] && ooo="nuke"1915 if [ "$ARCH" = "ia64" ] ; then1916 rootpart="root=/dev/ram0\n\t"1917 else1918 rootpart=""1919 fi1920 outstr="image=vmlinuz\n\tlabel=$i\n\tinitrd=/mindi.rdz\n\t${rootpart}append=\" rw ramdisk=$ramdisksize ramdisk_size=$ramdisksize maxcpus=1 $ooo_mode $ADDITIONAL_BOOT_PARAMS"1734 ooo=$i 1735 [ "$ooo" = "RESTORE" ] && ooo="nuke" 1736 if [ "$ARCH" = "ia64" ] ; then 1737 rootpart="root=/dev/ram0\n\t" 1738 else 1739 rootpart="" 1740 fi 1741 outstr="image=vmlinuz\n\tlabel=$i\n\tinitrd=/mindi.rdz\n\t${rootpart}append=\" rw ramdisk=$ramdisksize ramdisk_size=$ramdisksize maxcpus=1 $ooo_mode $ADDITIONAL_BOOT_PARAMS" 1921 1742 1922 outstr=$outstr" $ooo_mode" 1923 outstr=$outstr"\"\n" 1924 if [ "$disksize" = "1440" ] ; then 1925 echo -en "$outstr" | sed s/initrd=.*// | grep -v root= 1926 else 1927 echo -en "$outstr" 1928 fi 1929 done 1930 } 1931 1932 1743 outstr=$outstr" $ooo_mode" 1744 outstr=$outstr"\"\n" 1745 if [ "$disksize" = "1440" ] ; then 1746 echo -en "$outstr" | sed s/initrd=.*// | grep -v root= 1747 else 1748 echo -en "$outstr" 1749 fi 1750 done 1751 } 1933 1752 1934 1753 … … 1943 1762 [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel" 1944 1763 echo -en "Making "$disksize"KB boot disk..." 1945 TurnTgzIntoRdz $MINDI_LIB/rootfs $ TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"1764 TurnTgzIntoRdz $MINDI_LIB/rootfs $MONDOTMP/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?" 1946 1765 if [ "$ARCH" != "ia64" ] ; then 1947 1766 [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size" … … 1949 1768 echo -en "..." 1950 1769 imagefile=$imagesdir/mindi-bootroot.$disksize.img 1951 mountpoint=$ TMP_ROOT/mountpoint.$$1770 mountpoint=$MONDOTMP/mountpoint.$$ 1952 1771 mkdir -p $mountpoint 1953 1772 dd if=/dev/zero of=$imagefile bs=1k count=$disksize &> /dev/null || Die "Cannot dd blank file" 1954 1773 if [ "$ARCH" = "ia64" ] ; then 1955 mkdosfs $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$1774 mkdosfs $imagefile > $MONDOTMP/mke2fs.log 2>> $MONDOTMP/mke2fs.log 1956 1775 t=vfat 1957 1776 else 1958 mke2fs -N 26 -m 0 -F $imagefile > /tmp/mke2fs.$$ 2>> /tmp/mke2fs.$$1777 mke2fs -N 26 -m 0 -F $imagefile > $MONDOTMP/mke2fs.log 2>> $MONDOTMP/mke2fs.log 1959 1778 t=ext2 1960 1779 fi 1961 [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$1962 rm -f /tmp/mke2fs.$$1780 [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.log 1781 rm -f $MONDOTMP/mke2fs.log 1963 1782 mount -t $t -o loop $imagefile $mountpoint || LogIt "Cannot mount (PBDI)\n\n" 1964 1783 # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it … … 1967 1786 liloconf=$mountpoint/etc/lilo.conf 1968 1787 else 1969 liloconf=$mountpoint/elilo.conf1788 liloconf=$mountpoint/elilo.conf 1970 1789 fi 1971 1790 old_pwd=`pwd` … … 1981 1800 MakeLiloConfFile $disksize > $liloconf 1982 1801 1983 echo "Copying $ TMP_ROOT/mindi.rdz to $mountpoint..." >> $LOGFILE1984 cp -f $ TMP_ROOT/mindi.rdz $mountpoint 2>> $LOGFILE1802 echo "Copying $MONDOTMP/mindi.rdz to $mountpoint..." >> $LOGFILE 1803 cp -f $MONDOTMP/mindi.rdz $mountpoint 2>> $LOGFILE 1985 1804 if [ "$?" -ne "0" ] ; then 1986 LogIt "Failed to copy $TMP_ROOT/mindi.rdz to $mountpoint\n"1987 cat $TMP_ROOT/mtpt.$$ >> $LOGFILE1988 LogIt "Please unload some of your modules and try again.\n"1989 rm -f $TMP_ROOT/mtpt.$$1990 LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n"1805 LogIt "Failed to copy $MONDOTMP/mindi.rdz to $mountpoint\n" 1806 cat $MONDOTMP/mtpt.$$ >> $LOGFILE 1807 LogIt "Please unload some of your modules and try again.\n" 1808 rm -f $MONDOTMP/mtpt.$$ 1809 LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n" 1991 1810 retval=$(($retval+1)) 1992 1811 fi … … 1994 1813 1995 1814 mkdir -p $mountpoint/tmp 1996 cp -f $ TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null1815 cp -f $MONDOTMP/mondo-restore.cfg $mountpoint/tmp &> /dev/null 1997 1816 if [ -e "$MINDI_LIB/memtest.img" ] ; then 1998 1817 echo -en "image=/memtest.bin\nlabel=memtest\nn" >> $liloconf … … 2000 1819 # echo "Yep, this is a multi-function CD" > $mountpoint/MULTIFUNC 2001 1820 fi 2002 if [ -d "/home/MondoCD" ] ; then 2003 cp -pRdu /home/MondoCD/* . || Die "Cannot do kung pow" 2004 fi 2005 2006 # copy the kernel across 1821 1822 # copy the kernel across 2007 1823 rm -Rf $mountpoint/lost+found 2008 1824 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null … … 2010 1826 cp -f $kernelpath $mountpoint/vmlinuz > /dev/null 2> /dev/null 2011 1827 if [ "$?" -ne "0" ] || [ "$FORCE_DUAL_FLOPPIES" = "yes" ] ; then 2012 echo "Files at mountpoint ($mountpoint) :-" >> $LOGFILE2013 du -sk $mountpoint/* >> $LOGFILE2014 echo "--- end of list of files ---" >> $LOGFILE2015 echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n\1828 echo "Files at mountpoint ($mountpoint) :-" >> $LOGFILE 1829 du -sk $mountpoint/* >> $LOGFILE 1830 echo "--- end of list of files ---" >> $LOGFILE 1831 echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n\ 2016 1832 Sorry, your kernel is too big for a boot/root floppy.\nI'll try the new boot/root two-disk thingy.\n" >> $LOGFILE 2017 1833 rm -f $mountpoint/vmlinuz 2018 cd $old_pwd1834 cd $old_pwd 2019 1835 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)" 2020 1836 rmdir $mountpoint || LogIt "Cannot rmdir (PBDI)\n" 2021 # losetup /dev/loop0 -d2022 res=01837 # losetup /dev/loop0 -d 1838 res=0 2023 1839 write_full_floppy_of_kernel $kernelpath $imagesdir/mindi-boot.1440.img 1440 2024 res=$(($res+$?))2025 cp -f $ TMP_ROOT/mindi.rdz $imagesdir/mindi-root.1440.img2026 res=$(($res+$?))2027 rm -f $imagefile2028 if [ "$res" -ne "0" ]; then2029 LogIt "Warning - failed to create 1.44MB boot/root floppies\n"2030 rm -f $imagesdir/mindi-*.1440.img2031 fi2032 return $res1840 res=$(($res+$?)) 1841 cp -f $MONDOTMP/mindi.rdz $imagesdir/mindi-root.1440.img 1842 res=$(($res+$?)) 1843 rm -f $imagefile 1844 if [ "$res" -ne "0" ]; then 1845 LogIt "Warning - failed to create 1.44MB boot/root floppies\n" 1846 rm -f $imagesdir/mindi-*.1440.img 1847 fi 1848 return $res 2033 1849 fi 2034 1850 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4` … … 2047 1863 elif [ ! "$KERN_DISK_MADE" ] ; then 2048 1864 # 12/28/2001 - if 1.72MB floppy then don't use LILO's optimizations at all 2049 $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE 2050 else 2051 echo "Not running LILO. It's not that kind of disk." >> $LOGFILE 2052 fi 1865 $LILO_EXE -r $mountpoint >> $LOGFILE 2>> $LOGFILE 1866 else 1867 echo "Not running LILO. It's not that kind of disk." >> $LOGFILE 1868 fi 1869 1870 # BERLIOS does not test necessarily what it expects 2053 1871 if [ $? -ne "0" ] ; then 2054 if [ "`grep -F "/tmp/dev.0" $LOGFILE`" ] ; then2055 LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"2056 LogIt "Please reboot your PC as a workaround.\n"2057 Die "LILO sneezed and Mindi caught a cold. Please read the README / FAQ.\n"2058 fi2059 echo "$LILO_EXE -r $mountpoint ...failed."2060 echo -en "Press ENTER to continue."; read line2061 LogIt "Cannot run lilo on $mountpoint\nPlease upgrade/downgrade your version of LILO. It has a bug.\n"2062 retval=$(($retval+1))2063 fi 2064 cp -f $liloconf /tmp/lilo.conf1872 if [ "`grep -F "/tmp/dev.0" $LOGFILE`" ] ; then 1873 LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n" 1874 LogIt "Please reboot your PC as a workaround.\n" 1875 Die "LILO sneezed and Mindi caught a cold. Please read the README / FAQ.\n" 1876 fi 1877 echo "$LILO_EXE -r $mountpoint ...failed." 1878 echo -en "Press ENTER to continue."; read line 1879 LogIt "Cannot run lilo on $mountpoint\nPlease upgrade/downgrade your version of LILO. It has a bug.\n" 1880 retval=$(($retval+1)) 1881 fi 1882 cp -f $liloconf $MONDOTMP/lilo.conf 2065 1883 if [ "$ARCH" = "ia64" ] ; then 2066 1884 cp `dirname $kernelpath`/*.efi $mountpoint … … 2082 1900 return $retval 2083 1901 } 2084 2085 2086 1902 2087 1903 … … 2095 1911 local retval old_pwd 2096 1912 retval=0 1913 2097 1914 [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel" 2098 1915 echo -en "Making "$disksize"KB boot disk..." 2099 TurnTgzIntoRdz $MINDI_LIB/rootfs $ TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"1916 TurnTgzIntoRdz $MINDI_LIB/rootfs $MONDOTMP/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?" 2100 1917 [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size" 2101 1918 echo -en "..." 2102 1919 imagefile=$imagesdir/mindi-bootroot.$disksize.img 2103 mountpoint=$ TMP_ROOT/mountpoint.$$1920 mountpoint=$MONDOTMP/mountpoint.$$ 2104 1921 mkdir -p $mountpoint 2105 1922 # If I format a 1722KB data file & run syslinux on it, the resultant image … … 2117 1934 fi 2118 1935 mount -t vfat -o loop $imagefile $mountpoint || LogIt "Cannot mount (PBDI)\n\n" 2119 # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it 1936 1937 # copy Mindi's skeleton fs & lilo/syslinux/whatever stuff into it 2120 1938 old_pwd=`pwd` 2121 1939 MakeSyslinuxMessageFile $mountpoint/message.txt 2122 1940 cd $mountpoint 2123 1941 [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?" 2124 # tar -zxf $MINDI_LIB/dev.tgz || LogIt "Cannot untar dev.tgz\n" <--- present for LILO; is it nec. for SYSLINUX too?2125 1942 cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $mountpoint > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to tmp_root" 2126 if [ -e "$MONDO _TMP/NFS-DEV" ] ; then1943 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 2127 1944 mv syslinux.cfg syslinux.cfg.orig 2128 1945 sed s/interactive/iso/ syslinux.cfg.orig > syslinux.cfg 2129 1946 fi 2130 1947 cd $old_pwd 2131 echo "Copying $ TMP_ROOT/mindi.rdz to $mountpoint/initrd.img..." >> $LOGFILE2132 cp -f $ TMP_ROOT/mindi.rdz $mountpoint/initrd.img 2>> $LOGFILE1948 echo "Copying $MONDOTMP/mindi.rdz to $mountpoint/initrd.img..." >> $LOGFILE 1949 cp -f $MONDOTMP/mindi.rdz $mountpoint/initrd.img 2>> $LOGFILE 2133 1950 if [ "$?" -ne "0" ] ; then 2134 LogIt "Failed to copy $ TMP_ROOT/mindi.rdz to $mountpoint\n"2135 cat $ TMP_ROOT/mtpt.$$ >> $LOGFILE1951 LogIt "Failed to copy $MONDOTMP/mindi.rdz to $mountpoint\n" 1952 cat $MONDOTMP/mtpt.$$ >> $LOGFILE 2136 1953 LogIt "Please unload some of your modules and try again.\n" 2137 rm -f $ TMP_ROOT/mtpt.$$1954 rm -f $MONDOTMP/mtpt.$$ 2138 1955 LogIt "Cannot incorporate mindi.rdz in bootdisk (kernel / modules too big?)\n" 2139 1956 retval=$(($retval+1)) … … 2141 1958 2142 1959 mkdir -p $mountpoint/tmp 2143 cp -f $ TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null2144 2145 # copy the kernel across1960 cp -f $MONDOTMP/mondo-restore.cfg $mountpoint/tmp &> /dev/null 1961 1962 # copy the kernel across 2146 1963 rm -Rf $mountpoint/lost+found 2147 1964 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null … … 2158 1975 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)" 2159 1976 rmdir $mountpoint || LogIt "Cannot rmdir (PBDI)\n" 2160 # losetup /dev/loop0 -d2161 1977 2162 1978 res=0 2163 1979 write_full_floppy_of_kernel $kernelpath $imagesdir/mindi-boot.1440.img 1440 2164 1980 res=$(($res+$?)) 2165 cp -f $ TMP_ROOT/mindi.rdz $imagesdir/mindi-root.1440.img1981 cp -f $MONDOTMP/mindi.rdz $imagesdir/mindi-root.1440.img 2166 1982 res=$(($res+$?)) 2167 1983 rm -f $imagefile … … 2176 1992 echo "Free space left on floppy = $free_space KB" >> $LOGFILE 2177 1993 echo "Max kernel size on $disksize KB floppy (est'd) = $max_kernel_size K" >> $LOGFILE 2178 # make it bootable 1994 1995 # make it bootable 2179 1996 rm -f $mountpoint/zero 2180 1997 mkdir -p $mountpoint/etc … … 2200 2017 2201 2018 2202 2203 2204 2019 PrepareDataDiskImages() { 2205 2020 local needlist bigdir minidir_root tardir diskdir imagesdir res i j k old_pwd lines … … 2207 2022 imagesdir=$1 2208 2023 rm -f $imagesdir/mindi-*.img $imagesdir/[0-9]*.tar.gz $imagesdir/mindi.iso 2209 needlist=$ TMP_ROOT/what-we-need.txt2210 bigdir=$ TMP_ROOT/bigdir2211 minidir_root=$ TMP_ROOT/minidir2024 needlist=$MONDOTMP/what-we-need.txt 2025 bigdir=$MONDOTMP/bigdir 2026 minidir_root=$MONDOTMP/minidir 2212 2027 mkdir -p $minidir_root 2213 2028 mkdir -p $bigdir/usr/bin 2214 tardir=$ TMP_ROOT/tardir2029 tardir=$MONDOTMP/tardir 2215 2030 2216 2031 lines=`grep -vx " *#.*" $MINDI_CONF/deplist.txt | grep -vx "" | wc -l` … … 2218 2033 res=$? 2219 2034 if [ "$YOUR_KERNEL_SUCKS" ]; then 2220 pwd=`pwd`2221 cd $TMP_ROOT2035 pwd=`pwd` 2036 cd $MONDOTMP 2222 2037 for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do 2223 cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir" 2224 if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then 2225 cp --parents -pRdf $i $bigdir 2226 else 2227 ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO 2228 BIGNO=$(($BIGNO+1)) 2229 fi 2230 done 2231 for i in $EXTRA_MODS ; do 2232 j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null` 2233 [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE 2234 for k in $j ; do 2235 if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then 2236 cp --parents -pRdf $k $bigdir 2237 else 2238 ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO 2239 BIGNO=$(($BIGNO+1)) 2240 fi 2241 echo "Added failsafe module $k to ramdisk" >> $LOGFILE 2038 cp --parents -pRdf ./$i $bigdir || Die "PDDI can't cp $i->$bigdir" 2039 if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then 2040 cp --parents -pRdf $i $bigdir 2041 else 2042 ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO 2043 BIGNO=$(($BIGNO+1)) 2044 fi 2242 2045 done 2243 done 2244 cd $pwd 2245 else 2246 ListKernelModulePaths >> $needlist 2046 for i in $EXTRA_MODS ; do 2047 j=`find lib/modules/$FAILSAFE_KVER -name $i.*o 2> /dev/null` 2048 [ ! "$j" ] && echo "Warning - cannot find failsafe module $i.o" >> $LOGFILE 2049 for k in $j ; do 2050 if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then 2051 cp --parents -pRdf $k $bigdir 2052 else 2053 ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO 2054 BIGNO=$(($BIGNO+1)) 2055 fi 2056 echo "Added failsafe module $k to ramdisk" >> $LOGFILE 2057 done 2058 done 2059 cd $pwd 2060 else 2061 ListKernelModulePaths >> $needlist 2247 2062 fi 2248 2063 if [ "$res" -ne "0" ] ; then … … 2252 2067 mkdir -p $bigdir/tmp 2253 2068 if [ "`DidMondoCallMe`" ] ; then 2254 MakeMondoConfigFile $TMP_ROOT/mondo-restore.cfg 2255 cp -f $TMP_ROOT/mondo-restore.cfg $bigdir/tmp &> /dev/null 2256 cp -f $TMP_ROOT/mondo-restore.cfg $CACHE_LOC &> /dev/null 2069 MakeMondoConfigFile $MONDOTMP/mondo-restore.cfg 2070 cp -f $MONDOTMP/mondo-restore.cfg $bigdir/tmp &> /dev/null 2257 2071 fi 2258 2072 [ -d "/mnt/.boot.d" ] && echo "Oh Jebus" > $bigdir/tmp/DUMBASS-GENTOO … … 2261 2075 CopyDependenciesToDirectory < $needlist $bigdir 2262 2076 2263 # also copy io.sys and msdos.sys, if we can find them2077 # also copy io.sys and msdos.sys, if we can find them 2264 2078 for i in `mount | cut -d' ' -f3` ; do 2265 for j in io.sys msdos.sys ; do2266 [ -e "$i/$j" ] && cp -f $i/$j $bigdir2267 done2268 done 2269 2270 # master boot record, too2271 i=`cat $MONDO _TMP/BOOTLOADER.DEVICE 2> /dev/null`2079 for j in io.sys msdos.sys ; do 2080 [ -e "$i/$j" ] && cp -f $i/$j $bigdir 2081 done 2082 done 2083 2084 # master boot record, too 2085 i=`cat $MONDOTMP/BOOTLOADER.DEVICE 2> /dev/null` 2272 2086 if [ "$i" ] ; then 2273 LogIt "Backing up $i's MBR\n" 2274 dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE 2275 # < < E O F 2276 sleep 1 2277 sync 2278 # [ "$?" -ne "0" ] && echo "Failed to save $i's MBR to bigdir" >> $LOGFILE 2279 j=$i 2280 [ -h "$j" ] && j=`readlink -f $j` 2281 LogIt "Creating /dev/boot_device ($j)\n" 2282 mkdir -p $bigdir/dev 2283 cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk" 2284 fi 2285 2286 # more stuff 2287 # cp -f $MINDI_LIB/embleer* $bigdir 2087 LogIt "Backing up $i's MBR\n" 2088 dd if=$i of=$bigdir/BOOTLOADER.MBR bs=446 count=1 >> $LOGFILE 2>> $LOGFILE 2089 sleep 1 2090 sync 2091 j=$i 2092 [ -h "$j" ] && j=`readlink -f $j` 2093 LogIt "Creating /dev/boot_device ($j)\n" 2094 mkdir -p $bigdir/dev 2095 cp -pRdf $j $bigdir/dev/boot_device || Die "Unable to create /dev/boot_device on ramdisk" 2096 fi 2097 2288 2098 old_pwd=`pwd` 2289 2099 cd $bigdir … … 2292 2102 cp -Rdf $MINDI_LIB/aux-tools/* . 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping aux-tools\n" 2293 2103 if [ -e "$MINDI_LIB/x11-tools.tgz" ] ; then 2294 tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"2104 tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n" 2295 2105 fi 2296 2106 if [ -e "$MONDO_SHARE/restore-scripts" ] ; then … … 2310 2120 # EXTRA_SPACE=$(($EXTRA_SPACE*2)) 2311 2121 # fi 2312 MakeMountlist $ TMP_ROOT/mountlist.txt2122 MakeMountlist $MONDOTMP/mountlist.txt 2313 2123 mkdir -p $minidir_root/$noof_disks/tmp 2314 cp -f $TMP_ROOT/mountlist.txt $minidir_root/$noof_disks/tmp/mountlist.txt || Die "Cannot copy mountlist.txt from $TMP_ROOT to data disk" 2315 cp -f $TMP_ROOT/mountlist.txt $CACHE_LOC 2316 [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDO_TMP/. 2124 cp -f $MONDOTMP/mountlist.txt $minidir_root/$noof_disks/tmp/mountlist.txt || Die "Cannot copy mountlist.txt from $MONDOTMP to data disk" 2125 [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDOTMP/. 2317 2126 [ $LVM != "false" ] && $MINDI_LIB/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm 2318 2127 cat $minidir_root/$noof_disks/tmp/mountlist.txt >> $LOGFILE … … 2320 2129 CreateDataDiskImagesFromTarballs $tardir $imagesdir $noof_disks 2321 2130 FRIENDLY_OUTSTRING="Boot and data disk images were created." 2322 # One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images2131 # One 1.72MB boot disk, one 2.88MB boot disk and $noof_disks data disk images 2323 2132 rmdir $tardir $bigdir 2324 2133 rm -f $needlist … … 2342 2151 2343 2152 2344 2345 2153 Prompt() { 2346 2154 echo -en "$1" 2347 2155 read line 2348 2156 } 2349 2350 2157 2351 2158 … … 2355 2162 i=0 2356 2163 while [ "$i" -le "32" ] && [ "$incoming" = "" ] ; do 2357 i=$(($i+1))2358 read incoming2164 i=$(($i+1)) 2165 read incoming 2359 2166 done 2360 2167 echo "$incoming" 2361 2168 } 2362 2363 2169 2364 2170 … … 2376 2182 [ -h "$minidir_root/$diskno/$fname" ] && MoveHyperlinkSensibly $fname $minidir_root $diskno $noof_disks 2377 2183 done 2378 diskno=$(($diskno+1)) 2379 done 2380 2184 diskno=$(($diskno+1)) 2185 done 2381 2186 2382 2187 cd $old_pwd 2383 2188 return 2384 2385 2386 2387 # do some awk/gawk stuff2388 cd $minidir_root2389 awk_loc=`find -name awk`2390 gawk_loc=`find -name gawk`2391 if [ "$awk_loc" = "" ] && [ "$gawk_loc" != "" ] ; then2392 for i in $gawk_loc ; do HackAwk $i gawk ; done2393 elif [ "$gawk_loc" = "" ] && [ "$awk_loc" != "" ] ; then2394 for i in $awk_loc ; do HackAwk $i awk ; done2395 elif [ "$gawk_loc" != "" ] && [ "$awk_loc" != "" ] ; then2396 echo -en "Gawk/awk found. Good.\r"2397 else2398 Die "Look, I don't want to come across as having an attitude, but you need either awk or gawk. Get a distro that doesn't suck, okay? :-)"2399 fi2400 cd $old_pwd2401 2189 } 2402 2190 … … 2404 2192 ReplaceIndividualLine() { 2405 2193 local orig_file new_file lino newstring lines_total lines_remaining 2194 2406 2195 orig_file=$1.orig 2407 2196 mv -f $1 $orig_file || Die "Cannot move $1 to $orig_file" … … 2410 2199 newstring="$3" 2411 2200 if [ "$lino" = "" ] || [ "$lino" -lt "1" ] ; then 2412 echo "Can't find string" >> $LOGFILE2413 return 12201 echo "Can't find string" >> $LOGFILE 2202 return 1 2414 2203 fi 2415 2204 lines_total=`wc -l $orig_file | gawk '{print $1;}'` … … 2420 2209 tail -n$lines_remaining $orig_file >> $new_file 2421 2210 echo "Replace line $lino of $new_file with user-specified line, '$newstring'" >> $LOGFILE 2422 # cp -f $new_file /tmp/init.new2423 2211 [ -x "$orig_file" ] && chmod +x $new_file 2424 2212 rm -f $orig_file … … 2434 2222 done 2435 2223 } 2436 2437 2224 2438 2225 … … 2441 2228 device=$1 2442 2229 if [ "`echo "$device" | grep -F "/dev/md"`" != "" ] ; then 2443 res=`SizeOfRaidPartition $device` 2444 [ "$res" = "" ] && Die "Cannot find $device's size - is your /etc/raidtab sane?" 2445 echo "$res" 2446 return 0 2447 fi 2448 # res=`$FDISK -l 2>> $LOGFILE | grep -w "$device" | head -n1 | sort -u | tr '*' ' ' | tr -s '\t' '|' | tr -s ' ' ' ' | cut -d' ' -f4 | sed s/+// | sed s/-//` 2449 # patch from Bill <bill@iwizard.biz> - 2003/08/25 2230 res=`SizeOfRaidPartition $device` 2231 [ "$res" = "" ] && Die "Cannot find $device's size - is your /etc/raidtab sane?" 2232 echo "$res" 2233 return 0 2234 fi 2235 # patch from Bill <bill@iwizard.biz> - 2003/08/25 2450 2236 res=`$FDISK -s $device` 2451 2237 echo "------- $FDISK -l $device log ------------" >> $LOGFILE 2452 2238 cat $FDISKLOG >> $LOGFILE 2453 2239 echo "------- $FDISK log end ------------" >> $LOGFILE 2454 # end patch2240 # end patch 2455 2241 [ "$res" = "" ] && res=`df -k -P -x supermount | tr -s '\t' ' ' | grep -F "$device " | cut -d' ' -f2` 2456 2242 [ "$res" = "" ] && res="-1" … … 2467 2253 2468 2254 for real_dev in `GetRaidDevMembers $1` ; do 2469 tmp=`SizeOfPartition $real_dev`2470 [ "$tmp" -lt "$smallest_size" ] && smallest_size=$tmp2255 tmp=`SizeOfPartition $real_dev` 2256 [ "$tmp" -lt "$smallest_size" ] && smallest_size=$tmp 2471 2257 done 2472 2258 2473 2259 if [ "$smallest_size" = "$silly" ] ; then 2474 echo "-1" 2475 return 1 2476 else 2477 echo "$smallest_size" 2478 return 0 2479 fi 2480 } 2481 2482 2483 2484 2260 echo "-1" 2261 return 1 2262 else 2263 echo "$smallest_size" 2264 return 0 2265 fi 2266 } 2485 2267 2486 2268 … … 2488 2270 { 2489 2271 local tempfile 2490 tempfile=$TMP_ROOT/$$.strip.txt 2272 2273 tempfile=$MONDOTMP/$$.strip.txt 2491 2274 cp -f $1 $tempfile 2492 2275 $AWK '{if (substr($0,0,1)!="#" || substr($0,0,3)=="#!/") {print $0;};}' $tempfile > $1 … … 2496 2279 2497 2280 2498 2499 2500 2501 2502 2281 SplitDirectoryIntoMinidirs() { 2503 2282 local bigdir minidir_root i noof_disks old_pwd res 2283 2504 2284 bigdir=$1 2505 2285 minidir_root=$2 … … 2509 2289 noof_disks=$? 2510 2290 if [ "$noof_disks" -eq "0" ] ; then 2511 echo "Failed to fit data into several dirs."2291 echo "Failed to fit data into several dirs." 2512 2292 return 0 2513 2293 fi 2514 2294 RejigHyperlinks $minidir_root $noof_disks 2515 2295 rm -Rf $bigdir/* 2516 return $noof_disks 2517 } 2518 2296 return $noof_disks 2297 } 2519 2298 2520 2299 … … 2522 2301 { 2523 2302 local tmpfile 2524 tmpfile=$TMP_ROOT/stripped.$$.dat 2303 2304 tmpfile=$MONDOTMP/stripped.$$.dat 2525 2305 [ -d "$1" ] || [ -h "$1" ] && return 2526 2306 cp -f $1 $tmpfile 2527 2307 strip $tmpfile 2> /dev/null 2528 2308 if [ "$?" -eq "0" ] ; then 2529 cp -f $tmpfile $12530 echo "Stripped binary $2" >> $LOGFILE2309 cp -f $tmpfile $1 2310 echo "Stripped binary $2" >> $LOGFILE 2531 2311 fi 2532 2312 rm -f $tmpfile … … 2553 2333 2554 2334 2555 2556 2335 TryToFindKernelPath() { 2557 2336 local fname incoming res fkern_ver we_want_version possible_kernels noof_kernels kernelpath kdate duff_kernels 2337 2558 2338 we_want_version=`uname -r` 2559 2339 possible_kernels="" … … 2566 2346 fi 2567 2347 for fname in `find $root -maxdepth 2 -type f | grep -F lin | grep -Ev '^/proc/|^/net/'` ; do 2568 [ ! -e "$fname" ] && continue2348 [ ! -e "$fname" ] && continue 2569 2349 [ "$fname" = "/boot/vmlinuz.shipped" ] && [ -f "/boot/vmlinuz" ] && continue; # ignore SuSE's extra kernel 2570 file $fname | grep -q gzip2571 if [ "$?" -eq "0" ] ; then2572 # Used by ia642350 file $fname | grep -q gzip 2351 if [ "$?" -eq "0" ] ; then 2352 # Used by ia64 2573 2353 fkern_ver=`gzip -cd $fname | strings 2> /dev/null | grep "[2-9]+*[.][0-9]+*[.][0-9]+*[^\@]*@"` 2574 else2354 else 2575 2355 fkern_ver=`strings $fname 2> /dev/null | grep "[2-9]+*[.][0-9]+*[.][0-9]+*[^\@]*@"` 2576 fi2356 fi 2577 2357 [ "$fkern_ver" = "" ] && continue 2578 # echo "$fname --> $fkern_ver (but we want $we_want_version)" >> /dev/stderr2579 2358 [ "`echo "$fkern_ver" |grep -F "$we_want_version "`" = "" ] && continue 2580 [ -f "$fname" ] || continue2581 [ -h "$fname" ] && continue2582 kdate=`uname -v | $AWK '{for(i=1;i<NF;i++){if(index($i,":")){print $i;};};}' | $AWK '{print $NF;}'`2583 file $fname | grep -q gzip2584 if [ "$?" -eq "0" ] ; then2585 # Used by ia642586 if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then2587 LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it...\n"2588 duff_kernels="$fname $duff_kernels"2589 else2359 [ -f "$fname" ] || continue 2360 [ -h "$fname" ] && continue 2361 kdate=`uname -v | $AWK '{for(i=1;i<NF;i++){if(index($i,":")){print $i;};};}' | $AWK '{print $NF;}'` 2362 file $fname | grep -q gzip 2363 if [ "$?" -eq "0" ] ; then 2364 # Used by ia64 2365 if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then 2366 LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it...\n" 2367 duff_kernels="$fname $duff_kernels" 2368 else 2590 2369 [ "`echo "$fname" | grep -F "vmlinux"`" ] && continue 2591 2370 possible_kernels="$fname $possible_kernels" 2592 fi 2593 else 2594 if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then 2595 LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it...\n" 2596 duff_kernels="$fname $duff_kernels" 2371 fi 2597 2372 else 2373 if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then 2374 LogIt "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it...\n" 2375 duff_kernels="$fname $duff_kernels" 2376 else 2598 2377 [ "`echo "$fname" | grep -F "vmlinux"`" ] && continue 2599 2378 possible_kernels="$fname $possible_kernels" 2600 fi2601 fi2379 fi 2380 fi 2602 2381 done 2603 2382 if [ ! "$possible_kernels" ] && uname -a | grep Knoppix > /dev/null ; then 2604 possible_kernels=`find /boot/vmlinuz-2.* | tail -n1`2383 possible_kernels=`find /boot/vmlinuz-2.* | tail -n1` 2605 2384 fi 2606 2385 if [ ! "$possible_kernels" ] ; then … … 2618 2397 if [ "$noof_kernels" -eq "0" ] ; then 2619 2398 LogIt "Could not find your kernel.\n" 2620 if [ -e "/boot/vmlinuz" ] ; then2621 LogIt "Using /boot/vmlinuz as a last resort.\n"2622 output=/boot/vmlinuz2399 if [ -e "/boot/vmlinuz" ] ; then 2400 LogIt "Using /boot/vmlinuz as a last resort.\n" 2401 output=/boot/vmlinuz 2623 2402 else 2624 output=""2625 fi2403 output="" 2404 fi 2626 2405 elif [ "$noof_kernels" -eq "1" ] ; then 2627 2406 kernelpath=`echo "$possible_kernels" | sed s/' '//` … … 2631 2410 for i in $possible_kernels ; do 2632 2411 if echo $i | grep "`uname -r`" ; then 2633 LogIt "OK, I used my initiative and found that "2412 LogIt "OK, I used my initiative and found that " 2634 2413 LogIt "$i is probably your kernel.\n " 2635 output="$i"2636 return2637 fi2414 output="$i" 2415 return 2416 fi 2638 2417 done 2639 if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null ; then2640 output=/boot/vmlinuz2641 echo "Schlomo, this one's for you." >> $LOGFILE2642 else2418 if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null ; then 2419 output=/boot/vmlinuz 2420 echo "Schlomo, this one's for you." >> $LOGFILE 2421 else 2643 2422 LogIt "Two or more possible kernels found. You may specify any one of them and the \n" 2644 LogIt "boot disks will still work, probably. If one does not work, try another.\n"2423 LogIt "boot disks will still work, probably. If one does not work, try another.\n" 2645 2424 LogIt "$possible_kernels\n" 2646 2425 echo "" 2647 fi2426 fi 2648 2427 fi 2649 2428 echo "$output" | tr -s ' ' '\n' | sort -u | tr '\n' ' ' 2650 2429 } 2651 2652 2653 2654 2430 2655 2431 … … 2657 2433 local bigdir minidir_root noof_disks diskno list_of_files filename old_pwd progress 2658 2434 local i retval noof_disks total_files list_of_devs 2435 2659 2436 bigdir=$1 2660 2437 minidir_root=$2 … … 2680 2457 for filename in $list_of_files ; do 2681 2458 AddFileToDir $filename $minidir_root $noof_disks 2682 i=$?2683 if [ "$i" -gt "$noof_disks" ] ; then2684 noof_disks=$i2685 echo -en "\r\t\t\t\t\t\t($noof_disks disks)"2686 fi2687 if [ "$i" -eq "0" ] ; then2688 LogIt "Cannot add file $filename to minidir $minidir_root\n"2689 retval=$(($retval+1))2690 fi2459 i=$? 2460 if [ "$i" -gt "$noof_disks" ] ; then 2461 noof_disks=$i 2462 echo -en "\r\t\t\t\t\t\t($noof_disks disks)" 2463 fi 2464 if [ "$i" -eq "0" ] ; then 2465 LogIt "Cannot add file $filename to minidir $minidir_root\n" 2466 retval=$(($retval+1)) 2467 fi 2691 2468 progress=$(($progress+1)) 2692 echo -en "\r\t\t\t\t\t\t\t\t$(($progress*100/$total_files))% complete\r"2469 echo -en "\r\t\t\t\t\t\t\t\t$(($progress*100/$total_files))% complete\r" 2693 2470 done 2694 2471 cd $old_pwd … … 2696 2473 rm -Rf $minidir_root/compressed 2697 2474 if [ "$retval" -gt "0" ] ; then 2698 return 0 2699 else 2700 return $noof_disks 2701 fi 2702 } 2703 2475 return 0 2476 else 2477 return $noof_disks 2478 fi 2479 } 2704 2480 2705 2481 2706 2482 TurnTgzIntoRdz() { 2707 2483 local tgz_dir_fname rdz_fname ramdisksize tempfile mountpoint old_pwd nodes disksize kernelsize maxsize res currsize not_copied j k floppy_modules s w 2484 2708 2485 tgz_dir_fname=$1 2709 2486 rdz_fname=$2 … … 2713 2490 maxsize=$(($disksize-$kernelsize)) 2714 2491 maxsize=$(($maxsize*2)); # to allow for compression of 50% 2715 tempfile=$ TMP_ROOT/temp.rd2716 mountpoint=$ TMP_ROOT/mnt12492 tempfile=$MONDOTMP/temp.rd 2493 mountpoint=$MONDOTMP/mnt1 2717 2494 res=0 2718 2495 echo -en "..." … … 2721 2498 mke2fs -b 1024 -m 1 -i 2048 -F $tempfile >> $LOGFILE 2>> $LOGFILE 2722 2499 2723 [ "$?" -ne "0" ] && cat /tmp/mke2fs.$$2724 rm -f /tmp/mke2fs.$$2500 [ "$?" -ne "0" ] && cat $MONDOTMP/mke2fs.log 2501 rm -f $MONDOTMP/mke2fs.log 2725 2502 echo -en "..." 2726 2503 mkdir -p $mountpoint … … 2729 2506 old_pwd=`pwd` 2730 2507 cd $mountpoint 2731 # [ -e "$MINDI_LIB/memtest.img" ] && echo "Yep, this is a multi-function CD" > MULTIFUNC2732 2508 cp -Rdf $tgz_dir_fname/* . 2>> $LOGFILE >> $LOGFILE 2733 2509 tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz" … … 2737 2513 cd .. 2738 2514 2739 # add insmod.static and insmod.static.old if (a) they exist and (b) this is a 64-bit distro2740 # if [ "`uname -a | grep x86`" ] || [ "`uname -a | grep amd64`" ] ; then2741 2742 2515 for w in insmod.static insmod.static.old ; do 2743 s=`which $w 2> /dev/null` 2744 if [ -e "$s" ] ; then 2745 cp --parents -af $s . 2746 # LogIt "Copying $s to initrd" 2747 fi 2748 done 2749 2750 # fi 2516 s=`which $w 2> /dev/null` 2517 if [ -e "$s" ] ; then 2518 cp --parents -af $s . 2519 fi 2520 done 2751 2521 2752 2522 mkdir -p tmp … … 2755 2525 mkdir -p mnt/$w 2756 2526 done 2757 if [ "$RUN_AFTER_INITIAL_BOOT_PHASE" ] ; then2758 ReplaceIndividualLine sbin/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" sbin/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"2759 fi2527 #if [ "$RUN_AFTER_INITIAL_BOOT_PHASE" ] ; then 2528 #ReplaceIndividualLine sbin/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" sbin/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE" 2529 #fi 2760 2530 if [ "$RUN_AFTER_BOOT_PHASE_COMPLETE" ] ; then 2761 ReplaceIndividualLine sbin/init `grep -n "#ABSORBENTANDYELLOWANDPOROUSISHE#" sbin/init | cut -d':' -f1` "$RUN_AFTER_BOOT_PHASE_COMPLETE"2531 ReplaceIndividualLine sbin/init `grep -n "#ABSORBENTANDYELLOWANDPOROUSISHE#" sbin/init | cut -d':' -f1` "$RUN_AFTER_BOOT_PHASE_COMPLETE" 2762 2532 fi 2763 2533 … … 2771 2541 old_pwd=`pwd` 2772 2542 if [ "$YOUR_KERNEL_SUCKS" ] ; then 2773 cd $ TMP_ROOT2543 cd $MONDOTMP 2774 2544 floppy_modules_path=lib/modules/$FAILSAFE_KVER 2775 2545 else … … 2795 2565 list_of_groovy_mods="$CDROM_MODS `WhichOfTheseModulesAreLoaded "$SCSI_MODS"`" 2796 2566 fi 2797 if [ -e "$MONDO _TMP/NFS-DEV" ] ; then2567 if [ -e "$MONDOTMP/NFS-DEV" ] ; then 2798 2568 # For PXE boot 2799 2569 list_of_groovy_mods="$list_of_groovy_mods $NET_MODS" … … 2805 2575 for i in $floppy_modules ; do 2806 2576 [ -e "$i" ] && s=`du -sk $i | cut -f1` || s="" 2807 [ "$YOUR_KERNEL_SUCKS" ] && i=$ TMP_ROOT/$i2577 [ "$YOUR_KERNEL_SUCKS" ] && i=$MONDOTMP/$i 2808 2578 echo "Adding $i ($s KB) to the rootfs" >> $LOGFILE 2809 2579 cp -df $i $mountpoint/ || LogIt "Unable to copy $i to $mountpoint\n" 2810 2580 [ "`echo "$i" | grep -F ".gz"`" ] && gunzip -f $mountpoint/`basename $i` 2811 2581 done 2812 # if [ -e "/dev/.devfsd" ] ; then2813 # echo "Copying devfs stuff to ramdisk" >> $LOGFILE2814 # for i in /dev /etc/devfsd.conf /etc/modules.devfs /lib/dev-state ; do2815 # cp --parents -pRdf $i $mountpoint/ 2>> $LOGFILE2816 # done2817 # fi2818 2582 if [ ! -e "/sbin/devfsd" ] || [ "$disksize" -lt "2880" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then 2819 2583 echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE … … 2821 2585 [ "$disksize" -lt "2880" ] && echo "...because disksize = $disksize" >> $LOGFILE 2822 2586 [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] && echo "...because kernel is failsafe" >> $LOGFILE 2823 # ls -l $mountpoint/sbin/devfsd &> /dev/null || Die "Can't find devfsd daemon on ramdisk"2824 2587 rm -f $mountpoint/sbin/devfsd 2825 2588 fi … … 2830 2593 if [ "`DidMondoCallMe`" ] ; then 2831 2594 MakeMondoConfigFile $mountpoint/tmp/mondo-restore.cfg 2832 cp -f $mountpoint/tmp/mondo-restore.cfg $MONDO _TMP &> /dev/null2833 cp -f $ TMP_ROOT/mountlist.txt $mountpoint/tmp/ || Die "Cannot copy mountlist to ramdisk"2595 cp -f $mountpoint/tmp/mondo-restore.cfg $MONDOTMP &> /dev/null 2596 cp -f $MONDOTMP/mountlist.txt $mountpoint/tmp/ || Die "Cannot copy mountlist to ramdisk" 2834 2597 echo -en "$FILES_IN_FILELIST" > $mountpoint/tmp/FILES-IN-FILELIST 2835 2598 echo -en "$LAST_FILELIST_NUMBER" > $mountpoint/tmp/LAST-FILELIST-NUMBER … … 2855 2618 2856 2619 2857 2858 2620 WhichOfTheseModulesAreLoaded() { 2859 2621 local modname loaded_modules 2860 2622 loaded_modules=" `lsmod | tr -s ' ' '\t' | cut -f1 | grep -Fvx "Modules" | tr '\n' ' '` " 2861 2623 for modname in $1 ; do 2862 [ "`echo "$loaded_modules" | grep -F " $modname "`" ] && echo "$modname" 2863 done 2864 } 2865 2866 2624 [ "`echo "$loaded_modules" | grep -F " $modname "`" ] && echo "$modname" 2625 done 2626 } 2867 2627 2868 2628 … … 2883 2643 diskno=$(($diskno+1)) 2884 2644 echo -n "..." 2885 cp -pRdf * $minidir_root/all2645 cp -pRdf * $minidir_root/all 2886 2646 done 2887 2647 mkdir -p $minidir_root/all/tmp … … 2890 2650 if [ "`DidMondoCallMe`" ] ; then 2891 2651 for q in filelist.full.gz biggielist.txt ; do 2892 [ ! -e "$MONDO _TMP/$q" ] && Die "Cannot find $MONDO_TMP/$q"2893 cp -pRdf $MONDO _TMP/$q tmp/2652 [ ! -e "$MONDOTMP/$q" ] && Die "Cannot find $MONDOTMP/$q" 2653 cp -pRdf $MONDOTMP/$q tmp/ 2894 2654 done 2895 2655 mkdir -p $minidir_root/all/tmp … … 2906 2666 2907 2667 2908 2909 # BERLIOS: This function is wrong2910 # Should be recoded. Desactivated in between2911 2912 #ListUnsavedKernelModules() {2913 #local fname modules2914 #fname=/tmp/$RANDOM.$$.$RANDOM2915 #lsmod | sed -n '2,$s/ .*//p' > $fname2916 #modules=`sort $fname | uniq -d2 | tr '\n' ' '`2917 #rm -f $fname2918 #[ "$modules" ] && echo "Unsaved kernel modules: $modules" >> $LOGFILE2919 #}2920 2921 2922 2923 2924 2925 2668 ############################################################################## 2926 2669 #----------------------------------- main -----------------------------------# 2927 2670 ############################################################################## 2928 2671 2929 2930 #AWK=`which gawk`2931 #LocateDeps $12932 #MakeModuleLoadingScript /tmp/load-modules.sh2933 #exit 02934 2935 2936 #cat /etc/mindi/deplist.txt | GenerateGiantDependencyList /tmp/deplist.old 2002937 #exit 02938 2939 2940 2941 if [ "$1" = "-V" ] || [ "$1" = "-v" ] || [ "$1" = "--version" ] || [ "$1" = "-version" ] ; then2942 echo "mindi v$MINDI_VERSION"2943 exit 02944 fi2945 2672 2946 2673 > $LOGFILE … … 2969 2696 # modprobe.conf file is created in MakeModuleLoadingScript. AL041128. 2970 2697 if [ -d "/etc/modprobe.d" ] && [ `uname -r | cut -c1-3` == "2.6" ] ; then 2971 2698 TMPMODPROBE_FLAG="Y" 2972 2699 else 2973 2974 2975 2700 TMPMODPROBE_FLAG="N" 2701 [ -e "/etc/modprobe.conf" ] && [ ! -e "/etc/modules.conf" ] && ln -sf /etc/modprobe.conf /etc/modules.conf 2702 [ ! -e "/etc/modules.conf" ] && Die "/etc/modules.conf not found; you may have to create a softlink from /etc/conf.modules to /etc/modules.conf; of course, all good distros use modules.conf anyway..." 2976 2703 fi 2977 2704 FixPathIfBroken 2978 2705 [ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep -E "2\.[46]" | cut -d' ' -f1` 2979 2706 AbortIfMkfsVfatMissing 2980 ### B CO2707 ### BERLIOS 2981 2708 ### Fix as it's not mandatory on ia64 2982 2709 if [ "$ARCH" = "ia64" ] ; then … … 2986 2713 FindLiloBinary 2987 2714 fi 2988 grep -F " $TMP_ROOT " /proc/mounts | grep -F tmpfs > /dev/null 2> /dev/null && TMP_ROOT=/home && LogIt "Changing TMP_ROOT to $TMP_ROOT because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason 2989 rm -f /tmp/mindi_lo 2715 # BERLIOS: Remove as too dangerous and now useless 2716 #grep -F " $MONDOTMP " /proc/mounts | grep -F tmpfs > /dev/null 2> /dev/null && MONDOTMP=/home/tmpmondo && mkdir -p $MONDOTMP && LogIt "Changing MONDOTMP to $MONDOTMP because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason 2990 2717 trap "Aborted" SIGTERM 2991 2718 DONE="\r\t\t\t\t\t\t\t\tDone. " … … 2993 2720 BIGNO=0 2994 2721 MAX_COMPRESSED_SIZE=1300 2995 imagesdir=/root/images/mindi2996 mkdir -p $imagesdir2997 2722 kernelpath="" 2998 MONDO_ROOT= /tmp/mindilinux/mondo-root2723 MONDO_ROOT=$TMPMONDO/mondo-root 2999 2724 mkdir -p $MONDO_ROOT 3000 2725 … … 3029 2754 if [ "$1" = "--findkernel" ] ; then 3030 2755 res=`TryToFindKernelPath` 3031 # 2> /dev/null`3032 2756 if [ "$res" = "" ] ; then 3033 exit12757 MindiExit -1 3034 2758 else 3035 2759 echo "$res" 3036 exit 02760 MindiExit 0 3037 2761 fi 3038 2762 elif [ "$1" = "--makemountlist" ] ; then 3039 2763 [ ! "$2" ] && Die "Please specify the output file" 3040 2764 MakeMountlist $2 3041 exit $?3042 elif [ "$1" = " --version" ] || [ "$1" = "-v" ] ; then3043 echo "Mindi v$MINDI_VERSION"3044 exit 02765 MindiExit $? 2766 elif [ "$1" = "-V" ] || [ "$1" = "-v" ] || [ "$1" = "--version" ] || [ "$1" = "-version" ] ; then 2767 echo "Mindi v$MINDI_VERSION" 2768 MindiExit 0 3045 2769 elif [ "$#" -ge "9" ] && [ "$1" = "--custom" ] ; then 3046 TMP_ROOT=$2 3047 MONDO_TMP=$2 3048 imagesdir=$3 3049 kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath="" 2770 MONDOTMP=$2 2771 BIDON=$3 2772 kernelpath=$4; [ "$kernelpath" = "(null)" ] && kernelpath="" 3050 2773 ### 3051 2774 ### Sq-Modification... … … 3054 2777 ### 3055 2778 kernelname=`echo $kernelpath | cut -d'-' -f2-` 3056 LogIt "kernelname = $kernelname\n"3057 LogIt "kernelpath = $kernelpath\n"2779 LogIt "kernelname = $kernelname\n" 2780 LogIt "kernelpath = $kernelpath\n" 3058 2781 if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ] 3059 2782 then … … 3067 2790 ### end of Sq-Modification 3068 2791 ### 3069 TAPEDEV=$53070 TAPESIZE=$63071 FILES_IN_FILELIST=$73072 USE_LZO=$83073 CDRECOVERY=$92792 TAPEDEV=$5 2793 TAPESIZE=$6 2794 FILES_IN_FILELIST=$7 2795 USE_LZO=$8 2796 CDRECOVERY=$9 3074 2797 if [ "${10}" = "(null)" ] || [ "${10}" = "" ] ; then 3075 2798 IMAGE_DEVS="" … … 3077 2800 IMAGE_DEVS="`echo "${10}" | tr '|' ' '`" 3078 2801 fi 3079 if [ "${11}" ] ; then3080 LILO_OPTIONS=""3081 # LogIt "LILO will use conservative settings, to be compatible with older BIOSes."3082 fi3083 LAST_FILELIST_NUMBER=${12}2802 if [ "${11}" ] ; then 2803 LILO_OPTIONS="" 2804 # LogIt "LILO will use conservative settings, to be compatible with older BIOSes." 2805 fi 2806 LAST_FILELIST_NUMBER=${12} 3084 2807 ESTIMATED_TOTAL_NOOF_SLICES=${13} 3085 2808 EXCLUDE_DEVS="${14}" 3086 2809 USE_COMP="${15}" 3087 2810 USE_LILO="${16}" 3088 USE_STAR="${17}"3089 INTERNAL_TAPE_BLOCK_SIZE="${18}"2811 USE_STAR="${17}" 2812 INTERNAL_TAPE_BLOCK_SIZE="${18}" 3090 2813 DIFFERENTIAL="${19}" 3091 2814 NOT_BOOT="${20}" 3092 2815 [ "$USE_COMP" = "" ] && USE_COMP=yes 3093 2816 [ "$NOT_BOOT" = "" ] && NOT_BOOT=no 3094 [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine.\n"3095 [ "$kernelpath" = "" ] && kernelpath=`TryToFindKernelPath`2817 [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine.\n" 2818 [ "$kernelpath" = "" ] && kernelpath=`TryToFindKernelPath` 3096 2819 kernelname=`echo $kernelpath | cut -d'-' -f2-` 3097 2820 if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ] … … 3103 2826 LogIt "Using modules for kernel: ${kernelname}\n" 3104 2827 fi 3105 [ "$CDRECOVERY" = "yes" ] && [ "$TAPEDEV" != "" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time"3106 MONDO_ROOT=`echo $ imagesdir| sed 's/\(.*\)\/.*/\1/'`3107 [ "$MONDO_ROOT" = "" ] && Die "MONDO_ROOT is undefined"3108 else 3109 echo "Syntax: mindi (--custom ....)" >> /dev/stderr3110 exit12828 [ "$CDRECOVERY" = "yes" ] && [ "$TAPEDEV" != "" ] && Die "Sorry, you can't use --cd-recovery and --write-tapes at the same time" 2829 MONDO_ROOT=`echo $CACHE_LOC | sed 's/\(.*\)\/.*/\1/'` 2830 [ "$MONDO_ROOT" = "" ] && Die "MONDO_ROOT is undefined" 2831 else 2832 echo "Syntax: mindi (--custom ....)" >> /dev/stderr 2833 MindiExit -1 3111 2834 fi 3112 2835 fi … … 3122 2845 3123 2846 3124 3125 3126 #ReplaceIndividualLine /tmp/init `grep -n "#WHOLIVESINAPINEAPPLEUNDERTHESEA#" /tmp/init | cut -d':' -f1` "$RUN_AFTER_INITIAL_BOOT_PHASE"3127 #exit 03128 3129 3130 #ListKernelModules3131 #exit 03132 3133 3134 3135 3136 2847 [ -e "$iso_cfg_file" ] || Die "Cannot find $iso_cfg_file" 3137 rm -Rf $TMP_ROOT/mindilinux/*3138 TMP_ROOT=$TMP_ROOT/mindilinux/$$3139 mkdir -p $TMP_ROOT3140 mkdir -p $imagesdir3141 2848 if [ ! "`DidMondoCallMe`" ] ; then 3142 2849 LogIt "Mindi Linux mini-distro generator v$MINDI_VERSION\n" … … 3161 2868 if [ "$NOT_BOOT" != "" ] && [ "$NOT_BOOT" != "0" ] && [ "$NOT_BOOT" != "no" ] ; then 3162 2869 LogIt "Just creating mondo-restore.cfg and a small all.tar.gz for Mondo. Nothing else.\n" 3163 MakeMondoConfigFile $MONDO _TMP/mondo-restore.cfg3164 MakeMountlist $MONDO _TMP/mountlist.txt3165 mkdir -p $MONDO _TMP/small-all/tmp3166 cd $MONDO _TMP/small-all3167 cp -f $MONDO _TMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp || Die "Cannot copy small all.tar.gz"3168 tar -cv tmp | gzip -9 > $MONDO _TMP/all.tar.gz || Die "Cannot make small all.tar.gz"2870 MakeMondoConfigFile $MONDOTMP/mondo-restore.cfg 2871 MakeMountlist $MONDOTMP/mountlist.txt 2872 mkdir -p $MONDOTMP/small-all/tmp 2873 cd $MONDOTMP/small-all 2874 cp -f $MONDOTMP/{mountlist.txt,mondo-restore.cfg,filelist.full.gz,biggielist.txt} tmp || Die "Cannot copy small all.tar.gz" 2875 tar -cv tmp | gzip -9 > $MONDOTMP/all.tar.gz || Die "Cannot make small all.tar.gz" 3169 2876 sleep 2 3170 2877 LogIt "Done. Exiting.\n" 3171 exit 02878 MindiExit 0 3172 2879 fi 3173 2880 … … 3182 2889 fi 3183 2890 if [ "$USE_OWN_KERNEL" = "yes" ]; then 3184 YOUR_KERNEL_SUCKS=""3185 kernelpath=`TryToFindKernelPath`3186 if [ "$kernelpath" = "" ] ; then3187 echo -n "Please enter kernel path : "3188 read kernelpath3189 fi3190 else 3191 YOUR_KERNEL_SUCKS="That's why you're using mine, dude. :-)"2891 YOUR_KERNEL_SUCKS="" 2892 kernelpath=`TryToFindKernelPath` 2893 if [ "$kernelpath" = "" ] ; then 2894 echo -n "Please enter kernel path : " 2895 read kernelpath 2896 fi 2897 else 2898 YOUR_KERNEL_SUCKS="That's why you're using mine, dude. :-)" 3192 2899 fi 3193 2900 fi … … 3207 2914 LogIt "disks then it may still be a result of a problem with your kernel.\n" 3208 2915 pwd=`pwd` 3209 cd $ TMP_ROOT2916 cd $MONDOTMP 3210 2917 bzip2 -dc $MINDI_LIB/lib.tar.bz2 | tar -x || Die "Cannot unzip lib.tar.bz2" 3211 2918 cd $pwd 3212 2919 YOUR_KERNEL_SUCKS="Your kernel sucks" 3213 2920 fi 3214 echo -e "Mindi's temp dir = $ TMP_ROOT \nMindi's output dir=$imagesdir" >> $LOGFILE2921 echo -e "Mindi's temp dir = $MONDOTMP \nMindi's output dir=$CACHE_LOC" >> $LOGFILE 3215 2922 [ "$(($RANDOM%64))" -eq "0" ] && LogIt "Dude, I've looked inside your computer and it's really dusty...\n" 3216 rm -f /tmp/mindi.err.*.tgz3217 2923 3218 2924 [ "$YOUR_KERNEL_SUCKS" ] && [ ! "$FAILSAFE_KVER" ] && Die "Please install mindi-kernel package. You need it. Go to http://www.mondorescue.org and download it, then install it." … … 3220 2926 rm -f /root/images/mindi/{*img,*gz,*iso} 3221 2927 3222 PrepareDataDiskImages $ imagesdir2928 PrepareDataDiskImages $CACHE_LOC 3223 2929 noof_disks=$? 3224 2930 ramdisk_size=$(($size_of_all_tools+$EXTRA_SPACE)) … … 3229 2935 if [ "$USE_LILO" = "yes" ] ; then 3230 2936 if [ "$ARCH" = "ia64" ] ; then 3231 PrepareBootDiskImage_LILO $ imagesdir$IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image."3232 else 3233 if ! PrepareBootDiskImage_LILO $ imagesdir1722 $kernelpath $ramdisk_size ; then2937 PrepareBootDiskImage_LILO $CACHE_LOC $IA64_BOOT_SIZE $kernelpath $ramdisk_size || Die "Failed to create ia64 floppy disk image." 2938 else 2939 if ! PrepareBootDiskImage_LILO $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then 3234 2940 LogIt "Warning - failed to create 1.72MB boot image. Please reduce your kernel's size\n" 3235 2941 LogIt "if you want to make a 1.72MB floppy disk.\n" 3236 2942 fi 3237 if ! PrepareBootDiskImage_LILO $ imagesdir2880 $kernelpath $ramdisk_size ; then2943 if ! PrepareBootDiskImage_LILO $CACHE_LOC 2880 $kernelpath $ramdisk_size ; then 3238 2944 LogIt "Warning - failed to create 2.88MB floppy disk image.\n" 3239 2945 LogIt "Please reduce your kernel's size\n" 3240 2946 LogIt "if you want to make a 2.88MB floppy disk.\n" 3241 PrepareBootDiskImage_LILO $ imagesdir5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image."2947 PrepareBootDiskImage_LILO $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 2.88MB floppy disk image." 3242 2948 fi 3243 2949 fi 3244 2950 else 3245 if ! PrepareBootDiskImage_SYSLINUX $ imagesdir1722 $kernelpath $ramdisk_size ; then2951 if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 1722 $kernelpath $ramdisk_size ; then 3246 2952 LogIt "Warning - failed to create 1.72MB boot image. Please reduce your kernel's size\n" 3247 2953 LogIt "if you want to make a 1.72MB floppy disk.\n" 3248 if ! PrepareBootDiskImage_SYSLINUX $ imagesdir2880 $kernelpath $ramdisk_size ; then2954 if ! PrepareBootDiskImage_SYSLINUX $CACHE_LOC 2880 $kernelpath $ramdisk_size ; then 3249 2955 LogIt "Warning - failed to create 2.88MB floppy disk image.\n" 3250 2956 LogIt "Please reduce your kernel's size\n" 3251 2957 LogIt "if you want to make a 2.88MB floppy disk.\n" 3252 PrepareBootDiskImage_SYSLINUX $ imagesdir5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image."2958 PrepareBootDiskImage_SYSLINUX $CACHE_LOC 5760 $kernelpath $ramdisk_size || Die "Failed to create 5.76MB floppy disk image." 3253 2959 fi 3254 2960 fi 3255 2961 fi 3256 3257 3258 2962 3259 2963 [ -e "$MINDI_LIB/memtest.img" ] && BOOT_MEDIA_MESSAGE="$BOOT_MEDIA_MESSAGE\n\ 3260 2964 ...Or type 'memtest' to test your PC's RAM thoroughly.\n" 3261 2965 3262 3263 2966 if [ ! "`DidMondoCallMe`" ] ; then 3264 ListImagesForUser $ imagesdir2967 ListImagesForUser $CACHE_LOC 3265 2968 boot_dev=/dev/fd0u1722 3266 2969 [ ! -e "$boot_dev" ] && mknod $boot_dev b 2 60 … … 3268 2971 [ ! -e "$boot_dev" ] && Die "Oh Lord, will you PLEASE tell the vendor to create the 1.72MB devices in /dev?" 3269 2972 if [ "$PROMPT_WRITE_BOOT_FLOPPIES" = "yes" ]; then 3270 OfferToCopyImagesToDisks $ imagesdir$boot_dev $FDDEVICE3271 fi 3272 OfferToMakeBootableISO $ imagesdir2973 OfferToCopyImagesToDisks $CACHE_LOC $boot_dev $FDDEVICE 2974 fi 2975 OfferToMakeBootableISO $CACHE_LOC 3273 2976 LogIt "Finished.\n" 3274 2977 elif [ "$TAPEDEV" ] ; then 3275 2978 mkdir -p /root/images/mindi 3276 2979 rm -f /root/images/mindi/{*img,*gz,*iso} 3277 OfferToMakeBootableISO $ imagesdir3278 if [ -e "$ imagesdir/all.tar.gz" ] ; then3279 cp -f $ imagesdir/all.tar.gz $MONDO_TMP/3280 else 3281 Die "Cannot find all.tar.gz, to be written to tape"2980 OfferToMakeBootableISO $CACHE_LOC 2981 if [ -e "$CACHE_LOC/all.tar.gz" ] ; then 2982 cp -f $CACHE_LOC/all.tar.gz $MONDOTMP/ 2983 else 2984 Die "Cannot find all.tar.gz, to be written to tape" 3282 2985 fi 3283 2986 else 3284 OfferToMakeBootableISO $ imagesdir2987 OfferToMakeBootableISO $CACHE_LOC 3285 2988 fi 3286 if [ "$imagesdir" != "/root/images/mindi" ] ; then3287 for i in `find $imagesdir -maxdepth 1 -name "*.iso" -o -name "*.img"` ; do3288 cp -f $i /root/images/mindi || LogIt "[line 3260] Cannot copy $i to /root/images/mindi\n"3289 done3290 fi3291 [ "$TMP_ROOT" != "/tmp" ] && rm -Rf $TMP_ROOT3292 2989 # cleanup 3293 rm - fR /tmp/mountlist.txt.$$ $FDISKLOG /tmp/mindilinux2990 rm -Rf $MONDOTMP $FDISKLOG 3294 2991 LogIt "$FRIENDLY_OUTSTRING\n" 3295 #ListUnsavedKernelModules3296 2992 for mtpt in $FLOPPY_WAS_MOUNTED ; do 3297 2993 mount $mtpt 3298 2994 done 3299 echo "Mindi is exiting" >> $LOGFILE 3300 echo "End date : `date`" >> $LOGFILE 3301 exit 0 2995 MindiExit 0
Note:
See TracChangeset
for help on using the changeset viewer.