1#!/bin/sh 2# 3# setup 4.1 - install a MINIX distribution 4# 5# Changes: 6# Aug 2005 robustness checks and beautifications (Jorrit N. Herder) 7# Jul 2005 extended with autopart and networking (Ben Gras) 8# Dec 20, 1994 created (Kees J. Bot) 9# 10 11LOCALRC=/usr/etc/rc.local 12MYLOCALRC=/mnt/etc/rc.local 13ROOTMB=64 14ROOTSECTS="`expr $ROOTMB '*' 1024 '*' 2`" 15BOOTXXSECTS=32 16USRKB="`du -sxk /usr | awk '{ print $1 }'`" 17TOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`" 18ROOTFILES="`find -x / | wc -l`" 19USRFILES="`find -x /usr | wc -l`" 20 21# /usr/install isn't copied onto the new system; compensate 22INSTALLDIR=/usr/install 23if [ -d $INSTALLDIR ] 24then USRFILES=$(($USRFILES - `find -x $INSTALLDIR | wc -l`)) 25 USRKB=$(($USRKB - `du -sxk $INSTALLDIR | awk '{ print $1 }'`)) 26fi 27 28if [ -z "$FSTYPE" ] 29then FSTYPE=mfs 30fi 31 32PATH=/bin:/sbin:/usr/bin:/usr/sbin 33export PATH 34 35 36usage() 37{ 38 cat >&2 <<'EOF' 39Usage: setup # Install a skeleton system on the hard disk. 40 setup /usr # Install the rest of the system (binaries or sources). 41 42 # To install from other things then floppies: 43 44 fetch -q -o - http://... | setup /usr # Read from a web site. 45 fetch -q -o - ftp://... | setup /usr # Read from an FTP site. 46 mtools copy c0d0p0:... - | setup /usr # Read from the C: drive. 47 dosread c0d0p0 ... | setup /usr # Likewise if no mtools. 48EOF 49 exit 1 50} 51 52warn() 53{ 54 echo -e "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b ! $1" 55} 56 57check_mbr() 58{ 59 # check for potential problems with old mbr. 60 disk=`echo -n "/dev/$primary" | sed 's/p[0-3]//'` 61 minix_primaries=`echo -n "" | fdisk "$disk" | grep "MINIX" | wc -l` 62 if [ "$minix_primaries" -gt 1 ] 63 then 64 # old mbr + bootxx will not work with several partitions of 65 # the same type. 66 dd if=/usr/mdec/mbr of=temp_mbr_netbsd bs=1 count=440 2>/dev/null 67 dd if="$disk" bs=1 count=440 2>/dev/null | cmp - temp_mbr_netbsd >/dev/null 68 if [ "$?" -ne 0 ] 69 then 70 echo "" 71 echo "Warning: you have MBR which doesn't support multiple MINIX 3 partitions!" 72 echo "You will be able to boot from the first one only!" 73 echo -n "Do you want to install new MBR into $disk? [Y] " 74 read ok 75 if [ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] 76 then 77 installboot_nbsd -m "$disk" /usr/mdec/mbr >/dev/null 78 fi 79 fi 80 rm temp_mbr_netbsd 81 fi 82 83} 84 85# No options. 86while getopts '' opt; do usage; done 87shift `expr $OPTIND - 1` 88 89if [ "$USER" != root ] 90then echo "Please run setup as root." 91 exit 1 92fi 93 94# Find out what we are running from. 95exec 9<&0 </etc/mtab # Mounted file table. 96read thisroot rest # Current root (/dev/ram or /dev/fd?) 97read fdusr rest # USR (/dev/fd? or /dev/fd?p2) 98exec 0<&9 9<&- 99 100# What do we know about ROOT? 101case $thisroot:$fdusr in 102/dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0 103 ;; 104/dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1 105 ;; 106/dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy 107 ;; 108/dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly 109 ;; 110*) fdroot=$thisroot # ? 111esac 112 113echo -n " 114Welcome to the MINIX 3 setup script. This script will guide you in setting up 115MINIX on your machine. Please consult the manual for detailed instructions. 116 117Note 1: If the screen blanks, hit CTRL+F3 to select \"software scrolling\". 118Note 2: If things go wrong then hit CTRL+C to abort and start over. 119Note 3: Default answers, like [y], can simply be chosen by hitting ENTER. 120Note 4: If you see a colon (:) then you should hit ENTER to continue. 121:" 122read ret 123 124# begin Step 1 125echo "" 126echo " --- Step 1: Select keyboard type --------------------------------------" 127echo "" 128 129 echo "What type of keyboard do you have? You can choose one of:" 130 echo "" 131 ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /' 132 echo "" 133step1="" 134while [ "$step1" != ok ] 135do 136 echo -n "Keyboard type? [us-std] "; read keymap 137 test -n "$keymap" || keymap=us-std 138 if loadkeys "/usr/lib/keymaps/$keymap.map" 2>/dev/null 139 then step1=ok 140 else warn "invalid keyboard" 141 fi 142done 143# end Step 1 144 145# begin Step 2 146#step2="" 147#while [ "$step2" != ok ] 148#do 149# echo "" 150# echo " --- Step 2: Select minimal or full distribution -----------------------" 151# echo "" 152# echo "You can install MINIX as (M)inimal or (F)ull. (M)inimal" 153# echo "includes only the binary system and basic system sources." 154# echo "(F)ull also includes commands sources." 155# echo "" 156# echo "Please select:" 157# echo " (M)inimal install (only basic sources) ($NOSRCMB MB required)" 158# echo " (F)ull install (full install) ($TOTALMB MB required)" 159# echo " " 160# echo -n "Basic (M)inimal or (F)ull install? [F] " 161# read conf 162# case "$conf" in 163# "") step2="ok"; nobigsource="" ;; 164# [Ff]*) step2="ok"; nobigsource="" ;; 165# [Mm]*) step2="ok"; nobigsource="1"; TOTALMB=$NOSRCMB; USRFILES=$NOSRCUSRFILES ;; 166# esac 167#done 168# end Step 2 169 170echo "" 171echo " --- Step 2: Selecting full distribution -------------------------------" 172echo "" 173nobigsource="" 174 175# begin Step 3 176step3="" 177while [ "$step3" != ok ] 178do 179 echo "" 180 echo " --- Step 3: Create or select a partition for MINIX 3 -------------------" 181 echo "" 182 183 echo "Now you need to create a MINIX 3 partition on your hard disk." 184 echo "You can also select one that's already there." 185 echo " " 186 echo "If you have an existing installation, reinstalling will let you" 187 echo "keep your current partitioning and subpartitioning, and overwrite" 188 echo "everything except your s1 subpartition (/home). If you want to" 189 echo "reinstall, select your existing minix partition." 190 echo " " 191 echo "Unless you are an expert, you are advised to use the automated" 192 echo "step-by-step help in setting up." 193 echo "" 194 ok="" 195 while [ "$ok" = "" ] 196 do 197 echo -n "Press ENTER for automatic mode, or type 'expert': " 198 read mode 199 if [ -z "$mode" ]; then auto="1"; ok="yes"; fi 200 if [ "$mode" = expert ]; then auto=""; ok="yes"; fi 201 if [ "$ok" != yes ]; then warn "try again"; fi 202 done 203 204 primary= 205 206 if [ -z "$auto" ] 207 then 208 # Expert mode 209 echo -n " 210MINIX needs one primary partition of $TOTALMB MB for a full install, 211plus what you want for /home. 212 213If there is no free space on your disk then you have to choose an option: 214 (1) Delete one or more partitions 215 (2) Allocate an existing partition to MINIX 3 216 (3) Exit setup and shrink a partition using a different OS 217 218To make this partition you will be put in the editor \"part\". Follow the 219advice under the '!' key to make a new partition of type MINIX. Do not 220touch an existing partition unless you know precisely what you are doing! 221Please note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you 222make. (See the devices section in usage(8) on MINIX device names.) 223:" 224 read ret 225 226 while [ -z "$primary" ] 227 do 228 part || exit 229 230 echo -n " 231Please finish the name of the primary partition you have created: 232(Just type ENTER if you want to rerun \"part\") /dev/" 233 read primary 234 done 235 echo "" 236 echo "This is the point of no return. You have selected to install MINIX" 237 echo "on partition /dev/$primary. Please confirm that you want to use this" 238 echo "selection to install MINIX." 239 echo "" 240 confirmation="" 241 242 if [ ! -b "/dev/$primary" ] 243 then echo "/dev/$primary is not a block device." 244 fi 245 246 while [ -z "$confirmation" -o "$confirmation" != yes -a "$confirmation" != no ] 247 do 248 echo -n "Are you sure you want to continue? Please enter 'yes' or 'no': " 249 read confirmation 250 if [ "$confirmation" = yes ]; then step3=ok; fi 251 done 252 biosdrivename="Actual BIOS device name unknown, due to expert mode." 253 else 254 if [ "$auto" = "1" ] 255 then 256 # Automatic mode 257 PF="/tmp/pf" 258 if autopart -m$TOTALMB -f$PF 259 then if [ -s "$PF" ] 260 then 261 set `cat $PF` 262 bd="$1" 263 bdn="$2" 264 biosdrivename="Probably, the right command is \"boot $bdn\"." 265 if [ -b "/dev/$bd" ] 266 then primary="$bd" 267 else echo "Funny device $bd from autopart." 268 fi 269 else 270 echo "Didn't find output from autopart." 271 fi 272 else echo "Autopart tool failed. Trying again." 273 fi 274 275 # Reset at retries and timeouts in case autopart left 276 # them messy. 277 atnormalize 278 279 if [ -n "$primary" ]; then step3=ok; fi 280 fi 281 fi 282 283 if [ ! -b "/dev/$primary" ] 284 then echo Doing step 3 again. 285 step3="" 286 else 287 devsize="`devsize /dev/$primary`" 288 289 if [ "$devsize" -lt 1 ] 290 then echo "/dev/$primary is a 0-sized device." 291 step3="" 292 fi 293 fi 294done # while step3 != ok 295# end Step 3 296 297root=${primary}s0 298home=${primary}s1 299usr=${primary}s2 300umount /dev/$root 2>/dev/null && echo "Unmounted $root for you." 301umount /dev/$home 2>/dev/null && echo "Unmounted $home for you." 302umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you." 303 304devsizemb="`expr $devsize / 1024 / 2`" 305maxhome="`expr $devsizemb - $TOTALMB - 1`" 306 307if [ "$devsizemb" -lt "$TOTALMB" ] 308then echo "The selected partition ($devsizemb MB) is too small." 309 echo "You'll need $TOTALMB MB at least." 310 exit 1 311fi 312 313if [ "$maxhome" -lt 1 ] 314then echo "Note: you can't have /home with that size partition." 315 maxhome=0 316fi 317 318TMPMP=/m 319mkdir $TMPMP >/dev/null 2>&1 320 321confirm="" 322 323while [ "$confirm" = "" ] 324do 325 auto="" 326 echo "" 327echo " --- Step 4: Reinstall choice ------------------------------------------" 328 if mount -r /dev/$home $TMPMP >/dev/null 2>&1 329 then umount /dev/$home >/dev/null 2>&1 330 echo "" 331 echo "You have selected an existing MINIX 3 partition." 332 echo "Type F for full installation (to overwrite entire partition)" 333 echo "Type R for a reinstallation (existing /home will not be affected)" 334 echo "Type B to reinstall/upgrade bootloader (no data affected)" 335 echo "" 336 echo -n "(F)ull, (R)einstall or (B)ootloader install? [R] " 337 read conf 338 case "$conf" in 339 "") confirm="ok"; auto="r"; ;; 340 [Rr]*) confirm="ok"; auto="r"; ;; 341 [Ff]*) confirm="ok"; auto="" ;; 342 [Bb]*) confirm="ok"; bootreinstall="ok" ;; 343 esac 344 345 else echo "" 346 echo "No old /home found. Doing full install." 347 echo "" 348 confirm="ok"; 349 fi 350 351done 352 353if [ "$bootreinstall" = "ok" ] 354then 355 echo "" 356 echo " --- Step 5: Reinstall bootloader ----------------------------------" 357 echo "" 358 359 echo "WARNING: This procedure uses your current /usr to store your /." 360 echo "Once the procedure starts, it has to finish" 361 echo "to restore your / partition. Please make sure it is not interrupted." 362 echo "" 363 364 echo -n "It's recommended to run fsck before you continue, run? [Y/n] " 365 read ok 366 if [ "$ok" = "y" -o "$ok" = "Y" -o "$ok" = "" ] 367 then 368 fsck.mfs -a "/dev/$root" >/dev/null 369 fsck.mfs -a "/dev/$usr" >/dev/null 370 fi 371 372 # If there is no ELF stuff and not enough space after repartitioning, 373 # user will fall into trouble. So at first copy new stuff. 374 mount "/dev/$root" /mnt >/dev/null || exit 375 376 # grep, stat, etc in chroot 377 mount "/dev/$usr" /mnt/usr >/dev/null || exit 378 379 cp -pf /bin/update_bootcfg /mnt/bin/ && \ 380 cp -pf /etc/boot.cfg.default /mnt/etc/ && \ 381 cp -pf /boot_monitor /mnt/ || exit 382 383 if [ ! -d /mnt/boot/minix_default -o ! -r /mnt/boot/minix_default/kernel ] 384 then 385 if [ -r /mnt/boot.cfg ] 386 then 387 echo "" 388 echo "There is no /boot/minix_default/, but /boot.cfg exists." 389 echo -n "Do you want to copy minix_default from CD? [Y/n] " 390 else 391 echo "" 392 echo -n "There is no /boot/minix_default/, do you want to copy it from CD? [Y/n] " 393 fi 394 read ok 395 if [ "$ok" = "y" -o "$ok" = "Y" -o "$ok" = "" ] 396 then 397 if [ -e /mnt/boot/minix_default ] 398 then 399 echo "Old /boot/minix_default moved to /boot/minix_default_old" 400 mv /mnt/boot/minix_default /mnt/boot/minix_default_old 401 fi 402 403 cp -rfp /boot/minix_default /mnt/boot/ || exit 404 fi 405 fi 406 407 echo " * Updating /boot.cfg" 408 409 chroot /mnt update_bootcfg 410 411 sync 412 413 # Get sizes and space availability while the file systems are still 414 # mounted. Otherwise we have to mount them again just for this. 415 required_root_space=`df -kP /dev/$root | awk '{print $3}' | tail -n 1` 416 free_root_space=`df -kP /dev/$root | awk '{print $4}' | tail -n 1` 417 free_usr_space=`df -kP /dev/$usr | awk '{print $4}' | tail -n 1` 418 419 umount /mnt/usr && umount /mnt || exit 420 421 # Check if enough space for new boot 422 let bootspace=`devsize /dev/$primary`-`devsize /dev/$root`-`devsize /dev/$home`-`devsize /dev/$usr` >/dev/null 423 if [ $bootspace -lt $BOOTXXSECTS ] 424 then 425 echo "" 426 echo "Root partition size will be reduced by up to 16Kb to fit new bootloader." 427 echo "This is not a problem." 428 429 # round 16 => 20 430 if [ "$free_root_space" -le 20 ] 431 then 432 echo "" 433 echo "Not enough space on /dev/$root, you need at least 20Kb to use new bootloader!" 434 exit 1 435 fi 436 437 ROOTSECTS=`expr \`devsize /dev/$root\` - $BOOTXXSECTS + $bootspace` 438 439 if [ "$required_root_space" -gt "$free_usr_space" ] 440 then 441 echo "" 442 echo "You don't have enough free space on /dev/$usr to backup /dev/$root!" 443 echo "${free_usr_space}Kb available, ${required_root_space} required." 444 exit 1 445 fi 446 447 mkdir /mnt/root && mkdir /mnt/usr || exit 448 449 echo "Re-mounting your current / and /usr" 450 451 mount "/dev/$root" /mnt/root || exit 452 mount "/dev/$usr" /mnt/usr || exit 453 454 mkdir /mnt/usr/tmp/root_backup || exit 455 456 echo " * Copying / contents" 457 458 cp -rfp /mnt/root/* /mnt/usr/tmp/root_backup 459 if [ $? -ne 0 ] 460 then 461 echo "" 462 echo "Failed to backup root partition, aborting!" 463 rm -rf /mnt/usr/tmp/root_backup 464 # umount shouldn't fail here, but if it will, next 465 # "rm -rf" will serve for user's pleasure. 466 umount /mnt/root >/dev/null || exit 467 umount /mnt/usr >/dev/null || exit 468 rm -rf /mnt/root /mnt/usr 469 exit 1 470 fi 471 472 echo " * Copying done" 473 474 umount /mnt/root 475 umount /mnt/usr 476 477 add_subpart="" 478 minix_subparts=`echo -n "" | fdisk /dev/$primary | grep "MINIX" | wc -l` 479 if [ "$minix_subparts" -gt 3 ] 480 then 481 echo "" 482 echo "You have additional subpartition except /, /usr and /home." 483 echo "Partition type will be set to MINIX (81), you can change it later using part." 484 echo -n "Do you want to continue? [Y/n] " 485 read ok 486 [ "$ok" = "n" -o "$ok" = "N" ] && exit 487 add_subpart="81:exist" 488 fi 489 490 echo " * Repartitioning" 491 492 partition /dev/$primary $BOOTXXSECTS 81:${ROOTSECTS}* 81:exist 81:exist $add_subpart || exit 493 494 echo " * mkfs on new /" 495 496 mkfs.mfs "/dev/$root" || exit 497 498 if [ $? -ne 0 ] 499 then 500 echo "Failed to repartition /dev/$primary" 501 rmdir /mnt/root 502 rmdir /mnt/usr 503 exit 1 504 fi 505 506 mount "/dev/$usr" /mnt/usr || exit 507 mount "/dev/$root" /mnt/root || exit 508 509 echo " * Filling new / filesystem" 510 511 mv /mnt/usr/tmp/root_backup/* /mnt/root/ || exit 512 if [ $? -ne 0 ] 513 then 514 echo "Failed to copy old root data! It is in /tmp/root_backup/" 515 fi 516 517 rmdir /mnt/usr/tmp/root_backup/ 518 519 umount /mnt/root 520 umount /mnt/usr 521 fi 522 523 check_mbr 524 installboot_nbsd -f /dev/$primary /usr/mdec/bootxx_minixfs3 >/dev/null || exit 1 525 526 if [ $? -ne 0 ] 527 then 528 echo "Warning: failed to remove /tmp/root_backup!" 529 fi 530 531 echo "New boot installed successfully! You can reboot now." 532 exit 533fi 534 535rmdir $TMPMP 536 537nohome="0" 538 539homesize="" 540if [ ! "$auto" = r ] 541then 542echo "" 543echo " --- Step 5: Select the size of /home ----------------------------------" 544 while [ -z "$homesize" ] 545 do 546 547 # 20% of what is left over after / and /usr 548 # are taken. 549 defmb="`expr $maxhome / 5`" 550 if [ "$defmb" -gt "$maxhome" ] 551 then 552 defmb=$maxhome 553 fi 554 555 echo "" 556 echo "MINIX will take up $TOTALMB MB, without /home." 557 echo -n "How big do you want your /home to be in MB (0-$maxhome) ? [$defmb] " 558 read homesize 559 if [ "$homesize" = "" ] ; then homesize=$defmb; fi 560 if [ "$homesize" -lt 1 ] 561 then nohome=1 562 echo "Ok, not making a /home." 563 homesize=0 564 else 565 if [ "$homesize" -gt "$maxhome" ] 566 then echo "That won't fit!" 567 homesize="" 568 else 569 echo "" 570 echo -n "$homesize MB Ok? [Y] " 571 read ok 572 [ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] || homesize="" 573 fi 574 fi 575 echo "" 576 done 577 # Homesize in sectors 578 homemb="$homesize MB" 579 homesize="`expr $homesize '*' 1024 '*' 2`" 580else 581 # Root size same as our default? If not, warn and keep old root size 582 ROOTSECTSDEFAULT=$ROOTSECTS 583 ROOTSECTS="`devsize /dev/$root`" 584 ROOTMB="`expr $ROOTSECTS / 2048`" 585 if [ $ROOTSECTS -ne $ROOTSECTSDEFAULT ] 586 then 587 # Check if we 588 echo "Root partition size `expr $ROOTSECTS / 2`kb differs from default `expr $ROOTSECTSDEFAULT / 2`kb." 589 echo "This is not a problem, but you may want to do a fresh install at some point to" 590 echo "be able to benefit from the new default." 591 fi 592 593 # Check if enough space for new boot (even if old used) 594 let bootspace=`devsize /dev/$primary`-`devsize /dev/$root`-`devsize /dev/$home`-`devsize /dev/$usr` >/dev/null 595 if [ $bootspace -lt $BOOTXXSECTS ] 596 then 597 echo "Root partition size will be reduced by up to 16Kb to fit new bootloader." 598 echo "This is not a problem." 599 ROOTSECTS=`expr $ROOTSECTS - $BOOTXXSECTS + $bootspace` 600 fi 601 602 # Recompute totals based on root size 603 TOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`" 604 maxhome="`expr $devsizemb - $TOTALMB - 1`" 605 606 homepart="`devsize /dev/$home`" 607 homesize="`expr $homepart / 2 / 1024`" 608 if [ "$homesize" -gt "$maxhome" ] 609 then 610 echo "Sorry, but your /home is too big ($homesize MB) to leave enough" 611 echo "space on the rest of the partition ($devsizemb MB) for your" 612 echo "selected installation size ($TOTALMB MB)." 613 exit 1 614 fi 615 # Homesize unchanged (reinstall) 616 homesize=exist 617 homemb="current size" 618fi 619 620minblocksize=1 621maxblocksize=64 622blockdefault=4 623 624if [ ! "$auto" = "r" ] 625then 626 echo "" 627echo " --- Step 6: Select a block size ---------------------------------------" 628 echo "" 629 630 echo "The default file system block size is $blockdefault kB." 631 echo "" 632 633 while [ -z "$blocksize" ] 634 do 635 echo -n "Block size in kilobytes? [$blockdefault] "; read blocksize 636 test -z "$blocksize" && blocksize=$blockdefault 637 if [ "$blocksize" -lt $minblocksize -o "$blocksize" -gt $maxblocksize ] 638 then 639 warn "At least $minblocksize kB and at most $maxblocksize kB please." 640 blocksize="" 641 fi 642 done 643else 644 blocksize=$blockdefault 645fi 646 647blocksizebytes="`expr $blocksize '*' 1024`" 648 649bootsectors=$BOOTXXSECTS 650 651check_mbr 652 653echo " 654You have selected to (re)install MINIX 3 in the partition /dev/$primary. 655The following subpartitions are now being created on /dev/$primary: 656 657 Root subpartition: /dev/$root $ROOTMB MB 658 /home subpartition: /dev/$home $homemb 659 /usr subpartition: /dev/$usr rest of $primary 660" 661 # Secondary master bootstrap. 662# New boot doesn't require mbr on pN (bootxx will be there) 663# When necessarily mbr is installed on dN by partition. 664 # Partition the primary. 665partition /dev/$primary $bootsectors 81:${ROOTSECTS}* 81:$homesize 81:0+ > /dev/null || exit 666 667echo "Creating /dev/$root for / .." 668mkfs.mfs /dev/$root || exit 669 670if [ "$nohome" = 0 ] 671then 672 if [ ! "$auto" = r ] 673 then echo "Creating /dev/$home for /home .." 674 mkfs.$FSTYPE -B $blocksizebytes /dev/$home || exit 675 fi 676else echo "Skipping /home" 677fi 678 679echo "Creating /dev/$usr for /usr .." 680mkfs.$FSTYPE -B $blocksizebytes /dev/$usr || exit 681 682if [ "$nohome" = 0 ] 683then 684 fshome="/dev/$home /home $FSTYPE rw 0 2" 685else fshome="" 686fi 687 688echo "" 689echo " --- Step 7: Wait for files to be copied -------------------------------" 690echo "" 691echo "All files will now be copied to your hard disk. This may take a while." 692echo "" 693 694mount /dev/$usr /mnt >/dev/null || exit # Mount the intended /usr. 695 696(cd /usr || exit 1 697 list="`ls | fgrep -v install`" 698 pax -rw -pe -v $list /mnt 2>&1 699) | progressbar "$USRFILES" || exit # Copy the usr floppy. 700 701umount /dev/$usr >/dev/null || exit # Unmount the intended /usr. 702mount /dev/$root /mnt >/dev/null || exit 703 704# Running from the installation CD. 705pax -rw -pe -vX / /mnt 2>&1 | progressbar "$ROOTFILES" || exit 706chmod o-w /mnt/usr 707cp /mnt/etc/motd.install /mnt/etc/motd 708 709 710# Fix /var/log 711rm /mnt/var/log 712ln -s /usr/log /mnt/var/log 713 714# CD remnants that aren't for the installed system 715rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null 716echo >/mnt/etc/fstab "/dev/$root / mfs rw 0 1 717/dev/$usr /usr $FSTYPE rw 0 2 718$fshome 719none /sys devman rw,rslabel=devman 0 0" 720 721 # National keyboard map. 722test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap 723 724# Make bootable. 725mount /dev/$usr /mnt/usr >/dev/null || exit 726# XXX we have to use "-f" here, because installboot worries about BPB, which 727# we don't have... 728installboot_nbsd -f /dev/$primary /usr/mdec/bootxx_minixfs3 >/dev/null || exit 729# give the install the boot loader 730cp /usr/mdec/boot_monitor /mnt/ 731minixdir=/mnt/boot/minix_default 732if [ ! -f $minixdir/kernel ] 733then rm -rf $minixdir 734 cp -r /mnt/boot/minix/.temp $minixdir 735fi 736if [ ! -e /mnt/boot/minix_latest ] 737then ln -sf minix_default /mnt/boot/minix_latest 738fi 739chroot /mnt update_bootcfg 740 741# Save name of CD drive 742cddrive="`mount | grep /usr | awk '{ print $1 }' | sed 's/p.*//'`" 743echo "cddrive=$cddrive" >>/mnt/usr/etc/rc.package 744 745bios="`echo $primary | sed -e 's/d./dX/g' -e 's/c.//g'`" 746 747echo "Saving random data.." 748dd if=/dev/random of=/mnt/usr/adm/random.dat bs=1024 count=1 749 750# Networking. 751echo "" 752echo " --- Step 8: Select your Ethernet chip ---------------------------------" 753echo "" 754 755/bin/netconf -p /mnt || echo FAILED TO CONFIGURE NETWORK 756 757umount /dev/$usr && echo Unmounted $usr 758umount /dev/$root && echo Unmounted $root 759 760echo " 761Please type 'reboot' to exit MINIX 3 and reboot. To boot into your new 762system, you might have to remove installation media. 763 764This ends the MINIX 3 setup script. You may want to take care of post 765installation steps, such as local testing and configuration. 766 767Please consult the user manual for more information. 768 769" 770 771