minix/commands/scripts/setup.sh

665 lines
18 KiB
Bash
Raw Normal View History

2005-07-13 15:04:56 +02:00
#!/bin/sh
#
2005-08-12 13:08:23 +02:00
# setup 4.1 - install a MINIX distribution
#
# Changes:
# Aug 2005 robustness checks and beautifications (Jorrit N. Herder)
# Jul 2005 extended with autopart and networking (Ben Gras)
2005-08-12 13:08:23 +02:00
# Dec 20, 1994 created (Kees J. Bot)
#
2005-07-13 15:04:56 +02:00
2005-08-05 18:49:38 +02:00
LOCALRC=/usr/etc/rc.local
MYLOCALRC=/mnt/etc/rc.local
2005-09-08 11:29:17 +02:00
ROOTMB=16
ROOTSECTS="`expr $ROOTMB '*' 1024 '*' 2`"
2006-02-02 19:14:42 +01:00
USRKBFILE=/.usrkb
if [ ! -f "$USRKBFILE" ]
then echo "Are you really running from CD?"
echo "No $USRKBFILE file."
exit 1
fi
2005-09-09 14:22:19 +02:00
USRKB="`cat /.usrkb`"
TOTALMB="`expr 3 + $USRKB / 1024 + $ROOTMB`"
2005-09-11 19:20:30 +02:00
ROOTFILES="`cat /.rootfiles`"
USRFILES="`cat /.usrfiles`"
EXTRASRCFILES="`cat /.extrasrcfiles`"
EXTRASRCKB="`cat /.extrasrckb`"
# Install size without extra sources (rounded up)
NOSRCMB="`expr $TOTALMB - $EXTRASRCKB / 1024`"
NOSRCUSRFILES="`expr $USRFILES - $EXTRASRCFILES`"
if [ "$EXTRASRCKB" -lt 1 ]
then
echo "Are you really running from CD?"
echo "Something wrong with the extra-source-kb on CD."
exit 1
fi
if [ "$EXTRASRCFILES" -lt 1 ]
then
echo "Are you really running from CD?"
echo "Something wrong with the extra-source-files estimate on CD."
exit 1
fi
2005-08-05 18:49:38 +02:00
2005-09-10 22:33:11 +02:00
if [ "$TOTALMB" -lt 1 ]
then
echo "Are you really running from CD?"
echo "Something wrong with size estimate on CD."
exit 1
fi
2005-09-11 19:20:30 +02:00
if [ "$ROOTFILES" -lt 1 ]
then
echo "Are you really running from CD?"
echo "Something wrong with root files count on CD."
exit 1
fi
if [ "$USRFILES" -lt 1 ]
then
echo "Are you really running from CD?"
echo "Something wrong with usr files count on CD."
exit 1
fi
2005-07-13 15:04:56 +02:00
PATH=/bin:/usr/bin
export PATH
2005-08-12 13:08:23 +02:00
2005-07-13 15:04:56 +02:00
usage()
{
cat >&2 <<'EOF'
Usage: setup # Install a skeleton system on the hard disk.
setup /usr # Install the rest of the system (binaries or sources).
# To install from other things then floppies:
urlget http://... | setup /usr # Read from a web site.
urlget ftp://... | setup /usr # Read from an FTP site.
mtools copy c0d0p0:... - | setup /usr # Read from the C: drive.
dosread c0d0p0 ... | setup /usr # Likewise if no mtools.
EOF
exit 1
}
2005-08-12 13:08:23 +02:00
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"
}
2005-07-13 15:04:56 +02:00
# No options.
while getopts '' opt; do usage; done
shift `expr $OPTIND - 1`
2005-09-10 22:33:11 +02:00
if [ ! -f /CD ]
then echo "Please run setup from the CD, not from a live system."
exit 1
fi
if [ "$USER" != root ]
2005-07-26 15:14:59 +02:00
then echo "Please run setup as root."
exit 1
fi
2005-07-13 15:04:56 +02:00
# Find out what we are running from.
exec 9<&0 </etc/mtab # Mounted file table.
read thisroot rest # Current root (/dev/ram or /dev/fd?)
read fdusr rest # USR (/dev/fd? or /dev/fd?p2)
exec 0<&9 9<&-
# What do we know about ROOT?
case $thisroot:$fdusr in
/dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0
;;
/dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1
;;
/dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy
;;
/dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly
;;
*) fdroot=$thisroot # ?
esac
echo -n "
2005-09-10 22:33:11 +02:00
Welcome to the MINIX 3 setup script. This script will guide you in setting up
2005-08-12 13:08:23 +02:00
MINIX on your machine. Please consult the manual for detailed instructions.
2005-07-13 15:04:56 +02:00
2005-08-09 13:16:15 +02:00
Note 1: If the screen blanks, hit CTRL+F3 to select \"software scrolling\".
2005-08-12 13:08:23 +02:00
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.
2005-08-08 16:28:32 +02:00
Note 4: If you see a colon (:) then you should hit ENTER to continue.
2005-07-13 15:04:56 +02:00
:"
read ret
2005-08-12 13:08:23 +02:00
# begin Step 1
echo ""
echo " --- Step 1: Select keyboard type --------------------------------------"
echo ""
2005-07-13 15:04:56 +02:00
2005-08-12 13:08:23 +02:00
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 ""
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
2005-09-08 11:29:17 +02:00
echo ""
echo " --- Step 2: Select your Ethernet chip ---------------------------------"
echo ""
# Ask user about networking
echo "MINIX 3 currently supports the following Ethernet cards. Please choose: "
echo ""
echo "0. No Ethernet card (no networking)"
echo "1. Intel Pro/100"
2005-09-09 14:22:19 +02:00
echo "2. 3Com 501 or 3Com 509 based card"
echo "3. Realtek 8139 based card"
echo "4. Realtek 8029 based card (also emulated by Qemu)"
2005-09-27 17:08:15 +02:00
echo " Note: If you want to use this in Qemu, set 'qemu_pci=1' in the boot monitor."
2005-09-09 14:22:19 +02:00
echo "5. NE2000, 3com 503 or WD based card (also emulated by Bochs)"
echo "6. AMD LANCE (also emulated by VMWare)"
2005-09-08 11:29:17 +02:00
echo "7. Different Ethernet card (no networking)"
echo ""
echo "You can always change your mind after the setup."
echo ""
2005-08-12 13:08:23 +02:00
step2=""
while [ "$step2" != ok ]
2005-09-08 11:29:17 +02:00
do
eth=""
echo -n "Ethernet card? [0] "; read eth
test -z $eth && eth=0
driver=""
driverargs=""
case "$eth" in
0) step2="ok"; ;;
1) step2="ok"; driver=fxp; ;;
2005-09-09 14:22:19 +02:00
2) step2="ok"; driver=dpeth; driverargs="#dpeth_arg='DPETH0=port:irq:memory'";
2005-09-08 11:29:17 +02:00
echo ""
echo "Note: After installing, edit $LOCALRC to the right configuration."
;;
2005-09-09 14:22:19 +02:00
3) step2="ok"; driver=rtl8139; ;;
4) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=pci'"; ;;
5) step2="ok"; driver=dp8390; driverargs="dp8390_arg='DPETH0=240:9'";
2005-09-08 11:29:17 +02:00
echo ""
echo "Note: After installing, edit $LOCALRC to the right configuration."
2005-09-09 14:22:19 +02:00
echo " chose option 4, the defaults for emulation by Bochs have been set."
2005-09-08 11:29:17 +02:00
;;
2005-09-16 18:46:03 +02:00
6) driver="lance"; driverargs="lance_arg='LANCE0=on'"; step2="ok"; ;;
2005-09-08 11:29:17 +02:00
7) step2="ok"; ;;
*) warn "choose a number"
esac
done
# end Step 2
# begin Step 3
step3=""
while [ "$step3" != ok ]
2005-08-02 10:57:26 +02:00
do
2005-08-31 18:40:41 +02:00
echo ""
2005-09-16 15:27:38 +02:00
echo " --- Step 3: Select minimal or full distribution -----------------------"
echo ""
2005-09-16 15:27:38 +02:00
echo "You can install MINIX as (M)inimal or (F)ull. (M)inimal"
echo "includes only the binary system and basic system sources."
2005-09-16 15:27:38 +02:00
echo "(F)ull also includes commands sources."
echo ""
echo "Please select:"
2005-09-16 15:27:38 +02:00
echo " (M)inimal install (only basic sources) ($NOSRCMB MB required)"
echo " (F)ull install (full install) ($TOTALMB MB required)"
echo " "
2005-09-16 15:27:38 +02:00
echo -n "Basic (M)inimal or (F)ull install? [F] "
read conf
case "$conf" in
"") step3="ok"; nobigsource="" ;;
2005-09-16 15:27:38 +02:00
[Ff]*) step3="ok"; nobigsource="" ;;
[Mm]*) step3="ok"; nobigsource="1"; TOTALMB=$NOSRCMB; USRFILES=$NOSRCUSRFILES ;;
esac
done
# end Step 3
# begin Step 4
step4=""
while [ "$step4" != ok ]
do
echo ""
2005-09-21 11:44:29 +02:00
echo " --- Step 4: Create or select a partition for MINIX 3 -------------------"
2005-08-31 18:40:41 +02:00
echo ""
2005-08-12 13:08:23 +02:00
echo "Now you need to create a MINIX 3 partition on your hard disk."
2005-09-09 14:22:19 +02:00
echo "It has to have $TOTALMB MB at the very least."
2005-08-31 18:29:56 +02:00
echo "You can also select one that's already there."
echo " "
echo "If you have an existing installation, reinstalling will let you"
2005-08-31 18:29:56 +02:00
echo "keep your current partitioning and subpartitioning, and overwrite"
2005-09-09 14:22:19 +02:00
echo "everything except your s1 subpartition (/home). If you want to"
echo "reinstall, select your existing minix partition."
2005-08-31 18:29:56 +02:00
echo " "
2005-08-12 13:08:23 +02:00
echo "Unless you are an expert, you are advised to use the automated"
echo "step-by-step help in setting up."
echo ""
ok=""
while [ "$ok" = "" ]
do
echo -n "Press ENTER for automatic mode, or type 'expert': "
2005-08-31 18:40:41 +02:00
read mode
if [ -z "$mode" ]; then auto="1"; ok="yes"; fi
if [ "$mode" = expert ]; then auto=""; ok="yes"; fi
if [ "$ok" != yes ]; then warn "try again"; fi
2005-08-12 13:08:23 +02:00
done
2005-08-31 18:40:41 +02:00
primary=
2005-08-31 18:40:41 +02:00
if [ -z "$auto" ]
then
# Expert mode
echo -n "
2005-09-09 14:22:19 +02:00
MINIX needs one primary partition of $TOTALMB MB for a full install,
plus what you want for /home.
The maximum file system currently supported is 4 GB.
2005-07-13 15:04:56 +02:00
2005-08-09 13:16:15 +02:00
If there is no free space on your disk then you have to choose an option:
(1) Delete one or more partitions
(2) Allocate an existing partition to MINIX 3
(3) Exit setup and shrink a partition using a different OS
2005-07-13 15:04:56 +02:00
To make this partition you will be put in the editor \"part\". Follow the
advice under the '!' key to make a new partition of type MINIX. Do not
touch an existing partition unless you know precisely what you are doing!
Please note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you
2005-08-08 16:28:32 +02:00
make. (See the devices section in usage(8) on MINIX device names.)
2005-07-13 15:04:56 +02:00
:"
2005-08-31 18:40:41 +02:00
read ret
2005-08-31 18:29:56 +02:00
while [ -z "$primary" ]
do
2005-08-31 18:40:41 +02:00
part || exit
2005-08-31 18:29:56 +02:00
echo -n "
2005-08-31 18:40:41 +02:00
Please finish the name of the primary partition you have created:
(Just type ENTER if you want to rerun \"part\") /dev/"
2005-08-31 18:29:56 +02:00
read primary
done
echo ""
2005-08-31 18:40:41 +02:00
echo "This is the point of no return. You have selected to install MINIX"
2005-08-31 18:29:56 +02:00
echo "on partition /dev/$primary. Please confirm that you want to use this"
2005-08-31 18:40:41 +02:00
echo "selection to install MINIX."
2005-08-31 18:29:56 +02:00
echo ""
confirmation=""
while [ -z "$confirmation" -o "$confirmation" != yes -a "$confirmation" != no ]
do
echo -n "Are you sure you want to continue? Please enter 'yes' or 'no': "
read confirmation
if [ "$confirmation" = yes ]; then step4=ok; fi
2005-08-31 18:29:56 +02:00
done
2005-08-31 18:40:41 +02:00
biosdrivename="Actual BIOS device name unknown, due to expert mode."
else
if [ "$auto" = "1" ]
then
# Automatic mode
PF="/tmp/pf"
2005-09-09 14:22:19 +02:00
if autopart -m$TOTALMB -f$PF
2005-08-31 18:40:41 +02:00
then if [ -s "$PF" ]
then
2005-08-31 18:46:24 +02:00
set `cat $PF`
bd="$1"
bdn="$2"
2005-08-31 18:40:41 +02:00
biosdrivename="Probably, the right command is \"boot $bdn\"."
if [ -b "/dev/$bd" ]
then primary="$bd"
else echo "Funny device $bd from autopart."
fi
else
echo "Didn't find output from autopart."
fi
else echo "Autopart tool failed. Trying again."
fi
# Reset at retries and timeouts in case autopart left
# them messy.
atnormalize
if [ -n "$primary" ]; then step4=ok; fi
2005-08-31 18:40:41 +02:00
fi
2005-08-31 18:29:56 +02:00
fi
2005-09-10 22:33:11 +02:00
if [ ! -b "/dev/$primary" ]
then echo "/dev/$primary is not a block device."
step4=""
2005-09-13 11:52:15 +02:00
else
devsize="`devsize /dev/$primary`"
if [ "$devsize" -lt 1 ]
then echo "/dev/$primary is a 0-sized device."
step4=""
fi
2005-09-10 22:33:11 +02:00
fi
done # while step4 != ok
# end Step 4
2005-07-13 15:04:56 +02:00
root=${primary}s0
home=${primary}s1
usr=${primary}s2
umount /dev/$root 2>/dev/null && echo "Unmounted $root for you."
umount /dev/$home 2>/dev/null && echo "Unmounted $home for you."
umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you."
2005-09-09 14:22:19 +02:00
devsizemb="`expr $devsize / 1024 / 2`"
2005-09-11 22:23:46 +02:00
maxhome="`expr $devsizemb - $TOTALMB - 1`"
2005-09-09 14:22:19 +02:00
2005-09-13 11:52:15 +02:00
if [ "$devsizemb" -lt "$TOTALMB" ]
2005-09-09 14:22:19 +02:00
then echo "The selected partition ($devsizemb MB) is too small."
echo "You'll need $TOTALMB MB at least."
exit 1
fi
2005-09-13 11:52:15 +02:00
if [ "$maxhome" -lt 1 ]
2005-09-11 22:23:46 +02:00
then echo "Note: you can't have /home with that size partition."
maxhome=0
fi
TMPMP=/m
mkdir $TMPMP >/dev/null 2>&1
confirm=""
while [ "$confirm" = "" ]
do
2005-09-09 14:22:19 +02:00
auto=""
echo ""
echo " --- Step 5: Reinstall choice ------------------------------------------"
2005-09-11 22:23:46 +02:00
if mount -r /dev/$home $TMPMP >/dev/null 2>&1
then umount /dev/$home >/dev/null 2>&1
echo ""
2005-09-09 14:22:19 +02:00
echo "You have selected an existing MINIX 3 partition."
echo "Type F for full installation (to overwrite entire partition)"
echo "Type R for a reinstallation (existing /home will not be affected)"
echo ""
2005-09-09 14:22:19 +02:00
echo -n "(F)ull or (R)einstall? [R] "
read conf
case "$conf" in
"") confirm="ok"; auto="r"; ;;
[Rr]*) confirm="ok"; auto="r"; ;;
[Ff]*) confirm="ok"; auto="" ;;
esac
else echo ""
echo "No old /home found. Doing full install."
echo ""
confirm="ok";
fi
2005-09-09 14:22:19 +02:00
done
2005-08-31 18:48:46 +02:00
2005-09-15 15:22:59 +02:00
rmdir $TMPMP
2005-09-15 15:22:45 +02:00
2005-09-09 14:22:19 +02:00
nohome="0"
2005-09-13 15:27:35 +02:00
homesize=""
2005-08-31 18:29:56 +02:00
if [ ! "$auto" = r ]
2005-09-13 15:39:42 +02:00
then
echo ""
2005-09-13 14:29:08 +02:00
echo " --- Step 6: Select the size of /home ----------------------------------"
2005-08-31 18:29:56 +02:00
while [ -z "$homesize" ]
do
2005-09-13 15:41:33 +02:00
# 20% of what is left over after / and /usr
2005-09-11 22:00:56 +02:00
# are taken.
2005-09-11 22:23:46 +02:00
defmb="`expr $maxhome / 5`"
2005-09-13 11:52:15 +02:00
if [ "$defmb" -gt "$maxhome" ]
2005-09-09 14:22:19 +02:00
then
defmb=$maxhome
fi
2005-08-31 18:29:56 +02:00
echo ""
2005-09-09 14:22:19 +02:00
echo "MINIX will take up $TOTALMB MB, without /home."
echo -n "How big do you want your /home to be in MB (0-$maxhome) ? [$defmb] "
2005-08-31 18:48:46 +02:00
read homesize
if [ "$homesize" = "" ] ; then homesize=$defmb; fi
2005-09-09 14:22:19 +02:00
if [ "$homesize" -lt 1 ]
then nohome=1
2005-09-13 15:27:35 +02:00
echo "Ok, not making a /home."
2005-09-09 14:22:19 +02:00
homesize=0
else
2005-09-13 15:27:35 +02:00
if [ "$homesize" -gt "$maxhome" ]
2005-09-09 14:22:19 +02:00
then echo "That won't fit!"
2005-09-13 15:41:33 +02:00
homesize=""
2005-09-09 14:22:19 +02:00
else
2005-09-26 13:34:57 +02:00
echo ""
2005-09-09 14:22:19 +02:00
echo -n "$homesize MB Ok? [Y] "
read ok
[ "$ok" = Y -o "$ok" = y -o "$ok" = "" ] || homesize=""
fi
fi
2005-08-31 18:29:56 +02:00
echo ""
done
# Homesize in sectors
homemb="$homesize MB"
2005-08-31 18:55:34 +02:00
homesize="`expr $homesize '*' 1024 '*' 2`"
2005-08-31 18:29:56 +02:00
else
2005-09-13 15:45:22 +02:00
homepart="`devsize /dev/$home`"
homesize="`expr $homepart / 2 / 1024`"
2005-09-13 15:39:42 +02:00
if [ "$homesize" -gt "$maxhome" ]
then
echo "Sorry, but your /home is too big ($homesize MB) to leave enough"
echo "space on the rest of the partition ($devsizemb MB) for your"
echo "selected installation size ($TOTALMB MB)."
exit 1
fi
2005-08-31 18:29:56 +02:00
# Homesize unchanged (reinstall)
homesize=exist
homemb="current size"
fi
2005-08-12 13:08:23 +02:00
2005-08-10 17:14:14 +02:00
blockdefault=4
2005-08-09 13:16:15 +02:00
2005-08-31 18:29:56 +02:00
if [ ! "$auto" = "r" ]
then
echo ""
echo " --- Step 7: Select a block size ---------------------------------------"
2005-08-31 18:29:56 +02:00
echo ""
echo "The maximum (and default) file system block size is $blockdefault KB."
echo "For a small disk or small RAM you may want 1 or 2 KB blocks."
echo ""
while [ -z "$blocksize" ]
do
echo -n "Block size in kilobytes? [$blockdefault] "; read blocksize
test -z "$blocksize" && blocksize=$blockdefault
if [ "$blocksize" -ne 1 -a "$blocksize" -ne 2 -a "$blocksize" -ne $blockdefault ]
then
warn "1, 2 or 4 please"
blocksize=""
fi
done
else
blocksize=$blockdefault
fi
2005-07-22 20:30:40 +02:00
blocksizebytes="`expr $blocksize '*' 1024`"
echo "
2005-09-10 22:33:11 +02:00
You have selected to (re)install MINIX 3 in the partition /dev/$primary.
2005-08-12 13:42:57 +02:00
The following subpartitions are now being created on /dev/$primary:
2005-07-13 15:04:56 +02:00
2005-09-08 11:29:17 +02:00
Root subpartition: /dev/$root $ROOTMB MB
2005-08-31 18:29:56 +02:00
/home subpartition: /dev/$home $homemb
2005-07-13 15:04:56 +02:00
/usr subpartition: /dev/$usr rest of $primary
"
2005-07-13 15:04:56 +02:00
# Secondary master bootstrap.
installboot -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
# Partition the primary.
2005-09-08 11:29:17 +02:00
partition /dev/$primary 1 81:${ROOTSECTS}* 81:$homesize 81:0+ > /dev/null || exit
2005-08-31 18:29:56 +02:00
2005-09-09 11:14:44 +02:00
echo "Creating /dev/$root for / .."
2005-08-12 13:42:57 +02:00
mkfs -B $blocksizebytes /dev/$root || exit
2005-09-09 14:22:19 +02:00
if [ "$nohome" = 0 ]
then
if [ ! "$auto" = r ]
then echo "Creating /dev/$home for /home .."
mkfs -B $blocksizebytes /dev/$home || exit
fi
else echo "Skipping /home"
2005-08-31 18:29:56 +02:00
fi
2005-08-12 13:42:57 +02:00
2005-09-09 11:14:44 +02:00
echo "Creating /dev/$usr for /usr .."
2005-08-31 18:57:13 +02:00
mkfs -B $blocksizebytes /dev/$usr || exit
echo ""
echo " --- Step 8: Wait for bad block detection ------------------------------"
echo ""
2005-08-31 18:29:56 +02:00
echo "Scanning disk for bad blocks. Hit CTRL+C to stop the scan if you are"
2005-08-12 13:08:23 +02:00
echo "sure that there can not be any bad blocks. Otherwise just wait."
2005-07-13 15:04:56 +02:00
2005-08-12 13:08:23 +02:00
trap ': nothing;echo' 2
2005-09-01 18:17:46 +02:00
echo ""
2005-08-12 13:08:23 +02:00
echo "Scanning /dev/$root for bad blocks:"
readall -b /dev/$root | sh
2005-08-31 18:57:13 +02:00
2005-09-09 14:22:19 +02:00
if [ "$nohome" = 0 ]
then
echo ""
echo "Scanning /dev/$home for bad blocks:"
readall -b /dev/$home | sh
fshome="home=/dev/$home"
else fshome=""
fi
2005-08-31 18:57:13 +02:00
2005-08-12 13:08:23 +02:00
echo ""
echo "Scanning /dev/$usr for bad blocks:"
2005-07-13 15:04:56 +02:00
readall -b /dev/$usr | sh
2005-09-01 18:17:46 +02:00
2005-07-13 15:04:56 +02:00
trap 2
echo ""
echo " --- Step 9: Wait for files to be copied -------------------------------"
echo ""
2005-09-27 14:56:48 +02:00
echo "This is the final step of the MINIX 3 setup. All files will now be"
2005-08-12 13:42:57 +02:00
echo "copied to your hard disk. This may take a while."
echo ""
2005-08-09 13:16:15 +02:00
2005-08-12 13:42:57 +02:00
mount /dev/$usr /mnt >/dev/null || exit # Mount the intended /usr.
2005-07-13 15:04:56 +02:00
(cd /usr || exit 1
if [ "$nobigsource" = 1 ]
then list="`ls | fgrep -v src.`"
else list="`ls`"
fi
2005-09-12 18:14:57 +02:00
for d in $list
do
cpdir -v $d /mnt/$d
done
) | progressbar "$USRFILES" || exit # Copy the usr floppy.
if [ -d /mnt/src.commands ]
then mv /mnt/src.commands /mnt/src/commands
fi
if [ -d /mnt/src.contrib ]
then mv /mnt/src.contrib /mnt/src/contrib
fi
# Set inet.conf to correct driver
if [ -n "$driver" ]
then echo "$driverargs" >$MYLOCALRC
disable=""
else disable="disable=inet;"
fi
# Set inet.conf to correct driver
if [ -n "$driver" ]
then echo "$driverargs" >$MYLOCALRC
disable=""
else disable="disable=inet;"
fi
2005-08-12 13:42:57 +02:00
umount /dev/$usr >/dev/null || exit # Unmount the intended /usr.
mount /dev/$root /mnt >/dev/null || exit
# Running from the installation CD.
2005-09-11 19:20:30 +02:00
cpdir -vx / /mnt | progressbar "$ROOTFILES" || exit
if [ -n "$driver" ]
then echo "eth0 $driver 0 { default; };" >/mnt/etc/inet.conf
fi
2005-07-13 15:04:56 +02:00
# CD remnants that aren't for the installed system
2005-09-09 14:22:19 +02:00
rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
2005-08-12 13:08:23 +02:00
# Change /etc/fstab. (No swap.)
# ${swap:+swap=/dev/$swap}
2005-07-13 15:04:56 +02:00
echo >/mnt/etc/fstab "\
# Poor man's File System Table.
root=/dev/$root
2005-08-31 18:29:56 +02:00
usr=/dev/$usr
2005-09-09 14:22:19 +02:00
$fshome"
2005-07-13 15:04:56 +02:00
# National keyboard map.
test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
2005-08-12 13:42:57 +02:00
umount /dev/$root >/dev/null || exit # Unmount the new root.
2005-08-22 14:36:42 +02:00
mount /dev/$usr /mnt >/dev/null || exit
2005-07-13 15:04:56 +02:00
2005-09-01 18:39:03 +02:00
# Make bootable.
installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit
edparams /dev/$root "rootdev=$root; ramimagedev=$root; $disable; minix(1,Start MINIX 3 (requires at least 16 MB RAM)) { label=BIG; boot; }; smallminix(2,Start Small MINIX 3 (intended for 8 MB RAM systems)) { label=SMALL; ramsize=0; boot; }; main() { echo By default, MINIX 3 will automatically load in 3 seconds.; echo Press ESC to enter the monitor for special configuration.; trap 3000 boot; menu; }; save" || exit
2005-09-01 18:39:03 +02:00
pfile="/mnt/src/tools/fdbootparams"
echo "rootdev=$root; ramimagedev=$root; $disable; save" >$pfile
# Save name of CD drive
2006-02-03 16:41:58 +01:00
echo "cddrive=`mount | grep usr | awk '{ print $1 }' | sed 's/p.*//'`" >>/mnt/etc/rc.package
2005-08-31 18:29:56 +02:00
2005-07-13 15:04:56 +02:00
sync
bios="`echo $primary | sed 's/d./dX/g'`"
2005-09-05 19:02:26 +02:00
if [ ! "$auto" = "r" ]
2005-09-09 14:22:19 +02:00
then if mount /dev/$home /home 2>/dev/null
2005-09-05 19:02:26 +02:00
then for u in bin ast
do if mkdir ~$u
then echo " * Creating home directory for $u in ~$u"
cpdir /usr/ast ~$u
chown -R $u:operator ~$u
else echo " * Couldn't create ~$u"
fi
done
umount /dev/$home
fi
fi
2006-02-06 17:17:54 +01:00
echo "Install is done. Running postinstall script.."
# Now chroot-mount the new system and run the postinstall script
2006-02-06 17:40:15 +01:00
umount /dev/$usr || exit 1
2006-02-06 17:17:54 +01:00
mount /dev/$root /mnt || exit 1
mount /dev/$usr /mnt/usr || exit 1
chroot /mnt '/bin/sh /usr/src/commands/scripts/postinstall.sh'
echo "Postinstall script done. Saving random data.."
2006-02-17 14:11:20 +01:00
dd if=/dev/random of=/mnt/usr/adm/random.dat bs=1024 count=1
2005-09-15 15:22:10 +02:00
2005-07-13 15:04:56 +02:00
echo "
Please type 'shutdown' to exit MINIX 3 and enter the boot monitor. At
the boot monitor prompt, type 'boot $bios', where X is the bios drive
number of the drive you installed on, to try your new MINIX system.
$biosdrivename
2005-08-12 13:08:23 +02:00
2005-09-10 22:33:11 +02:00
This ends the MINIX 3 setup script. After booting your newly set up system,
2005-08-12 13:08:23 +02:00
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.
2005-08-08 16:28:32 +02:00
"
2005-07-13 15:04:56 +02:00