*** empty log message ***

This commit is contained in:
Jorrit Herder 2005-08-12 11:08:23 +00:00
parent cbf7c4d476
commit fb2fc31f8e

View File

@ -1,13 +1,19 @@
#!/bin/sh #!/bin/sh
# #
# setup 4.1 - install a MINIX distribution Author: Kees J. Bot # setup 4.1 - install a MINIX distribution
# 20 Dec 1994 #
# Changes:
# Aug 2005 robustness checks and beautifications (Jorrit N. Herder)
# Jul 2005 extended with autopart and networking (Ben J. Gras)
# Dec 20, 1994 created (Kees J. Bot)
#
LOCALRC=/usr/etc/rc.local LOCALRC=/usr/etc/rc.local
PATH=/bin:/usr/bin PATH=/bin:/usr/bin
export PATH export PATH
usage() usage()
{ {
cat >&2 <<'EOF' cat >&2 <<'EOF'
@ -24,6 +30,11 @@ EOF
exit 1 exit 1
} }
warn()
{
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"
}
# No options. # No options.
while getopts '' opt; do usage; done while getopts '' opt; do usage; done
shift `expr $OPTIND - 1` shift `expr $OPTIND - 1`
@ -63,45 +74,59 @@ case $thisroot:$fdusr in
esac esac
echo -n " echo -n "
Welcome to the MINIX installation script. Welcome to the MINIX setup script. This script will guide you in setting up
MINIX on your machine. Please consult the manual for detailed instructions.
Note 1: If the screen blanks, hit CTRL+F3 to select \"software scrolling\". Note 1: If the screen blanks, hit CTRL+F3 to select \"software scrolling\".
Note 2: If things go wrong then hit CTRL+C and start over. Note 2: If things go wrong then hit CTRL+C to abort and start over.
Note 3: Default answers, like [y], can simply be chosen by hitting ENTER. Note 3: Default answers, like [y], can simply be chosen by hitting ENTER.
Note 4: If you see a colon (:) then you should hit ENTER to continue. Note 4: If you see a colon (:) then you should hit ENTER to continue.
:" :"
read ret read ret
# begin Step 1
echo "" echo ""
echo " --- Step 1: Select keyboard type --------------------------------------" echo " --- Step 1: Select keyboard type --------------------------------------"
echo "" echo ""
echo "What type of keyboard do you have? You can choose one of:"
echo ""
ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /'
echo -n "
Keyboard type? [us-std] "; read keymap
test -n "$keymap" && loadkeys "/usr/lib/keymaps/$keymap.map"
ok="" echo "What type of keyboard do you have? You can choose one of:"
while [ "$ok" = "" ] echo ""
ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /'
echo ""
step1=""
while [ "$step1" != ok ]
do
echo -n "Keyboard type? [us-std] "; read keymap
test -n "$keymap" || keymap=us-std
if loadkeys "/usr/lib/keymaps/$keymap.map" 2>/dev/null
then step1=ok
else warn "invalid keyboard"
fi
done
# end Step 1
# begin Step 2
step2=""
while [ "$step2" != ok ]
do do
echo "" echo ""
echo " --- Step 2: Create a partition for MINIX 3 ----------------------------" echo " --- Step 2: Create a partition for MINIX 3 ----------------------------"
echo "" echo ""
echo "Now you need to create a MINIX 3 partition on your hard disk." echo "Now you need to create a MINIX 3 partition on your hard disk."
echo "Unless you are an expert, you are advised to use the automated" echo "Unless you are an expert, you are advised to use the automated"
echo "step-by-step help in setting up." echo "step-by-step help in setting up."
echo "" echo ""
echo -n "Do you want to use (A)utomatic or the e(X)pert mode? [A] " ok=""
read ch while [ "$ok" = "" ]
case "$ch" in do
[Aa]*) auto="1"; ok="yes"; ;; echo -n "Press ENTER for automatic mode or type 'expert': "
'') auto="1"; ok="yes"; ;; read mode
[Xx]*) auto=""; ok="yes"; ;; if [ -z "$mode" ]; then auto="1"; ok="yes"; fi
*) echo "Unrecognized response."; ok=""; ;; if [ "$mode" = expert ]; then auto=""; ok="yes"; fi
esac if [ "$ok" != yes ]; then warn "try again"; fi
done done
primary= primary=
@ -133,21 +158,24 @@ make. (See the devices section in usage(8) on MINIX device names.)
Please finish the name of the primary partition you have created: Please finish the name of the primary partition you have created:
(Just type ENTER if you want to rerun \"part\") /dev/" (Just type ENTER if you want to rerun \"part\") /dev/"
read primary read primary
done
echo "" echo ""
echo "This is the point of no return. You have selected to install MINIX" echo "This is the point of no return. You have selected to install MINIX"
echo "on partition /dev/$primary. Please confirm that you want to use this" echo "on partition /dev/$primary. Please confirm that you want to use this"
echo "selection to install MINIX." echo "selection to install MINIX."
echo "" echo ""
while [ -z "$confirmation" -o "$confirmation" != yes ] confirmation=""
do while [ -z "$confirmation" -o "$confirmation" != yes -a "$confirmation" != no ]
echo -n "Are you sure you want to continue? Please enter 'yes' or 'no':" do
read confirmation echo -n "Are you sure you want to continue? Please enter 'yes' or 'no': "
done read confirmation
if [ "$confirmation" = yes ]; then step2=ok; fi
done done
else else
# Automatic mode # Automatic mode
while [ -z "$primary" ] # while [ -z "$primary" ]
do # do
PF="/tmp/pf" PF="/tmp/pf"
if autopart -f$PF if autopart -f$PF
then if [ -s "$PF" ] then if [ -s "$PF" ]
@ -166,10 +194,15 @@ else
# reset at retries and timeouts in case autopart left # reset at retries and timeouts in case autopart left
# them messy # them messy
atnormalize atnormalize
done # done
if [ -n "$primary" ]; then step2=ok; fi
fi fi
done
# end Step 2
root=${primary}s0 root=${primary}s0
swap=${primary}s1 swap=${primary}s1
usr=${primary}s2 usr=${primary}s2
@ -191,43 +224,52 @@ hex2int()
echo $i echo $i
} }
# begin Step 3
echo "" echo ""
echo " --- Step 3: Select your Ethernet chip ---------------------------------" echo " --- Step 3: Select your Ethernet chip ---------------------------------"
echo "" echo ""
# Ask user about networking # Ask user about networking
echo "MINIX currently supports the following Ethernet cards. Please choose: " echo "MINIX currently supports the following Ethernet cards. Please choose: "
echo "" echo ""
echo "0. No Ethernet card (no networking)" echo "0. No Ethernet card (no networking)"
echo "1. Intel Pro/100" echo "1. Intel Pro/100"
echo "2. Realtek 8139 based card" echo "2. Realtek 8139 based card"
echo "3. Realtek 8029 based card (emulated by Qemu)" echo "3. Realtek 8029 based card (emulated by Qemu)"
echo "4. NE2000, 3com 503 or WD based card (emulated by Bochs)" echo "4. NE2000, 3com 503 or WD based card (emulated by Bochs)"
echo "5. 3Com 501 or 3Com 509 based card" echo "5. 3Com 501 or 3Com 509 based card"
echo "6. Different Ethernet card (no networking)" echo "6. Different Ethernet card (no networking)"
echo "" echo ""
echo "With some cards, you'll have to edit $LOCALRC after installing." echo "You can always change your mind after the setup."
echo "" echo ""
echo "You can always change your mind after the install." step3=""
echo "" while [ "$step3" != ok ]
echo -n "Choice? [0] " do
read eth eth=""
driver="" echo -n "Ethernet card? [0] "; read eth
driverargs="" test -z $eth && eth=0
config_warn=" driver=""
Note: After installing, edit $LOCALRC to the right configuration. driverargs=""
If you chose option 4, the defaults for emulation by Bochs have been set." case "$eth" in
case "$eth" in 0) step3="ok"; ;;
1) driver=fxp; ;; 1) step3="ok"; driver=fxp; ;;
2) driver=rtl8139; ;; 2) step3="ok"; driver=rtl8139; ;;
3) driver=dp8390; driverargs="dp8390_arg='DPETH0=pci'"; ;; 3) step3="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=pci'"; ;;
4) driver=dp8390; driverargs="dp8390_arg='DPETH0=240:9'"; 4) step3="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=240:9'";
echo "$config_warn"; echo ""
echo "Note: After installing, edit $LOCALRC to the right configuration."
echo " chose option 4, the defaults for emulation by Bochs have been set."
;; ;;
5) driver=dpeth; driverargs="#dpeth_arg='DPETH0=port:irq:memory'"; 5) step3="ok"; driver=dpeth; driverargs="#dpeth_arg='DPETH0=port:irq:memory'";
echo "$config_warn"; echo ""
echo "Note: After installing, edit $LOCALRC to the right configuration."
;; ;;
esac 6) step3="ok"; ;;
*) warn "choose a number"
esac
done
# end Step 3
# Compute the amount of memory available to MINIX. # Compute the amount of memory available to MINIX.
memsize=0 memsize=0
@ -243,13 +285,13 @@ do
done done
# Compute an advised swap size. # Compute an advised swap size.
swapadv=0 # swapadv=0
case `arch` in # case `arch` in
i86) # i86)
test $memsize -lt 4096 && swapadv=$(expr 4096 - $memsize) # test $memsize -lt 4096 && swapadv=$(expr 4096 - $memsize)
;; # ;;
*) test $memsize -lt 6144 && swapadv=$(expr 6144 - $memsize) # *) test $memsize -lt 6144 && swapadv=$(expr 6144 - $memsize)
esac # esac
blockdefault=4 blockdefault=4
@ -262,41 +304,39 @@ echo "For a small disk or small RAM you may want 1 or 2 KB blocks."
echo "" echo ""
while [ -z "$blocksize" ] while [ -z "$blocksize" ]
do echo -n "Block size in kilobytes? [$blockdefault] " do
read blocksize echo -n "Block size in kilobytes? [$blockdefault] "; read blocksize
if [ -z "$blocksize" ] test -z "$blocksize" && blocksize=$blockdefault
then blocksize=$blockdefault
fi
if [ "$blocksize" -ne 1 -a "$blocksize" -ne 2 -a "$blocksize" -ne $blockdefault ] if [ "$blocksize" -ne 1 -a "$blocksize" -ne 2 -a "$blocksize" -ne $blockdefault ]
then echo "$blocksize KB is a bogus block size; 1, 2 or $blockdefault KB please." then
warn "1, 2 or 4 please"
blocksize="" blocksize=""
fi fi
done done
blocksizebytes="`expr $blocksize '*' 1024`" blocksizebytes="`expr $blocksize '*' 1024`"
echo ""
echo " --- Step 5: Allocate swap space ---------------------------------------"
echo ""
echo -n "How much swap space would you like? Swapspace is only needed if this # begin Step 5
system is memory starved. If you have 128 MB of memory or more, you # echo ""
probably don't need it. If you have less and want to run many programs # echo " --- Step 5: Allocate swap space ---------------------------------------"
at once, I suggest setting it to the memory size. # echo ""
Size in kilobytes? [$swapadv] " # echo -n "How much swap space would you like? Swapspace is only needed if this
# system is memory starved. If you have 128 MB of memory or more, you
swapsize= # probably don't need it. If you have less and want to run many programs
read swapsize # at once, I suggest setting it to the memory size.
test -z "$swapsize" && swapsize=$swapadv
# Size in kilobytes? [$swapadv] "
# read swapsize
# test -z "$swapsize" && swapsize=$swapadv
#
echo " echo "
You have selected to install MINIX in the partition /dev/$primary. You have selected to install MINIX in the partition /dev/$primary.
The following subpartitions are about to be created on /dev/$primary: The following subpartitions are about to be created on /dev/$primary:
Root subpartition: /dev/$root 16 MB Root subpartition: /dev/$root 16 MB
Swap subpartition: /dev/$swap $swapsize KB
/usr subpartition: /dev/$usr rest of $primary /usr subpartition: /dev/$usr rest of $primary
" "
# Secondary master bootstrap. # Secondary master bootstrap.
@ -304,33 +344,38 @@ installboot -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
# Partition the primary. # Partition the primary.
p3=0:0 p3=0:0
test "$swapsize" -gt 0 && p3=81:`expr $swapsize \* 2` # test "$swapsize" -gt 0 && p3=81:`expr $swapsize \* 2`
partition /dev/$primary 1 81:32768* $p3 81:0+ > /dev/null || exit partition /dev/$primary 1 81:32768* $p3 81:0+ > /dev/null || exit
if [ "$swapsize" -gt 0 ] # if [ "$swapsize" -gt 0 ]
then # then
# We must have that swap, now! # # We must have that swap, now!
mkswap -f /dev/$swap || exit # mkswap -f /dev/$swap || exit
mount -s /dev/$swap || exit # mount -s /dev/$swap || exit
else # else
# Forget about swap. # # Forget about swap.
swap= # swap=
fi # fi
echo "" echo ""
echo " --- Step 6: Wait for bad block detection ------------------------------" echo " --- Step 5: Wait for bad block detection ------------------------------"
echo "" echo ""
echo "Scanning disk for bad blocks. Hit CTRL-C to stop the scan if you are"
echo "sure that there can not be any bad blocks. Otherwise just wait."
mkfs -B $blocksizebytes /dev/$usr trap ': nothing;echo' 2
echo "Scanning /dev/$usr for bad blocks. (Hit CTRL+C to stop the scan if you are"
echo "absolutely sure that there can not be any bad blocks. Otherwise just wait.)"
echo "" echo ""
trap ': nothing' 2 echo "Scanning /dev/$root for bad blocks:"
mkfs -B $blocksizebytes /dev/$root || exit
readall -b /dev/$root | sh
echo ""
echo "Scanning /dev/$usr for bad blocks:"
mkfs -B $blocksizebytes /dev/$usr || exit
readall -b /dev/$usr | sh readall -b /dev/$usr | sh
trap 2 trap 2
echo "" echo ""
echo " --- Step 7: Wait for files to be copied -------------------------------" echo " --- Step 6: Wait for files to be copied -------------------------------"
echo "" echo ""
mount /dev/$usr /mnt || exit # Mount the intended /usr. mount /dev/$usr /mnt || exit # Mount the intended /usr.
@ -371,10 +416,6 @@ echo "
Copying $fdroot to /dev/$root Copying $fdroot to /dev/$root
" "
mkfs -B $blocksizebytes /dev/$root || exit
echo "Scanning /dev/$root for bad blocks. (Hit CTRL+C to stop the scan if you are"
echo "absolutely sure that there can not be any bad blocks. Otherwise just wait.)"
readall -b /dev/$root | sh
mount /dev/$root /mnt || exit mount /dev/$root /mnt || exit
# Running from the installation CD. # Running from the installation CD.
files="`find / -xdev | wc -l`" files="`find / -xdev | wc -l`"
@ -383,12 +424,12 @@ chmod 555 /mnt/usr
# CD remnants that aren't for the installed system # CD remnants that aren't for the installed system
rm /mnt/etc/issue /mnt/CD 2>/dev/null rm /mnt/etc/issue /mnt/CD 2>/dev/null
# Change /etc/fstab. # Change /etc/fstab. (No swap.)
# ${swap:+swap=/dev/$swap}
echo >/mnt/etc/fstab "\ echo >/mnt/etc/fstab "\
# Poor man's File System Table. # Poor man's File System Table.
root=/dev/$root root=/dev/$root
${swap:+swap=/dev/$swap}
usr=/dev/$usr" usr=/dev/$usr"
# National keyboard map. # National keyboard map.
@ -428,10 +469,13 @@ echo "rootdev=$root; ramimagedev=$root; $cache; save" >$pfile || exit
sync sync
echo " echo "
Please type 'shutdown' to exit MINIX 3 and enter the boot monitor. Please type 'shutdown' to exit MINIX 3 and enter the boot monitor. At the
At the boot monitor prompt, you can type 'boot $primary' to try the boot monitor prompt, type 'boot $primary' to try your new MINIX system.
newly installed MINIX system.
This ends the MINIX setup script. After booting your newly set up system,
you can run the test suites as indicated in the setup manual. You also
may want to take care of local configuration, such as securing your system
with a password. Please consult the usage manual for more information.
See Part IV: Testing in the usage manual.
" "