3 # instdist - Install a distribution from some sort of media.
5 # Written: November 11th, 1994
6 # Copyright (C) 1994 by Jordan K. Hubbard
8 # Permission to copy or use this software for any purpose is granted
9 # provided that this message stay intact, and at this location (e.g. no
10 # putting your name on top after doing something trivial like reindenting
11 # it, just to make it look like you wrote it!).
13 # $Id: instdist.sh,v 1.24 1994/11/21 07:25:27 jkh Exp $
15 if [ "$_INSTINST_SH_LOADED_" = "yes" ]; then
18 _INSTINST_SH_LOADED_=yes
21 # Grab the miscellaneous functions.
24 # Set some reasonable defaults.
26 TAR_FLAGS="--unlink -xvf"
29 # Set the initial state for media installation.
48 serial_interface="/dev/tty00"
52 # Set the installation media to undefined.
60 # Set the location of our temporary unpacking directory.
63 title="Chose temporary directory"
64 default_value="/usr/tmp"
66 "Please specify the name of a directory containing enough free
67 space to hold the temporary files for this distribution. At
68 minimum, a binary distribution will require around 21MB of
69 temporary space. At maximum, a srcdist may take 30MB or more.
70 If the directory you specify does not exist, it will be created
71 for you. If you do not have enough free space to hold both the
72 packed and unpacked distribution files, consider using the NFS
73 or CDROM installation methods as they require no temporary
74 storage."; then return 1; fi
82 if ! cd $tmp_dir > /dev/ttyv1 2>&1; then
83 error "No such file or directory for ${tmp_dir}, sorry! Please fix this and try again."
91 if dialog --title "Delete contents?" $clear --yesno \
92 "Do you wish to delete the contents of ${tmp_dir}?" -1 -1; then
97 media_select_ftp_site()
99 dialog $clear --title "Please specify an ftp site" \
101 "FreeBSD is distributed from a number of sites on the Internet.\n\
102 Please select the site closest to you or \"other\" if you'd like\n\
103 to specify another choice. Also note that not all sites carry\n\
104 every possible distribution! Distributions other than the basic\n\
105 binary set are only guaranteed to be available from the Primary site." \
107 "Primary" "ftp://ftp.freebsd.org/pub/FreeBSD/${DISTNAME}" \
108 "U.S-2" "ftp://ftp.dataplex.net/pub/FreeBSD/${DISTNAME}" \
109 "U.S-3" "ftp://kryten.atinc.com/pub/FreeBSD/${DISTNAME}" \
110 "U.S-4" "ftp://ref.tfs.com/pub/FreeBSD/${DISTNAME}" \
111 "Taiwan" "ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/${DISTNAME}" \
112 "Australia" "ftp://ftp.physics.usyd.edu.au/FreeBSD/${DISTNAME}" \
113 "France" "ftp://ftp.ibp.fr/pub/freeBSD/${DISTNAME}" \
114 "Finland" "ftp://nic.funet.fi:/pub/unix/FreeBSD/${DISTNAME}" \
115 "Russia" "ftp://ftp.kiae.su/FreeBSD/${DISTNAME}" \
116 "other" "None of the above. I want to specify my own." \
117 2> ${TMP}/menu.tmp.$$
119 answer=`cat ${TMP}/menu.tmp.$$`
120 rm -f ${TMP}/menu.tmp.$$
121 if ! handle_rval $retval; then return 1; fi
124 ftp_path="ftp://ftp.freebsd.org/pub/FreeBSD/${DISTNAME}"
128 ftp_path="ftp://ftp.dataplex.net/pub/FreeBSD/${DISTNAME}"
132 ftp_path="ftp://kryten.atinc.com/pub/FreeBSD/${DISTNAME}"
136 ftp_path="ftp://ref.tfs.com/pub/FreeBSD/${DISTNAME}"
140 ftp_path="ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/${DISTNAME}"
144 ftp_path="ftp://ftp.physics.usyd.edu.au/FreeBSD/${DISTNAME}"
148 ftp_path="ftp://ftp.ibp.fr/pub/freeBSD/${DISTNAME}"
152 ftp_path="ftp://nic.funet.fi:/pub/unix/FreeBSD/${DISTNAME}"
156 ftp_path="ftp://ftp.kiae.su/FreeBSD/${DISTNAME}"
160 title="FTP Installation Information"
161 default_value="$ftp_path"
163 "Please specify the machine and directory location of the
164 distribution you wish to load. This should be either a \"URL style\"
165 specification (e.g. ftp://ftp.freeBSD.org/pub/FreeBSD/...) or simply
166 the name of a host to connect to. If only a host name is specified,
167 the installation assumes that you will properly connect and \"mget\"
168 the files yourself."; then return 1; fi
176 if [ -f do_cksum.sh ]; then
177 message "Verifying checksums for distribution. Please wait!"
178 if sh ./do_cksum.sh; then
179 if [ -f extract.sh ]; then
180 message "Extracting ${media_distribution} distribution. Please wait!"
181 sh ./extract.sh < /dev/ttyv1 > /dev/ttyv1 2>&1
182 dialog $clear --title "Extraction Complete" --msgbox "Please press return to continue" -1 -1
184 error "No installation script found!"
187 error "Checksum error(s) found. Please check media!"
190 error "Improper distribution. No checksum script found!"
198 if ! cd ${media_device}/${media_distribution} > /dev/ttyv1 2>&1; then
199 error "Unable to cd to ${media_device}/${media_distribution} directory."
209 if ! media_set_tmpdir; then return; fi
210 if ! media_cd_tmpdir; then return; fi
211 confirm "Please mount tape for ${media_device}."
212 if [ "$media_device" = "ftape" ]; then
213 dialog --title "Results of tape extract" $clear \
214 --prgbox "ft | $TAR $TAR_FLAGS -" 10 72
216 dialog --title "Results of tape extract" $clear \
217 --prgbox "$TAR $TAR_FLAGS $media_device" 10 72
224 if ! media_set_tmpdir; then return; fi
225 if ! media_cd_tmpdir; then return; fi
227 while [ "$copying" = "yes" ]; do
228 if dialog --title "Insert distribution diskette" \
229 $clear --yesno "Please enter the next diskette and press OK to continue or Cancel if finished" -1 -1; then
230 umount ${MNT} > /dev/null 2>&1
231 if ! mount_msdos ${media_device} ${MNT}; then
232 error "Unable to mount floppy! Please correct."
234 ( tar -cf - -C ${MNT} . | tar -xvf - ) >/dev/ttyv1 2>&1
247 if ! media_set_tmpdir; then return; fi
248 if ! media_cd_tmpdir; then return; fi
249 if ! echo $media_device | grep -q -v 'ftp://'; then
250 message "Fetching distribution using ncftp.\nUse ALT-F2 to see output, ALT-F1 to return."
251 if ! ncftp $media_device/${media_distribution}/* < /dev/null > /dev/ttyv1 2>&1; then
252 error "Couldn't fetch ${media_distribution} distribution from\n${media_device}!"
268 media_select_distribution()
270 media_distribution=""
271 while [ "$media_distribution" = "" ]; do
273 dialog $clear --title "Please specify a distribution to load" \
275 "FreeBSD is separated into a number of distributions for ease of\n\
276 installation. With repeated passes through this screen, you'll be\n\
277 given the chance to load one or all of them. Mandatory distributions\n\
278 MUST be loaded! Please also note that the secrdist is NOT FOR EXPORT\n\
279 from the U.S. Please don't endanger U.S. ftp sites by getting it\n\
280 illegally, thanks! When finished, select <Cancel>." \
282 "?diskfree" "How much disk space do I have free?" \
283 "bindist" "Binary base files (mandatory - $BINSIZE)" \
284 "games" "Games and other frivolities (optional - $GAMESIZE)" \
285 "manpages" "Manual pages (optional - $MANSIZE)" \
286 "proflibs" "Profiled libraries (optional - $PROFSIZE)" \
287 "dict" "Spelling checker dictionary files (optional - $DICTSIZE)" \
288 "srcdist" "Sources for everything but DES (optional - $SRCSIZE)" \
289 "secrdist" "DES encryption code (and sources) (optional - $SECRSIZE)" \
290 "compat1xdist" "FreeBSD 1.x binary compatability (optional - $COMPATSIZE)" \
291 "XFree86-3.1" "The XFree86 3.1 distribution (optional - $X11SIZE)" \
292 2> ${TMP}/menu.tmp.$$
294 media_distribution=`cat ${TMP}/menu.tmp.$$`
295 rm -f ${TMP}/menu.tmp.$$
296 if ! handle_rval $retval; then return 1; fi
297 if [ "$media_distribution" = "?diskfree" ]; then
298 if df -k > ${TMP}/df.out; then
300 --title "How much free space do I have?" \
301 --textbox ${TMP}/df.out 15 76
303 error "Couldn't get disk usage information! :-("
305 media_distribution=""
310 media_get_possible_subdir()
312 default_value="$distrib_subdir"
313 title="Distribution Subdirectory"
315 "If the distributions are in a subdirectory of the mount point,
316 please enter it here (no leading slash - it should be relative
317 to the mount point). The directory you enter should be the
318 *parent* directory of any distribution subdirectories."; then
319 if [ "$answer" != "" ]; then
320 media_device=${media_device}/$answer
321 distrib_subdir=$answer
326 # Get values into $media_type and $media_device. Call network initialization
330 while [ "$media_device" = "" ]; do
332 dialog $clear --title "Installation From" \
334 "Before installing a distribution, you need to chose and/or configure\n\
335 a method of installation. Please pick from one of the following options.\n\
336 If none of the listed options works for you, then your best bet may be to\n\
337 simply hit ESC twice to get a subshell and proceed manually on your own.\n\
338 If you are already finished with the installation process, select cancel\n\
339 to proceed." -1 -1 7 \
340 "?Kern" "Please show me the kernel boot messages again!" \
341 "Tape" "Load distribution from SCSI, QIC or floppy tape" \
342 "CDROM" "Load distribution from SCSI or Mitsumi CDROM" \
343 "DOS" "Load from DOS floppies or a DOS hard disk partition" \
344 "FTP" "Load distribution using FTP" \
345 "UFS" "Load the distribution from existing UFS partition" \
346 "NFS" "Load the distribution over NFS" 2> ${TMP}/menu.tmp.$$
348 choice=`cat ${TMP}/menu.tmp.$$`
349 rm -f ${TMP}/menu.tmp.$$
350 if ! handle_rval $retval; then return 1; fi
354 if dmesg > ${TMP}/dmesg.out; then
356 --title "What do I have in this machine again?" \
357 --textbox ${TMP}/dmesg.out 22 76
359 error "Couldn't get dmesg information! :-("
364 dialog $clear --title "Chose Tape Type" \
365 --menu "Which type of tape drive do you have attached to your \n\
366 system? FreeBSD supports the following types:\n" -1 -1 3 \
367 "SCSI" "SCSI tape drive attached to supported SCSI controller" \
368 "QIC" "QIC tape drive (Colorado Jumbo, etc)" \
369 "floppy" "Floppy tape drive" \
370 2> ${TMP}/menu.tmp.$$
372 choice=`cat ${TMP}/menu.tmp.$$`
373 rm -f ${TMP}/menu.tmp.$$
374 if ! handle_rval $retval; then continue; fi
378 media_device=/dev/rst0
381 media_device=/dev/rwt0
390 dialog $clear --title "Chose CDROM Type" \
391 --menu "Which type of CDROM drive do you have attached to your \n\
392 system? FreeBSD supports the following types:\n" -1 -1 2 \
393 "SCSI" "SCSI CDROM drive attached to supported SCSI controller" \
394 "Mitsumi" "Mitsumi CDROM drive" \
395 2> ${TMP}/menu.tmp.$$
397 choice=`cat ${TMP}/menu.tmp.$$`
398 rm -f ${TMP}/menu.tmp.$$
399 if ! handle_rval $retval; then continue; fi
403 media_device=/dev/cd0a
406 media_device=/dev/mcd0a
409 umount ${MNT} > /dev/null 2>&1
410 if ! mount_cd9660 $media_device ${MNT} > /dev/ttyv1 2>&1; then
411 error "Unable to mount $media_device on ${MNT}"
415 media_get_possible_subdir
420 default_value="/dev/fd0"
422 "Please specify the device pointing at your DOS partition or
423 floppy media. For a hard disk, this might be something like
424 /dev/wd0h or /dev/sd0h (as identified in the disklabel editor).
425 For the "A" floppy drive, it's /dev/fd0, for the "B" floppy
426 drive it's /dev/fd1\n"; then
428 if echo $media_device | grep -q -v 'fd://'; then
429 umount ${MNT} > /dev/null 2>&1
430 if ! mount_msdos $media_device ${MNT} > /dev/ttyv1 2>&1; then
431 error "Unable to mount $media_device"
436 media_get_possible_subdir
445 if ! network_setup; then continue; fi
446 if media_select_ftp_site; then
448 media_device=$ftp_path
453 if ! network_setup; then continue; fi
454 title="NFS Installation Information"
455 default_value="$nfs_path"
457 "Please specify a machine and directory mount point for the
458 distribution you wish to load. This must be in machine:dir
459 format (e.g. zooey:/a/FreeBSD/${DISTNAME}). The remote
460 directory *must* be be exported to your machine (or globally)
461 for this to work!\n"; then continue; fi
464 "Do you wish to specify any options to NFS? If you're installing
465 from a Sun 4.1.x system, you may wish to specify resvport to allow
466 installation over a priviledged port. When using a slow ethernet
467 card or network link, rsize=4096,wsize=4096 may also prove helpful.
468 Options, if any, should be separated by commas."; then
469 if [ "$answer" != "" ]; then
470 nfs_options="-o $answer"
475 umount ${MNT} > /dev/null 2>&1
476 if ! mount_nfs $nfs_options $nfs_path ${MNT} > /dev/ttyv1 2>&1; then
477 error "Unable to mount $nfs_path"
479 message "$nfs_path mounted successfully"
481 media_get_possible_subdir
486 dialog $clear --title "User Intervention Requested" --msgbox "
487 Please mount the filesystem you wish to use somewhere convenient and
488 exit the shell when you're through. I'll ask you for the location
489 of the distribution when we come back." -1 -1
492 title="Please enter directory"
493 default_value="${MNT}/bindist"
494 if input "Ok, now give me the full pathname of the directory where you've got the distribution."; then
495 if [ ! -f $answer/extract.sh ]; then
496 error "That's not a valid distribution"