From: Ben Gras Date: Wed, 13 Jul 2005 13:04:56 +0000 (+0000) Subject: setup -> setupcd X-Git-Tag: v3.1.0~622 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.host.html?a=commitdiff_plain;h=0f746219fcf557b4d9abd5dc9efea071dc980860;p=minix.git setup -> setupcd --- diff --git a/commands/scripts/Makefile b/commands/scripts/Makefile index aa948baae..5058ee52f 100755 --- a/commands/scripts/Makefile +++ b/commands/scripts/Makefile @@ -34,6 +34,7 @@ usr: \ /usr/bin/mkdep \ /usr/bin/mkdist \ /usr/bin/setup \ + /usr/bin/setupcd \ /usr/bin/spell \ /usr/bin/srccrc \ /usr/bin/svclog \ @@ -101,6 +102,9 @@ clean: /usr/bin/mkdist: mkdist.sh install -m 755 -c -o bin $? $@ +/usr/bin/setupcd: setupcd.sh + install -m 755 -c -o bin $? $@ + /usr/bin/setup: setup.sh install -m 755 -c -o bin $? $@ diff --git a/commands/scripts/setupcd.sh b/commands/scripts/setupcd.sh new file mode 100755 index 000000000..271a1c0b1 --- /dev/null +++ b/commands/scripts/setupcd.sh @@ -0,0 +1,408 @@ +#!/bin/sh +# +# setup 4.1 - install a Minix distribution Author: Kees J. Bot +# 20 Dec 1994 + +PATH=/bin:/usr/bin +export PATH + +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 +} + +# No options. +while getopts '' opt; do usage; done +shift `expr $OPTIND - 1` + +# Installing a floppy set? +case $# in +0) # No, we're installing a skeleton system on the hard disk. + ;; +1) + cd "$1" || exit + + # Annoying message still there? + grep "'setup /usr'" /etc/issue >/dev/null 2>&1 && rm -f /etc/issue + + if [ -t 0 ] + then + size=bad + while [ "$size" = bad ] + do + echo -n "\ +What is the size of the images on the diskettes? [all] "; read size + + case $size in + ''|360|720|1200|1440) + ;; + *) echo "Sorry, I don't believe \"$size\", try again." >&2 + size=bad + esac + done + + drive= + while [ -z "$drive" ] + do + echo -n "What floppy drive to use? [0] "; read drive + + case $drive in + '') drive=0 + ;; + [01]) + ;; + *) echo "It must be 0 or 1, not \"$drive\"." + drive= + esac + done + + vol -r $size /dev/fd$drive | uncompress | tar xvfp - + else + # Standard input is where we can get our files from. + uncompress | tar xvfp - + fi + + echo Done. + exit + ;; +*) + usage +esac + +# Installing Minix on the hard disk. +# Must be in / or we can't mount or umount. +if [ ! -f /CD ] +then + case "`pwd`" in + /?*) + echo "Please type 'cd /' first, you are locking up `pwd`" >&2 + exit 1 + esac +fi + +case "$0" in +/tmp/*) + rm -f "$0" + ;; +*) cp -p "$0" /tmp/setup + exec /tmp/setup +esac + +# Find out what we are running from. +exec 9<&0 /dev/null || exit + + # Partition the primary. +p3=0:0 +test "$swapsize" -gt 0 && p3=81:`expr $swapsize \* 2` +partition /dev/$primary 1 81:32768* $p3 81:0+ || exit + +if [ "$swapsize" -gt 0 ] +then + # We must have that swap, now! + mkswap -f /dev/$swap || exit + mount -s /dev/$swap || exit +else + # Forget about swap. + swap= +fi + +echo " +Migrating to disk... +" + +mkfs /dev/$usr +echo "\ +Scanning /dev/$usr for bad blocks. (Hit DEL to stop the scan if you are +absolutely sure that there can not be any bad blocks. Otherwise just wait.)" +trap ': nothing' 2 +readall -b /dev/$usr | sh +sleep 2 +trap 2 + +mount /dev/$usr /mnt || exit # Mount the intended /usr. + +cpdir -v /usr /mnt || exit # Copy the usr floppy. + +umount /dev/$usr || exit # Unmount the intended /usr. + +umount $fdusr # Unmount the /usr floppy. + +mount /dev/$usr /usr || exit # A new /usr + +if [ $fdroot = unknown ] +then + echo " +By now the floppy USR has been copied to /dev/$usr, and it is now in use as +/usr. Please insert the installation ROOT floppy in a floppy drive." + + drive= + while [ -z "$drive" ] + do + echo -n "What floppy drive is it in? [0] "; read drive + + case $drive in + '') drive=0 + ;; + [01]) + ;; + *) echo "It must be 0 or 1, not \"$drive\"." + drive= + esac + done + fdroot=/dev/fd$drive +fi + +echo " +Copying $fdroot to /dev/$root +" + +mkfs /dev/$root || exit +mount /dev/$root /mnt || exit +if [ -d /boot ] +then + # Running from the floppy itself (or installation CD). + cpdir -vx / /mnt || exit + chmod 555 /mnt/usr +else + # Running from the RAM disk, root image is on a floppy. + mount $fdroot /root || exit + cpdir -v /root /mnt || exit + umount $fdroot || exit + cpdir -f /dev /mnt/dev # Copy any extra MAKEDEV'd devices +fi + +# CD remnants that aren't for the installed system +rm /mnt/etc/issue /mnt/CD 2>/dev/null + # Change /etc/fstab. +echo >/mnt/etc/fstab "\ +# Poor man's File System Table. + +root=/dev/$root +${swap:+swap=/dev/$swap} +usr=/dev/$usr" + + # National keyboard map. +test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap + +# Set inet.conf to correct driver +if [ -n "$driver" ] +then echo "eth0 $driver 0 { default; };" >/mnt/etc/inet.conf +fi + +umount /dev/$root || exit # Unmount the new root. + +# Compute size of the second level file block cache. +case `arch` in +i86) + cache=`expr "0$memsize" - 1024` + test $cache -lt 32 && cache=0 + test $cache -gt 512 && cache=512 + ;; +*) + cache=`expr "0$memsize" - 2560` + test $cache -lt 64 && cache=0 + test $cache -gt 1024 && cache=1024 +esac +echo "Second level file system block cache set to $cache kb." +if [ $cache -eq 0 ]; then cache=; else cache="ramsize=$cache"; fi + + # Make bootable. +installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit +edparams /dev/$root "rootdev=$root; ramimagedev=$root; $cache; $inetparams; save" || exit +pfile="/usr/src/tools/fdbootparams" +echo "Remembering boot parameters in ${pfile}." +echo "rootdev=$root; ramimagedev=$root; $cache; save" >$pfile || exit +sync + +echo " +Please type 'halt' to exit Minix. +You can type 'boot $primary' to try the newly installed Minix system. See +\"TESTING\" in the usage manual." + diff --git a/tools/issue.install b/tools/issue.install index 8bb29591c..ed198800c 100644 --- a/tools/issue.install +++ b/tools/issue.install @@ -1,3 +1,3 @@ -Login as root and run 'setup' to install Minix. +Login as root and run 'setupcd' to install Minix.