diff options
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/hp300/ramdisk/dot.profile | 28 | ||||
-rw-r--r-- | distrib/hp300/ramdisk/install.sh | 377 | ||||
-rw-r--r-- | distrib/hp300/ramdisk/install.sub | 660 | ||||
-rw-r--r-- | distrib/hp300/ramdisk/list | 3 | ||||
-rw-r--r-- | distrib/hp300/ramdisk/raminst.conf | 14 |
5 files changed, 733 insertions, 349 deletions
diff --git a/distrib/hp300/ramdisk/dot.profile b/distrib/hp300/ramdisk/dot.profile index 4f28ab30d16..7b0ce55124c 100644 --- a/distrib/hp300/ramdisk/dot.profile +++ b/distrib/hp300/ramdisk/dot.profile @@ -1,5 +1,5 @@ # -# $OpenBSD: dot.profile,v 1.3 1997/02/23 19:10:51 downsj Exp $ +# $OpenBSD: dot.profile,v 1.4 1997/10/13 07:47:21 downsj Exp $ # $NetBSD: dot.profile,v 1.1 1995/07/18 04:13:09 briggs Exp $ # # Copyright (c) 1994 Christopher G. Demetriou @@ -35,19 +35,25 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ export PATH TERM=hp300h export TERM +HOME=/ +export HOME -# set up some sane defaults -echo 'erase ^?, werase ^H, kill ^U, intr ^C' -stty newcrt werase ^H intr ^C kill ^U erase ^? 9600 -echo '' +TMPWRITEABLE=/tmp/writeable + +if [ "X${DONEPROFILE}" = "X" ]; then + DONEPROFILE=YES + export DONEPROFILE + + # set up some sane defaults + echo 'erase ^?, werase ^W, kill ^U, intr ^C' + stty newcrt werase ^W intr ^C kill ^U erase ^? 9600 + echo '' -# This needs to be done now, for the sake of ksh. -if [ ! -f /tmp/writeable ]; then echo 'Remounting /dev/rd0a as root...' - mount -t ffs -u /dev/rd0a / - sleep 2 - # ..and let install.md know we've done it. - > /tmp/writeable + mount /dev/rd0a / + + # tell install.md we've done it + > ${TMPWRITEABLE} fi # pull in the function definitions that people will use from the shell prompt. diff --git a/distrib/hp300/ramdisk/install.sh b/distrib/hp300/ramdisk/install.sh index 10d7018b65e..b1287b7e5f3 100644 --- a/distrib/hp300/ramdisk/install.sh +++ b/distrib/hp300/ramdisk/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sh,v 1.3 1997/04/21 07:32:12 downsj Exp $ +# $OpenBSD: install.sh,v 1.4 1997/10/13 07:47:22 downsj Exp $ # $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ FILESYSTEMS="/tmp/filesystems" # used thoughout FQDN="" # domain name -trap "umount /tmp >> /dev/null 2>&1" 0 +trap "umount /tmp > /dev/null 2>&1" 0 MODE="install" @@ -64,6 +64,7 @@ MODE="install" # md_native_fstype() - native filesystem type for disk installs # md_native_fsopts() - native filesystem options for disk installs # md_makerootwritable() - make root writable (at least /tmp) +# md_machine_arch() - get machine architecture # include machine dependent subroutines . install.md @@ -71,15 +72,25 @@ MODE="install" # include common subroutines . install.sub -# Deal with terminal issues -md_set_term - -# Good {morning,afternoon,evening,night}. -md_welcome_banner -echo -n "Proceed with installation? [n] " +# which sets? +THESETS="$ALLSETS $MDSETS" + +if [ "`df /`" = "`df /mnt`" ]; then + # Good {morning,afternoon,evening,night}. + md_welcome_banner + echo -n "Proceed with installation? [n] " +else + echo "You seem to be trying to restart an interrupted installation!" + echo "" + echo "You can try to skip the disk preparation steps and continue," + echo "otherwise you should reboot the miniroot and start over..." + echo -n "Skip disk initialization? [n] " +fi getresp "n" case "$resp" in y*|Y*) + echo "" + echo "Cool! Let's get to it..." ;; *) md_not_going_to_install @@ -87,24 +98,11 @@ case "$resp" in ;; esac -echo -n "Is this a (s)napshot or (r)elease? [s] " -getresp "s" -case "$resp" in - s*|S*) - THESETS="$SNAPSETS $KERNSETS" - ;; - r*|R*) - THESETS="$ALLSETS $KERNSETS" - ;; - *) - md_not_going_to_install - exit - ;; -esac -echo "Cool! Let's get to it..." - # XXX Work around vnode aliasing bug (thanks for the tip, Chris...) -ls -l /dev >> /dev/null 2>&1 +ls -l /dev > /dev/null 2>&1 + +# Deal with terminal issues +md_set_term # Get timezone info get_timezone @@ -112,25 +110,33 @@ get_timezone # Make sure we can write files (at least in /tmp) # This might make an MFS mount on /tmp, or it may # just re-mount the root with read-write enabled. -md_makerootwritable - -# Install the shadowed disktab file; lets us write to it for temporary -# purposes without mounting the miniroot read-write. -cp /etc/disktab.shadow /tmp/disktab.shadow +if [ "`df /`" = "`df /tmp`" ]; then + md_makerootwritable +fi + +# Get the machine architecture (must be done after md_makerootwritable) +ARCH=`md_machine_arch` + +if [ "`df /`" = "`df /mnt`" ]; then + # Install the shadowed disktab file; lets us write to it for temporary + # purposes without mounting the miniroot read-write. + if [ -f /etc/disktab.shadow ]; then + cp /etc/disktab.shadow /tmp/disktab.shadow + fi -while [ "X${ROOTDISK}" = "X" ]; do - getrootdisk -done + while [ "X${ROOTDISK}" = "X" ]; do + getrootdisk + done -# Deal with disklabels, including editing the root disklabel -# and labeling additional disks. This is machine-dependent since -# some platforms may not be able to provide this functionality. -md_prep_disklabel ${ROOTDISK} + # Deal with disklabels, including editing the root disklabel + # and labeling additional disks. This is machine-dependent since + # some platforms may not be able to provide this functionality. + md_prep_disklabel ${ROOTDISK} -# Assume partition 'a' of $ROOTDISK is for the root filesystem. Loop and -# get the rest. -# XXX ASSUMES THAT THE USER DOESN'T PROVIDE BOGUS INPUT. -cat << \__get_filesystems_1 + # Assume partition 'a' of $ROOTDISK is for the root filesystem. + # Loop and get the rest. + # XXX ASSUMES THAT THE USER DOESN'T PROVIDE BOGUS INPUT. + cat << \__get_filesystems_1 You will now have the opportunity to enter filesystem information. You will be prompted for device name and mount point (full path, @@ -143,70 +149,103 @@ to resolve any filesystem order dependencies. __get_filesystems_1 -echo "The following will be used for the root filesystem:" -echo " ${ROOTDISK}a /" + echo "The following will be used for the root filesystem:" + echo " ${ROOTDISK}a /" -echo "${ROOTDISK}a /" > ${FILESYSTEMS} + echo "${ROOTDISK}a /" > ${FILESYSTEMS} -resp="X" # force at least one iteration -while [ "X$resp" != X"done" ]; do - echo "" - echo -n "Device name? [done] " - getresp "done" - case "$resp" in - done) - ;; - - *) - _device_name=`basename $resp` - - # force at least one iteration - _first_char="X" - while [ "X${_first_char}" != X"/" ]; do - echo -n "Mount point? " - getresp "" - _mount_point=$resp + resp="X" # force at least one iteration + while [ "X$resp" != X"done" ]; do + echo "" + echo -n "Device name? [done] " + getresp "done" + case "$resp" in + done) + ;; + + *) + _device_name=`basename $resp` + + # force at least one iteration + _first_char="X" + while [ "X${_first_char}" != X"/" ]; do + echo -n "Mount point? " + getresp "" + _mount_point=$resp + _first_char=`firstchar ${_mount_point}` + if [ "X${_first_char}" != X"/" ]; then + echo "mount point must be an absolute path!" + fi + done if [ "X${_mount_point}" = X"/" ]; then - # Invalid response; no multiple roots - _first_char="X" + echo "root mount point already taken care of!" else - _first_char=`firstchar ${_mount_point}` + echo "${_device_name} ${_mount_point}" \ + >> ${FILESYSTEMS} fi - done - echo "${_device_name} ${_mount_point}" >> ${FILESYSTEMS} - resp="X" # force loop to repeat - ;; + resp="X" # force loop to repeat + ;; + esac + done + + echo "" + echo "You have configured the following devices and mount points:" + echo "" + cat ${FILESYSTEMS} + echo "" + echo "Filesystems will now be created on these devices." + echo "If you made any mistakes, you may edit this now." + echo -n "Edit using ${EDITOR}? [n] " + getresp "n" + case "$resp" in + y*|Y*) + ${EDITOR} ${FILESYSTEMS} + ;; + *) + ;; esac -done + echo "" + echo "The next step will overwrite any existing data on:" + ( + echo -n " " + while read _device_name _junk; do + echo -n "${_device_name} " + done + echo "" + ) < ${FILESYSTEMS} + echo "" -echo "" -echo "You have configured the following devices and mount points:" -echo "" -cat ${FILESYSTEMS} -echo "" -echo "Filesystems will now be created on these devices. If you made any" -echo -n "mistakes, you may edit this now. Edit? [n] " -getresp "n" -case "$resp" in - y*|Y*) - ${EDITOR} ${FILESYSTEMS} - ;; - *) - ;; -esac + echo -n "Are you really sure that you're ready to proceed? [n] " + getresp "n" + case "$resp" in + y*|Y*) + ;; + *) + echo "ok, try again later..." + exit + ;; + esac -# Loop though the file, place filesystems on each device. -echo "Creating filesystems..." -( - while read _device_name _junk; do - newfs /dev/r${_device_name} - echo "" + # Loop though the file, place filesystems on each device. + echo "Creating filesystems..." + ( + while read _device_name _junk; do + newfs /dev/r${_device_name} + echo "" + done + ) < ${FILESYSTEMS} +else + # Get the root device + ROOTDISK=`df /mnt | sed -e '/^\//!d' -e 's/\/dev\/\([^ ]*\)[a-p] .*/\1/'` + while [ "X${ROOTDISK}" = "X" ]; do + getrootdisk done -) < ${FILESYSTEMS} +fi # Get network configuration information, and store it for placement in the # root filesystem later. cat << \__network_config_1 + You will now be given the opportunity to configure the network. This will be useful if you need to transfer the installation sets via FTP or NFS. Even if you choose not to transfer installation sets that way, this @@ -224,17 +263,17 @@ case "$resp" in if [ -f /etc/myname ]; then resp=`cat /etc/myname` fi - echo -n "Enter system hostname: [$resp] " while [ "X${resp}" = X"" ]; do + echo -n "Enter system hostname: [$resp] " getresp "$resp" done hostname $resp echo $resp > /tmp/myname - echo -n "Enter DNS domain name: " resp="" # force at least one iteration while [ "X${resp}" = X"" ]; do - getresp "" + echo -n "Enter DNS domain name: [$FQDN] " + getresp "$FQDN" done FQDN=$resp @@ -243,8 +282,8 @@ case "$resp" in echo -n "Enter IP address of default route: [none] " getresp "none" if [ "X${resp}" != X"none" ]; then - route delete default >> /dev/null 2>&1 - if route add default $resp >> /dev/null ; then + route delete default > /dev/null 2>&1 + if route add default $resp > /dev/null ; then echo $resp > /tmp/mygate fi fi @@ -275,8 +314,10 @@ case "$resp" in cat /tmp/hosts echo "" echo "You may want to edit the host table in the event that" - echo "you need to mount an NFS server." - echo -n "Would you like to edit the host table? [n] " + echo "you are doing an NFS installation or an FTP installation" + echo "without a name server and want to refer to the server by" + echo "name rather than by its numeric ip address." + echo -n "Would you like to edit the host table with ${EDITOR}? [n] " getresp "n" case "$resp" in y*|Y*) @@ -318,22 +359,23 @@ __network_config_2 ;; esac -# Now that the network has been configured, it is safe to configure the -# fstab. -( - while read _dev _mp; do - if [ "$mp" = "/" ]; then - echo /dev/$_dev $_mp ffs rw 1 1 - else - echo /dev/$_dev $_mp ffs rw 1 2 - fi - done -) < ${FILESYSTEMS} > /tmp/fstab +if [ "`df /`" = "`df /mnt`" ]; then + # Now that the network has been configured, it is safe to configure the + # fstab. + ( + while read _dev _mp; do + if [ "$_mp" = "/" ]; then + echo /dev/$_dev $_mp ffs rw 1 1 + else + echo /dev/$_dev $_mp ffs rw 1 2 + fi + done + ) < ${FILESYSTEMS} > /tmp/fstab -echo "The fstab is configured as follows:" -echo "" -cat /tmp/fstab -cat << \__fstab_config_1 + echo "The fstab is configured as follows:" + echo "" + cat /tmp/fstab + cat << \__fstab_config_1 You may wish to edit the fstab. For example, you may need to resolve dependencies in the order which the filesystems are mounted. You may @@ -342,20 +384,21 @@ This would be especially useful if you plan to keep '/usr' on an NFS server. __fstab_config_1 -echo -n "Edit the fstab? [n] " -getresp "n" -case "$resp" in - y*|Y*) - ${EDITOR} /tmp/fstab - ;; + echo -n "Edit the fstab with ${EDITOR}? [n] " + getresp "n" + case "$resp" in + y*|Y*) + ${EDITOR} /tmp/fstab + ;; - *) - ;; -esac + *) + ;; + esac -echo "" -munge_fstab /tmp/fstab /tmp/fstab.shadow -mount_fs /tmp/fstab.shadow + echo "" + munge_fstab /tmp/fstab /tmp/fstab.shadow + mount_fs /tmp/fstab.shadow +fi mount | while read line; do set -- $line @@ -373,46 +416,60 @@ mount | while read line; do fi done -install_sets $ALLSETS $MDSETS +install_sets $THESETS # Copy in configuration information and make devices in target root. -( - cd /tmp - for file in fstab hostname.* hosts myname mygate resolv.conf; do - if [ -f $file ]; then - echo -n "Copying $file..." - cp $file /mnt/etc/$file - echo "done." - fi - done - # If no zoneinfo on the installfs, give them a second chance - if [ ! -e /usr/share/zoneinfo ]; then - get_timezone - fi - if [ ! -e /mnt/usr/share/zoneinfo ]; then - echo "Cannot install timezone link..." - else - echo -n "Installing timezone link..." - rm -f /mnt/etc/localtime - ln -s /usr/share/zoneinfo/$TZ /mnt/etc/localtime +if [ ! -d /mnt/etc -o ! -d /mnt/usr/share/zoneinfo -o ! -d /mnt/dev ]; then + echo "Something needed to complete the installation seems" + echo "to be missing, did you forget to extract a required set?" + echo "" + echo "Please review the installation notes and try again..." + echo "" + echo "You *may* be able to correct the problem and type 'install'" + echo "without having to extract all of the distribution sets again." + exit +fi + +cd /tmp +for file in fstab hostname.* hosts myname mygate resolv.conf; do + if [ -f $file ]; then + echo -n "Copying $file..." + cp $file /mnt/etc/$file echo "done." fi - if [ ! -x /mnt/dev/MAKEDEV ]; then - echo "No /dev/MAKEDEV installed, something is wrong here..." - else - # Check if a device exists... snapshots have a dev.tar.gz - if [ ! -e /mnt/dev/rsd0a ]; then - echo -n "Making devices..." - cd /mnt/dev - sh MAKEDEV all - echo "done." - fi - fi - md_copy_kernel +done - md_installboot ${ROOTDISK} -) +# If no zoneinfo on the installfs, give them a second chance +if [ ! -e /usr/share/zoneinfo ]; then + get_timezone +fi +if [ ! -e /mnt/usr/share/zoneinfo ]; then + echo "Cannot install timezone link..." +else + echo -n "Installing timezone link..." + rm -f /mnt/etc/localtime + ln -s /usr/share/zoneinfo/$TZ /mnt/etc/localtime + echo "done." +fi + + +md_copy_kernel + +md_installboot ${ROOTDISK} + +if [ ! -x /mnt/dev/MAKEDEV ]; then + echo "No /dev/MAKEDEV installed, something is wrong here..." + exit +fi + +echo -n "Making all devices..." +#pid=`twiddle` +cd /mnt/dev +sh MAKEDEV all +#kill $pid +echo "done." +cd / unmount_fs /tmp/fstab.shadow diff --git a/distrib/hp300/ramdisk/install.sub b/distrib/hp300/ramdisk/install.sub index 2772d5ca432..cbb4411ed73 100644 --- a/distrib/hp300/ramdisk/install.sub +++ b/distrib/hp300/ramdisk/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.5 1997/10/01 22:16:10 deraadt Exp $ +# $OpenBSD: install.sub,v 1.6 1997/10/13 07:47:23 downsj Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -40,13 +40,16 @@ # OpenBSD installation/upgrade script - common subroutines. ROOTDISK="" # filled in below -VERSION=2.2 # filled in automatically (see list) -export VERSION - -ALLSETS="base comp etc games man misc text" # default install sets -UPGRSETS="base comp games man misc text" # default upgrade sets -SNAPSETS="bin dev etc sbin usr.bin usr.games usr.include usr.lib usr.libexec usr.misc usr.sbin usr.share var" # default snapshot tarfiles -KERNSETS="bsd-gen bsd-dl" # kernel sets +VERSION=2.2 +VERSION_MAJOR=$(( $VERSION / 10 )) +VERSION_MINOR=$(( $VERSION % 10 )) +export VERSION VERSION_MAJOR VERSION_MINOR + +ALLSETS="base etc misc comp text man game" # default install sets +UPGRSETS="base misc comp text man game" # default upgrade sets +SNAPSETS="bin dev etc games man misc sbin text \ + usr.bin usr.binutils usr.games usr.include \ + usr.lib usr.libexec usr.misc usr.sbin usr.share var" THESETS= # one of the above local_sets_dir="" # Path searched for sets by install_sets @@ -59,17 +62,37 @@ if [ X$EDITOR = X ]; then else EDITOR=ed fi + export EDITOR fi +# Please don't use the 1 of n form below, good idea, wrong implementation! +# get a reponse with default[s] getresp() { - read resp - if [ "X$resp" = "X" ]; then - resp=$1 - fi + valid="false" + while [ "X$valid" = "Xfalse" ]; do + read resp + if [ "X$resp" = "X" ]; then + resp=$1 + fi + if [ $# -gt 1 ]; then + for i in $@; do + if [ "X$resp" = "X$i" ]; then + valid="true" + fi + done + else + valid="true" + fi + if [ "X$valid" = "Xfalse" ]; then + echo "Try again: Enter one of [$@]" + fi + done } isin() { # test the first argument against the remaining ones, return succes on a match + local _a + _a=$1; shift while [ $# != 0 ]; do if [ "$_a" = "$1" ]; then return 0; fi @@ -157,21 +180,75 @@ dir_has_sets() { _dir=$1; shift for _file in $* do - if [ -f $_dir/${_file}.tar.gz ]; then + if [ -f $_dir/${_file}${VERSION}.tar.gz ]; then + return 0 + fi + # Try for stupid msdos convention + if [ -f $_dir/${_file}${VERSION}.tgz ]; then + return 0 + fi + # Special check for kernel + if [ $_file = "kernel" -a -f $_dir/bsd ]; then + return 0 + fi + done + return 1 +} + +list_has_sets() { + # return true when the list $1 contains a set, given dir $2 for $3...$n + local _list + local _file + + _list=$1; shift + for _file in $* + do + if isin ${_file}${VERSION}.tar.gz $_list; then return 0 fi # Try for stupid msdos convention - if [ -f $_dir/${_file}.tgz ]; then + if isin ${_file}${VERSION}.tgz $_list; then return 0 fi - # Kernel sets... - if [ -f $_dir/${_file}.gz ]; then + # Special check for kernel + if test $_file = "kernel" && isin bsd $_list; then return 0 fi done return 1 } +ftp_list_files() { + # log in via ftp to host $1 as user $2 with password $3 + # and return a list of all files in the directory $4 on stdout + local _host + local _user + local _pass + local _dir + + _host=$1; shift + _user=$1; shift + _pass=$1; shift + _dir=$1; shift + + ftp -V -n $_host <<__ptf +user $_user $_pass +cd $_dir +ls +quit +__ptf +} + +twiddle() { +# spin the propeller so we don't get bored + while : ; do + sleep 1; echo -n "/"; + sleep 1; echo -n "-"; + sleep 1; echo -n "\\"; + sleep 1; echo -n "|"; + done > /dev/tty & echo $! +} + get_localdir() { # $1 is relative mountpoint local _mp @@ -352,6 +429,7 @@ configure_ifs() { local _interface_mask local _interface_symname local _interface_extra + local _hostname _interface_name=$1 @@ -377,10 +455,11 @@ configure_ifs() { done # Get symbolic name + _hostname=`hostname` resp="" # force one iteration while [ "X${resp}" = X"" ]; do - echo -n "Symbolic (host) name? " - getresp "" + echo -n "Symbolic (host) name? [$_hostname] " + getresp "$_hostname" _interface_symname=$resp done @@ -394,7 +473,11 @@ configure_ifs() { echo "Your network interface might require additional link-layer" echo "directives (like \`link0'). If this is the case you can enter" - echo "these at the next prompt." + echo "these at the next prompt. Values used by some drivers are:" + echo " -link0 BNC" + echo " link0 -link1 AUI" + echo " link0 link1 UTP" + echo "But please keep in mind not all drivers use flags like this." echo "" echo -n "Additional link-layer arguments? [$_interface_extra] " getresp "$_interface_extra" @@ -414,7 +497,7 @@ configure_ifs() { ${_interface_name} \ ${_interface_symname} \ ${_interface_ip} \ - ${_interface_mask} ${_interface_extra} + ${_interface_mask} "${_interface_extra}" return 0 fi else @@ -424,7 +507,7 @@ configure_ifs() { ${_interface_name} \ ${_interface_symname} \ ${_interface_ip} \ - ${_interface_mask} ${_interface_extra} + ${_interface_mask} "${_interface_extra}" fi return 1 } @@ -499,11 +582,11 @@ enable_network() { echo "" if [ "X${_resolver_enabled}" = X"TRUE" ]; then - netstat -r + route show echo "" echo "Resolver enabled." else - netstat -rn + route -n show echo "" echo "Resolver not enabled." fi @@ -511,178 +594,377 @@ enable_network() { return 0 } -install_ftp() { - # Get several parameters from the user, and create - # a shell script that directs the appropriate - # commands into ftp. - cat << \__install_ftp_1 +install_url() { + # Get several parameters from the user, and xfer + # files from the server. + # Note: _ftp_server_ip, _ftp_server_dir, _ftp_server_login, + # _ftp_server_password, and _ftp_passive must be global. + + local _sets + local _f + local _file_list + local _get_files + local _failed_files + local _osetsdone + local _url_type + + # Is this an ftp or http install? + _url_type=$1; shift + + echo "\nThis is an automated ${_url_type}-based installation process.\n"\ +"You will be asked several questions and then the\n"\ +"files will be retrieved iteratively via ftp(1).\n" + + # Proxy the connections? + if [ "X${_proxy_host}" = X"" ]; then + _proxy_host=none + fi + echo -n "http/ftp proxy URL? [${_proxy_host}] " + getresp "${_proxy_host}" + if [ "X${resp}" = X"none" ]; then + unset _proxy_host ftp_proxy http_proxy + else + _proxy_host=$resp + export ftp_proxy=${_proxy_host} + export http_proxy=${_proxy_host} + fi + if [ "${_url_type}" = "ftp" -a "X$ftp_proxy" = "X" ]; then + # Use passive mode ftp? (incompatible with proxy) + case "${_ftp_passive}" in + -p) resp=y ;; + *) resp=n ;; + esac + echo -n "Do you want to use passive ftp? [${resp}] " + getresp "${resp}" + case "$resp" in + y*|Y*) _ftp_passive=-p ;; + *) unset _ftp_passive ;; + esac + fi -This is an automated ftp-based installation process. You will be asked -several questions. The correct set of commands will be placed in a script -that will be fed to ftp(1). + # Provide a list of possible servers + echo -n "Do you want a list of potential ${_url_type} servers? [y] " + getresp "y" + case "$resp" in + n*|N*) ;; + *) + ftp ${_ftp_passive} -V -a ftp://ftp.usa.openbsd.org/pub/OpenBSD/${VERSION_MAJOR}.${VERSION_MINOR}/ftplist | grep "^${_url_type}:" + ;; + esac -__install_ftp_1 # Get server IP address resp="" # force one iteration while [ "X${resp}" = X"" ]; do - echo -n "Server IP? [${_ftp_server_ip}] " - getresp "${_ftp_server_ip}" - _ftp_server_ip=$resp + eval echo -n "Server IP? [\$_${_url_type}_server_ip]\ " + eval getresp "\$_${_url_type}_server_ip" + eval _${_url_type}_server_ip=$resp done # Get server directory + if [ "${_url_type}" = "ftp" -a "X${_ftp_server_dir}" = X"" ]; then + # Default ftp dir + _ftp_server_dir="pub/OpenBSD/${VERSION_MAJOR}.${VERSION_MINOR}/${ARCH}" + fi resp="" # force one iteration while [ "X${resp}" = X"" ]; do - echo -n "Server directory? [${_ftp_server_dir}] " - getresp "${_ftp_server_dir}" - _ftp_server_dir=$resp - done - - # Get login name - resp="" # force one iteration - while [ "X${resp}" = X"" ]; do - echo -n "Login? [${_ftp_server_login}] " - getresp "${_ftp_server_login}" - _ftp_server_login=$resp - done - - # Get password - resp="" # force one iteration - while [ "X${resp}" = X"" ]; do - echo -n "Password? [${_ftp_server_password}] " - getresp "${_ftp_server_password}" - _ftp_server_password=$resp + eval echo -n "Server directory? [\$_${_url_type}_server_dir]\ " + eval getresp "\$_${_url_type}_server_dir" + eval _${_url_type}_server_dir=$resp done - # Get list of files for mget. - cat << \__install_ftp_2 - -You will now be asked for files to extract. Enter one file at a time. -When you are done entering files, enter 'done'. - -__install_ftp_2 - echo "#!/bin/sh" > /tmp/ftp-script.sh - echo "cd /mnt" >> /tmp/ftp-script.sh - echo "ftp -i -n $_ftp_server_ip << \__end_commands" >> \ - /tmp/ftp-script.sh - echo "user $_ftp_server_login $_ftp_server_password" >> \ - /tmp/ftp-script.sh - echo "bin" >> /tmp/ftp-script.sh - echo "cd $_ftp_server_dir" >> /tmp/ftp-script.sh - - resp="" # force one interation - while [ "X${resp}" != X"done" ]; do - echo -n "File? [done] " - getresp "done" - if [ "X${resp}" = X"done" ]; then - break + if [ "${_url_type}" = "ftp" ]; then + # Need default values even if we proxy ftp... + if [ "X${_ftp_server_login}" = X"" ]; then + _ftp_server_login=anonymous + fi + if [ "X${_ftp_server_password}" = X"" ]; then + _ftp_server_password=root@`hostname`.${FQDN} fi - _ftp_file=`echo ${resp} | cutword 1'` - echo "get ${_ftp_file} |\"pax -r -z -v\"" >> \ - /tmp/ftp-script.sh - done - - echo "quit" >> /tmp/ftp-script.sh - echo "__end_commands" >> /tmp/ftp-script.sh - - sh /tmp/ftp-script.sh - rm -f /tmp/ftp-script.sh - echo "Extraction complete." -} + if [ "X${ftp_proxy}" = X"" ]; then + # Get login name + resp="" # force one iteration + while [ "X${resp}" = X"" ]; do + echo -n "Login? [${_ftp_server_login}] " + getresp "${_ftp_server_login}" + _ftp_server_login=$resp + done -install_from_mounted_fs() { - # $1 - directory containing installation sets + # Get password + resp="" # force one iteration + while [ "X${resp}" = X"" ]; do + echo -n "Password? [${_ftp_server_password}] " + getresp "${_ftp_server_password}" + _ftp_server_password=$resp + done + fi + fi - local _filename - local _sets - local _next - local _f + # Get list of files from the server. + # XXX - check for nil $_file_list and deal + if [ "${_url_type}" = "ftp" -a "X${ftp_proxy}" = X"" ]; then + _file_list=`ftp_list_files "$_ftp_server_ip" "$_ftp_server_login" "$_ftp_server_password" "$_ftp_server_dir"` + else + # Assumes index file is "index.txt" for http (or proxy) + # We can't use index.html since the format is server-dependent + _file_list=`eval ftp -V ${_url_type}://\\$_${_url_type}_server_ip/\\$_${_url_type}_server_dir/index.txt | sed 's/
//'` + fi _sets="" - _ksets="" - if dir_has_sets $1 $THESETS; then + if list_has_sets "$_file_list" $THESETS; then for _f in $THESETS ; do - if [ -f $1/${_f}.tar.gz ]; then - _sets="$_sets ${_f}.tar.gz" - elif [ -f $1/${_f}.tgz ]; then - _sets="$_sets ${_f}.tgz" - elif [ -f $1/${_f}.gz ]; then - _ksets="$_ksets ${_f}.gz" + if [ "X${_f}" = "Xkernel" ]; then + if isin bsd $_file_list; then + _kernel=bsd + fi + elif isin ${_f}${VERSION}.tar.gz $_file_list; then + _sets="$_sets ${_f}${VERSION}.tar.gz" + elif isin ${_f}${VERSION}.tgz $_file_list; then + _sets="$_sets ${_f}${VERSION}.tgz" fi done else - echo "There are no OpenBSD install sets available in \"$1\"" - return + eval echo "There are no OpenBSD install sets available in \"\$_${_url_type}_server_dir\"." + echo -n "Search for *.tar.gz and *.tgz files? [y] " + getresp "y" + case "$resp" in + n*|N*) return ;; + *) ;; + esac + # *.tar.gz and *.tgz are possible sets + _sets="" + _kernel="" + for _f in ${_file_list} ; do + case "$_f" in + *.tar.gz|*.tgz) _sets="$_sets ${_f}" + esac + done + if [ "X${_sets}" = X"" ]; then + echo "There are no *.tar.gz or *.tgz files in that dir." + echo -n "See a directory listing? [y] " + getresp "y" + case "$resp" in + n*|N*) return ;; + *) ;; + esac + echo "" + echo "${_file_list}" + echo "" + return + else + echo "Adding *.tar.gz and *.tgz files to selector." + fi fi + # Yes, all those blackslashes really are necesary... + eval echo "\\\\n"\ +"You will now be asked for files to extract. In addition to the\\\\n"\ +"files listed in the selector you may enter any file located at\\\\n"\ +"\$_${_url_type}_server_ip:\$_${_url_type}_server_dir. You can also enter\\\\n"\ +"'all' to install all the standard sets, or 'list' to list the\\\\n"\ +"files avilable at \$_${_url_type}_server_ip:\$_${_url_type}_server_dir.\\\\n"\ +"When you are done selecting files, enter 'done'.\\\\n"\ +"Some of these sets are required for your ${MODE} and some are optional.\\\\n"\ +"Consult the intallation notes if you are not sure which sets are required!\\\\n" + + _osetsdone="$_setsdone" while : ; do - echo "The following sets are available for extraction:" - echo "(marked sets have already been extracted)" + echo "" + echo "The following sets are available for extraction." + echo "Enter filename, \`list', \`all', or \`done'." echo "" _next="" - for _f in $_sets ; do - if isin $_f $_setsdone; then + for _f in $_sets $_kernel ; do + if isin $_f $_setsdone ; then echo -n "[X] " _next="" else echo -n " " - if [ -z "$_next" ]; then _next=$_f; fi + if [ -z "$_next" ]; then + _next=$_f + fi fi echo $_f done echo "" # Get the name of the file. - if [ "X$_next" = "X" ]; then resp=n; else resp=y; fi - echo -n "Continue extraction [$resp]?" - getresp "$resp" - if [ "$resp" = "n" ]; then - break - fi - echo -n "File name [$_next]? " getresp "$_next" + if [ "X${resp}" = X"done" ]; then + break + elif [ "X${resp}" = X"list" ]; then + echo "" + eval echo "\$_${_url_type}_server_dir:" + echo "${_file_list}" + continue + elif [ "X${resp}" = X"all" ]; then + # XXX - setting _setsdone like this + # is not entirely correct. + _get_files="$_sets $_kernel" + _setsdone="$_sets $_kernel" + break + fi _f=$resp - _filename="/$1/$_f" # Ensure file exists - if [ ! -f $_filename ]; then - echo "File $_filename does not exist. Check to make" + if ! isin $_f $_file_list ; then + eval echo "File \$_${_url_type}_server_dir/$_f does not exist. Check to make" echo "sure you entered the information properly." continue fi - # Extract file - cat $_filename | (cd /mnt; pax -r -pe -z) - echo "Extraction complete." + # Add file to extraction list + _get_files="${_get_files} $_f" _setsdone="$_f $_setsdone" + done + + # User may have said "done" without selecting any files + if [ "X${_get_files}" = X"" ]; then + return + fi + + echo "" + echo "Fetching files via ${_url_type} may take a long time," + echo "especially over a slow network connection." + echo -n "Ready to download files? [y] " + getresp "y" + case "$resp" in + y*|Y*) + ;; + *) + _setsdone="$_osetsdone" + return + ;; + esac + + # Download the files one at a time and keep track of which ones failed + while test -n "${_get_files}" ; do + _failed_files="" + for _f in $_get_files ; do + echo "" + if [ "X${_f}" = "X${_kernel}" ]; then + if [ "${_url_type}" = "ftp" -a "X${ftp_proxy}" = X"" ]; then + ( cd /mnt ; ftp ${_ftp_passive} -V ftp://${_ftp_server_login}:${_ftp_server_password}@${_ftp_server_ip}/${_ftp_server_dir}/${_f} ) + else + ( cd /mnt ; eval ftp -V ${_url_type}://\$_${_url_type}_server_ip/\$_${_url_type}_server_dir/${_f} ) + fi + else + if [ "${_url_type}" = "ftp" -a "X${ftp_proxy}" = X"" ]; then + ( cd /mnt ; ftp ${_ftp_passive} -V ftp://${_ftp_server_login}:${_ftp_server_password}@${_ftp_server_ip}/${_ftp_server_dir}/${_f} | tar zxvpf - ) + else + ( cd /mnt ; eval ftp -V ${_url_type}://\$_${_url_type}_server_ip/\$_${_url_type}_server_dir/${_f} | tar zxvpf - ) + fi + fi + if [ $? -ne 0 ]; then + # Mark xfer as having failed,. + _setsdone=`rmel $_f $_setsdone` + _failed_files="${_failed_files} ${_f}" + fi + done + + # Give them the option of refetching failed files. + _get_files="" + while test -n "${_failed_files}" ; do + echo "" + echo "The following files failed to transfer and extract correctly:" + echo "Choose which one(s) to refetch or 'done' to exit selector." + echo "" + + _next="" + for _f in $_failed_files ; do + if isin $_f $_setsdone ; then + echo -n "[X] " + _next="" + else + echo -n " " + if [ -z "$_next" ]; then + _next=$_f + fi + fi + echo $_f + done + echo "" + + # Get the name of the file. + echo -n "File name [$_next]? " + getresp "$_next" + if [ "X${resp}" = X"done" ]; then + break + elif [ "X${resp}" = X"list" ]; then + echo "" + eval echo "\$_${_url_type}_server_dir:" + echo "${_file_list}" + echo "" + continue + fi + _f=$resp + # Ensure file exists + if ! isin $_f $_file_list ; then + eval echo "File \$_${_url_type}_server_dir/$_f does not exist. Check to make" + echo "sure you entered the information properly." continue + fi + # Add file to extraction list + _get_files="${_get_files} ${_f}" + _setsdone="${_f} ${_setsdone}" + done done +} + +install_from_mounted_fs() { + # $1 - directory containing installation sets + local _filename + local _sets + local _next + local _f + local _kernel + + _sets="" + if dir_has_sets $1 $THESETS; then + for _f in $THESETS ; do + if [ "X${_f}" = "Xkernel" ]; then + if [ -f $1/bsd ]; then + _kernel=bsd + fi + elif [ -f $1/${_f}${VERSION}.tar.gz ]; then + _sets="$_sets ${_f}${VERSION}.tar.gz" + elif [ -f $1/${_f}${VERSION}.tgz ]; then + _sets="$_sets ${_f}${VERSION}.tgz" + fi + done + else + echo "There are no OpenBSD install sets available in \"$1\"" + return + fi while : ; do - echo "The following kernel sets are available for extraction:" - echo "NOTE: Only one kernel set should be extracted. The" - echo "final one extracted will be the booted kernel." + echo "The following sets are available for extraction:" echo "(marked sets have already been extracted)" echo "" _next="" - for _f in $_ksets ; do + for _f in $_sets $_kernel ; do if isin $_f $_setsdone; then echo -n "[X] " _next="" else echo -n " " - if [ -z "$_next" ]; then _next=$_f; fi + if [ -z "$_next" ]; then + _next=$_f + fi fi echo $_f done echo "" # Get the name of the file. - if [ "X$_next" = "X" ]; then resp=n; else resp=y; fi + if [ "X$_next" = "X" ]; then + resp=n + else + resp=y + fi echo -n "Continue extraction [$resp]?" getresp "$resp" if [ "$resp" = "n" ]; then @@ -702,8 +984,11 @@ install_from_mounted_fs() { fi # Extract file - gzip -d < $_filename > /mnt/bsd - chmod 755 /mnt/bsd + if [ X$_f = X$_kernel ]; then + cp $_filename /mnt/$_f + else + cat $_filename | (cd /mnt; tar -zxvpf -) + fi echo "Extraction complete." _setsdone="$_f $_setsdone" @@ -790,13 +1075,16 @@ __install_cdrom_2 done # Mount the CD-ROM - if ! mount -t ${_filesystem} -o ro \ + if ! mount -t ${_fstype} -o ro \ /dev/${_drive}${_partition} /mnt2 ; then echo "Cannot mount CD-ROM drive. Aborting." return fi # Get the directory where the file lives + if [ "X${_directory}" = X"" ]; then + _directory="/${VERSION_MAJOR}.${VERSION_MINOR}/${ARCH}" + fi resp="" # force one iteration while [ "X${resp}" = X"" ]; do echo "Enter the directory relative to the mount point that" @@ -815,6 +1103,7 @@ mount_a_disk() { # returns 0 on failure. local _drive + local _def_partition local _partition_range local _partition local _fstype @@ -843,11 +1132,34 @@ mount_a_disk() { esac # Get partition - _partition_range=`md_get_partition_range` + cat <<__mount_a_disk_1 + +The following partitions have been found on $_drive: + +__mount_a_disk_1 + disklabel $_drive 2>/dev/null | grep '^ .:' + echo + _likely_partition_range=`disklabel $_drive 2>/dev/null | \ + sed -n -e '/swap/s/.*//' -e '/unused/s/.*//' \ + -e '/^ .:/{s/^ \(.\).*/\1/;H;}' \ + -e '${g;s/\n//g;s/^/[/;s/$/]/p;}'` + _partition_range=`disklabel $_drive 2>/dev/null | \ + sed -n -e '/^ .:/{s/^ \(.\).*/\1/;H;}' \ + -e '${g;s/\n//g;s/^/[/;s/$/]/p;}'` + _def_partition=`echo $_likely_partition_range | \ + sed -n 's/^\[\(.\).*\]/\1/p'` + if [ -z "$_def_partition" ]; then + _def_partition=`echo $_partition_range | \ + sed -n 's/^\[\(.\).*\]/\1/p'` + if [ -z "$_def_partition" ]; then + echo "There are no usable partitions on that disk" + return 0 + fi + fi resp="" # force one iteration while [ "X${resp}" = X"" ]; do - echo -n "Partition? [d] " - getresp "d" + echo -n "Partition? [$_def_partition] " + getresp "$_def_partition" case "$resp" in $_partition_range) _partition=$resp @@ -864,26 +1176,31 @@ mount_a_disk() { cat << \__mount_a_disk_2 The following filesystem types are supported: - 1) ffs + 1) default (deduced from the disklabel) + 2) ffs __mount_a_disk_2 _md_fstype=`md_native_fstype` _md_fsopts=`md_native_fsopts` if [ ! -z "$_md_fstype" ]; then - echo " 2) $_md_fstype" + echo " 3) $_md_fstype" else _md_fstype="_undefined_" fi resp="" # force one iteration while [ "X${resp}" = X"" ]; do - echo -n "Which filesystem type? [ffs] " - getresp "ffs" + echo -n "Which filesystem type? [default] " + getresp "default" case "$resp" in + default) + _fstype="" + _fsopts="ro" + ;; ffs) - _fstype=$resp + _fstype="-t $resp" _fsopts="ro" ;; $_md_fstype) - _fstype=$resp + _fstype="-t $resp" _fsopts=$_md_fsopts ;; *) @@ -894,8 +1211,7 @@ __mount_a_disk_2 done # Mount the disk - if ! mount -t ${_fstype} -o $_fsopts \ - /dev/${_drive}${_partition} /mnt2 ; then + if ! mount $_fstype -o $_fsopts /dev/${_drive}${_partition} /mnt2; then echo "Cannot mount disk. Aborting." return 0 fi @@ -1059,11 +1375,11 @@ __install_tape_2 getresp "1" case "$resp" in 1) - _xcmd="pax -r -pe -z" + _xcmd="tar -zxvpf -" ;; 2) - _xcmd="pax -r -pe" + _xcmd="tar -xvpf -" ;; *) @@ -1110,7 +1426,7 @@ __get_timezone_1 TZ=`ls -l /mnt/etc/localtime 2>/dev/null | cutlast` TZ=${TZ#/usr/share/zoneinfo/} fi - while :; do + while : ; do echo -n "What timezone are you in [\`?' for list] [$TZ]? " getresp "$TZ" case "$resp" in @@ -1141,7 +1457,7 @@ __get_timezone_1 if [ -f ${_zonepath}/usr/share/zoneinfo/$_a ]; then TZ="$_a" echo "You have selected timezone \"$_a\"". - break 2 + return fi echo "'/usr/share/zoneinfo/$_a' is not a valid timezone on this system." ;; @@ -1158,8 +1474,12 @@ install_sets() cat << \__install_sets_1 It is now time to extract the installation sets onto the hard disk. -Make sure the sets are either on a local device (i.e. tape, CD-ROM) or on a -network server. +Make sure the sets are either on a local device (i.e. tape, CD-ROM) +or on a network server. + +You will have the chance to repeat this step or to extract sets from +several places, so you don't have to try to load all the sets in one +try and can recover from some errors. __install_sets_1 @@ -1176,24 +1496,33 @@ __install_sets_1 # If _yup is not FALSE, it means that we extracted sets above. # If that's the case, bypass the menu the first time. if [ X"$_yup" = X"FALSE" ]; then - echo -n "Install from (f)tp, (t)ape, (C)D-ROM, (N)FS" - echo -n " or local (d)isk? " + echo -n "Install from (f)tp, h(ttp), (t)ape, (C)D-ROM," + echo -n "(N)FS or local (d)isk? " getresp "" case "$resp" in d*|D*) install_disk + resp=d ;; f*|F*) - install_ftp + install_url ftp + resp=f + ;; + h*|H*) + install_url http + resp=h ;; t*|T*) install_tape + resp=t ;; c*|C*) install_cdrom + resp=c ;; n*|N*) install_nfs + resp=n ;; *) echo "Invalid response: $resp" @@ -1298,16 +1627,16 @@ __mount_filesystems_1 unmount_fs() { # Unmount all filesystems and check their integrity. - # Usage: [-fast] <fstab file> - local _fast + # Usage: [-check] <fstab file> + local _check local _fstab local _pid - if [ "$1" = "-fast" ]; then - _fast=1 + if [ "$1" = "-check" ]; then + _check=1 _fstab=$2 else - _fast=0 + _check=0 _fstab=$1 fi @@ -1316,12 +1645,6 @@ unmount_fs() return fi - if [ $_fast = 0 ]; then - echo -n "Syncing disks..." - sync; sync; sync; sync - echo "done." - fi - ( _devs="" _mps="" @@ -1338,14 +1661,13 @@ unmount_fs() done echo "Done." - if [ $_fast = 0 ]; then - exit + if [ $_check = 1 ]; then + echo "Checking filesystem integrity..." + for _dev in ${_devs}; do + echo "${_dev}" + fsck -f ${_dev} + done fi - echo "Checking filesystem integrity..." - for _dev in ${_devs}; do - echo "${_dev}" - fsck -f ${_dev} - done echo "Done." ) < $_fstab } diff --git a/distrib/hp300/ramdisk/list b/distrib/hp300/ramdisk/list index e1e04b8d8e1..c7b416ffc3e 100644 --- a/distrib/hp300/ramdisk/list +++ b/distrib/hp300/ramdisk/list @@ -1,4 +1,4 @@ -# $OpenBSD: list,v 1.5 1997/04/30 07:59:15 downsj Exp $ +# $OpenBSD: list,v 1.6 1997/10/13 07:47:23 downsj Exp $ COPY ${OBJDIR}/raminst raminst LINK raminst bin/cat @@ -59,7 +59,6 @@ LINK raminst usr/sbin/chat LINK raminst usr/sbin/chown LINK raminst usr/sbin/pppd LINK raminst usr/bin/vi -LINK raminst usr/bin/vim SPECIAL /bin/rm raminst # copy the MAKEDEV script and make some devices diff --git a/distrib/hp300/ramdisk/raminst.conf b/distrib/hp300/ramdisk/raminst.conf index 7176457008a..31d58e06a3c 100644 --- a/distrib/hp300/ramdisk/raminst.conf +++ b/distrib/hp300/ramdisk/raminst.conf @@ -1,20 +1,19 @@ # -# $OpenBSD: raminst.conf,v 1.3 1997/04/21 07:32:13 downsj Exp $ -# $NetBSD: raminst.conf,v 1.3 1995/09/30 20:00:47 briggs Exp $ +# $OpenBSD: raminst.conf,v 1.4 1997/10/13 07:47:24 downsj Exp $ # -# ram.conf - unified binary for the RAM disk +# raminst.conf - unified binary for the RAM disk # srcdirs bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin usr.sbin/pppd +srcdirs usr.bin/vi progs awk cat chat chmod chown chroot cp cut dd df disklabel ed expr fsck_ffs progs ftp grep gzip hostname ifconfig init kill less ln ls mkdir mknod mount progs mount_cd9660 mount_ffs mount_kernfs mount_nfs -progs mv newfs pax pdksh ping pppd pwd reboot rm route +progs mv newfs pax pdksh ping pppd pwd reboot rm route build progs sed shutdown slattach sleep sort strings stty sync test tip umount -progs restore vim +progs restore -ln vim vi ln pax tar ln chown chgrp ln fsck_ffs fsck @@ -26,5 +25,6 @@ ln newfs mount_mfs ln grep egrep ln reboot halt ln less more +ln build vi -libs -ledit -lutil -ltermcap -lcompat -ll -lm +libs -ledit -lutil -lcurses -lcompat -ll -lm -ltermlib |