summaryrefslogtreecommitdiff
path: root/distrib/miniroot/install.sub
AgeCommit message (Collapse)Author
2002-07-28New feature request by (most recently) drahn@:Kenneth R Westerback
Do not allow the same mountpoint to be specified for >1 disk partition. If a mountpoint that has already been specified is entered again an error message of the form: Invalid response: sd0a is already being mounted at /var is emitted. Partitions on both the disk being initialized and previously initialized disks are checked. Rework a bit of the logic to simplify and shorten in compensation. e.g. eliminate references to /tmp/fstab.<disk> as it is never created.
2002-07-27Fix two problems.Kenneth R Westerback
1) Even if /sbin/mount_nfs is present, do *not* try to automatically mount nfs file systems. Because not all name resolution mechanisms are present during upgrade (e.g. yp) it is not safe to do so. The user must manually mount nfs file systems if they are the source of any sets. Problem noted by miod@, change seconded by deraadt@. 2) Change initial verbiage so that a brief introduction is displayed, along with the information about !foo or !, before the terminal type is requested. After the terminal type is known display the rest of the introductory text using less -XE. This belts and suspender fix makes both the install and upgrade text fit in 'page' size (<24 lines) chunks and ensures that if the text ever grows beyond a page a more informative prompt is displayed. Problem noted by millert@.
2002-07-22Undo a cvs botch in the last commit that reverted a few lines.Kenneth R Westerback
2002-07-18Rework upgrade's fstab handling soKenneth R Westerback
1) All filesystem with a corresponding /sbin/mount_<type> available will be mounted. i.e. don't restrict automounting to ffs filesystems when the user can later mount the others manually. 2) All non-ffs filesystems will be mounted ro, just as currently is the case for user-mounted filesystems. 3) fsck all to-be-mounted filesystems that have a corresponding /sbin/fsck_<type> program present. Some verbiage adjustment and related code cleanup as well. ok deraadt@.
2002-07-13Cleanup/Shrinkage.Kenneth R Westerback
1) Eliminate more if's in favour of 'cond || stmt' or 'cond && stmt' constructs. 2) Global _didnet -> DIDNET, make local _nam a local. 3) Display 'DHCP not supported' error every time user specifies 'dhcp' but the client is not present. 4) if if_extra is empty, that's ok, so just assign $resp to it whether $resp is empty or not. 5) Check for DIDNET inside donetconfig() instead of before each call to donetconfig. 6) Eliminate superfluous 'Aborting' comments, and let the user draw their own conclusion from getting the 'Extract more sets' message. 7) Minor code tweaks like not continually assigning $resp to a value in a loop, when all we want is the final value, and only displaying 'Skipping' message in tape installs if we are actually skipping files, etc.
2002-07-13More cleanup/simplification/shrinkage.Kenneth R Westerback
1) Factor out inquiring for a device. ask_fordev() now does this for root disk determination, other disk initialization, install sets disk or cd inquiry. Also ensures cd devices are created on the fly like disk devices already were, and shortens some verbiage. 2) Just ask for root disk if install is skipping disk initialization, rather than doing the 'df /mnt ...' scan, since 1) we just end up asking anyway and 2) everything *should* have been umount'ed when previous install was finished or interrupted. 3) getrootdisk -> get_rootdisk to conform to get_<global> naming convention. 4) Add and use new global ROOTDEV rather than constantly adding 'a' to ROOTDISK. ROOTDEV default is set in get_rootdisk(). 5) Put loop inside get_rootdisk rather than always putting one around it. If no rootdisk found/specified just exit install/update. 6) Eliminate getanotherdisk since ask_fordev() does most of the work. 7) Eliminate parameter to check_fs, just use ROOTDEV instead. 8) Some typographical and minor code tweaks.
2002-07-12Eliminate list_has_sets() by eliminating its only use. Instead ofKenneth R Westerback
checking for sets when the a valid directory is given in get_setsdir(), rely on eqivalent check in get_sets() instead. Reduces code duplication and eliminates a possible duplicated error message about not finding sets in a directory.
2002-07-12Consolidate repeated logic to get non-empty $resp into aKenneth R Westerback
function ask_until(). Eliminate some unnecessary ':' statements used to initialize variables by doing initialization in first reference - i.e. when passing the variable to ask_until(). Shrinks and clarifies.
2002-07-09Fix typo (get_sets_list -> get_sets) that caused ftp installs to fail.Kenneth R Westerback
Noticed by STeve Andre
2002-07-07More cleanup/shrinkage/clarification.Kenneth R Westerback
a) Eliminate single invocation here document functions not_going_to_install(), congrats() by putting the here document at the point of invocation. b) Make (deliberately) global variables consistantly upper case and with no leading '_'. Many variables that could be local are still creating globals. c) Make all get_* functions names conform to a convention of get_<global variable name>, where the <global_variable_name> is the global variable set by the function, or whose new value is returned by the function. d) Change _IFS to IFDEVS to be consistant with CDDEVS and DKDEVS, and initialize it at the same place. e) Handle bare '+', '-' in same place other selections are parsed rather than in a separate case statement. f) eliminate '[ "$var" ] || var=value' constructs with ': ${var:=value}' constructs. g) Rename local_sets_dir -> SETSDIR. h) Rework logic around ftp passwords to eliminate duplications and ensure a new password is asked for each time. i) Some minor cosmetic adjustments.
2002-07-06Fix typo in get_get_files_list() that prevented sets fromKenneth R Westerback
being found for install/upgrade.
2002-07-04More cleanup/shrinkage/clarification.Kenneth R Westerback
a) Abstract selection list handling into a function do_selection_list() rather than repeating the code twice. b) Eliminate function get_selection() and put limited remaining functionality directly into only caller, get_get_file_list(). c) Remove unused parameters in glob_selection() and invocations of same. d) Remove unused parameters from install_get_files_list() invocations. e) Remove unnecessary local parameter '_file_list' in install_mounted_fs().
2002-07-04Eliminate the separate display_* functions. A little moreKenneth R Westerback
consolidation reduces calls to these functions to either 0 (display_failure_msg()) or 1. Just put the here documents in place of the invocation.
2002-07-04Since the directory /var/run is now present during install/upgrade,Kenneth R Westerback
put dmesg.boot there rather than the non-normal location /tmp/dmesg.boot.
2002-07-04Fix set selection list logic so that when extracting more setsKenneth R Westerback
a) The selection list does not display default sets already transferred. b) Saying 'done' does not seem to mysteriously skip the sets erroneously shown as selected due to a). This problem was found by miod@. In the process a) Use _setsdone only to record sets that have successfully been extracted. b) Don't loop on fetching files if a transfer fails. Just let the user know, and let the normal logic offer them a chance to extract the failed sets from the same or different source. c) Eliminate some (newly) dead variables, especially the global _osetsdone.
2002-06-29Some cleanup/simplification:Kenneth R Westerback
1) Put knowledge of /tmp/fstab in munge_fstab rather than redirect input on calls. Check in munge_fstab whether /etc/fstab was successfully created, and exit install/upgrade with appropriate error if not. This error condition is therefore checked on install and upgrade. 2) Don't bother specifying value in exit statements - no one is checking whether it is 1, 2, or 0. 3) Put status messages inside check_fs rather than around invocation, and exit from check_fs if a fsck fails, rather than checking return value and exiting. 4) With above changes, simplify munge_fs/check_fs/mount_fs logic in upgrade.sh. 5) Various cosmetic cleanups.
2002-06-25Complete yet more of the c2k2 initiated changes. In this round:Kenneth R Westerback
1) Centralize selection of install/upgrade media rather than ask separately for mounted filesystem. Eliminate separate calls to get_localdir in install.sh and upgrade.sh. In install.sh this call occurred only if a diskless system was detected, which millert@ agreed was a historical relic, i.e. what exactly would a diskless workstation be installing to? 2) Check for the presence of any mounted filesystems at the expected mount point (/mnt or /mnt2) and emit an error message if none found. 3) Add a '?' option to the pathname question so you can see what filesystems are mounted at/below the expected mount point. 4) Rework logic in get_localdir to make flow more logical. e.g. only do sane_install() check after the user says to install no more sets; if sane_install() fails ask a slightly different question and make the default 'y' to install more sets. 5) Rework install_sets() to simplify logic. Don't try to tailor list of install media to system, just warn that some may not be available and emit useful error messages if the user tries a non-available source. Some verbiage still needs work (amoung other things). fgsch@ noticed problems with installing from mounted filesystems, forcing me to finish these changes.
2002-06-15rename install_from_mounted_fs to install_mounted_fs here as well; krw@ ok.Federico G. Schwindt
2002-06-11Rework get_localdir() so thatKenneth R Westerback
1) It takes two parameters, the mount point and a default directory. 2) It has one step escape ('abort') instead of asking user if they are really sure an empty pathname is what they want. Empty entry with no default value now just re-presents the prompt. More consistant with the behaviour of other prompts. 3) Provide separate error messages for non-existant directory and a directory with no sets. Rework install_mounted_fs() (renamed from install_from_mounted_fs to be consistant with install_disk, etc.) so that 1) It takes two parameters, the mount point and the default directory. 2) It calls get_localdir(), passing the parameters along. Rework install_disk(), install_cdrom() and install_nfs() to eliminate local queries for local dir and rely on get_local() via install_mounted_fs() instead. Make mount_a_disk() return 0 on success to make testing its return value more obvious. Use this in install_disk() to make logic clearer and eliminate the need for a return.
2002-06-11Delete an extraneous 'mkdir /mnt2' in install_nfs().Kenneth R Westerback
Mount NFS servers with -o ro the same as all other install sets sources. Check for /sbin/mount_nfs in install_nfs() rather before the call in install_sets(). Makes install_sets() more consistant in both code and reactions to failed attempts to find sets.
2002-06-10Be more paranoid about option fiddling in munge_fs, in case someoneKenneth R Westerback
ever adds an option with a name too similar to the name of the one being manipulated. Only softdep at the moment but some more option fiddling coming.
2002-06-10Eliminate unused _installed_via_${_url_type} variables.Kenneth R Westerback
Don't bother returning a value of 1 from installed_get_files_list() now, since it was only used to set the eliminated variables.
2002-06-10Move '[ "$_didnet" ] || donetconfig' lines into install_url andKenneth R Westerback
install_nfs rather than before function calls. Eliminates duplicate calls before install_url and now network will not be configured if install_nfs is not a valid choice.
2002-06-10Pass 'ftp' or 'http' to install_url, rather than '-ftp' or '-http' andKenneth R Westerback
just assign $1 to _url_type rather than translating -ftp to ftp and -http to http in a case statement. Smaller. Simpler. Clearer.
2002-06-09knfTodd T. Fries
2002-06-08Add FQDN to contents of /etc/myname during install.Kenneth R Westerback
Also remove a few extraneous braces. Requested by and OK'd by two different Todds.
2002-05-22Fix quoting botch in earlier commit. Make sure MDDISKDEVS andKenneth R Westerback
MDCDDEVS actually work with non-empty values as well as the supplied default this time. Problem first detected by jsyn@.
2002-05-20Eliminate md_questions(). It was used only to control the setting ofKenneth R Westerback
machdep.allowaperture. Remove the setting of machdep.allowaperture from md_installboot(). Add MDXAPERTURE variable to relevant architectures. Add a new function set_machdep_allowaperture(). It is called *after* install_sets() (which changes when the X Window question is asked), and if MDXAPERTURE is present modifies sysctl.conf. Shrinks overall size for i386, macppc, sparc64 (which used md_questions for machdep.allowaperture) but increases size a bit for other architectures since set_machep_allowaperture is in install.sub.
2002-05-20Move verbiage about '!' and '!foo' at prompts to welcome_banner() fromKenneth R Westerback
separate here document. This moves it before first questions are asked, which makes more sense. Replace 'especially on a PC' with 'especially on a machine', since it is displayed on all installs/upgrades regardless of architecture.
2002-05-18Eliminate md_get_diskdevs() and md_get_cddevs() byKenneth R Westerback
1) Saving one boot's worth of dmesg in /tmp/dmesg.boot 2) Using sed to scan for devices and pull out names in new get_diskdevs() and get_cddevs() in install.sub 3) Saving any md disk/cd sed patterns in MDDISKDEVS and MDCDDEVS variables.
2002-05-14Eliminate md_native_fstype() and md_native_fsopts(). Both functionsKenneth R Westerback
simply echo'd a single word if present at all. Replace with variables MDFSTYPE and MDFSOPTS if required. Rework logic in install.sub's mount_a_disk() to always include 'ro' as an option to the mount command. This allows even those arch's with MDFSTYPE to usually get by without MDFSOPTS. ok deraadt@
2002-05-09Elminate md_welcome_banner() and md_not_going_to_install() as theKenneth R Westerback
output of both was essentially identical on all architectures. Replace with welcome_banner() and not_going_to_install() in install.sub. Abstract common verbiage from md_congrats() into congrats() which calls md_congrats() for any architecture specific additional verbiage. Reword things so ${MODE} can be plausibly used in more places. Remove extraneous #!/bin/sh in hp300 install.md. ok deraadt@ espie@
2002-05-08Abstract out common md_set_term() code into set_term() in install.sub,Kenneth R Westerback
calling md_set_term() from set_term() to do machine dependent stuff. Currently only i386 does anything - keyboard mappings. Add MDTERM variable to allow install.md to set proper default terminal type. Default to vt220. Eliminate md_get_partition_range() as useless since every architecture returned '[a-p]'. Make default term for all mvme* architectures vt100 as requested by miod@. ok deraadt@ millert@ miod@
2002-05-04Clean up the logic in install_url():Kenneth R Westerback
a) Eliminate extraneous cat invocations that are piped to grep by simply calling grep with the file name. b) Eliminate the only use of isnumeric() by using a ksh'ism left exposed in sh: '+([0-9])'. Eliminate isnumeric(). c) Test for a http/ftp list index of '0' and treat as an out of range error rather than an IP address. d) Reorganize to make smaller and more clear. Add documentation to sh(1) for ksh patterns that are available. ok millert@, miod@
2002-04-30Clean up configure_all_interfaces() a bit.Kenneth R Westerback
Always make the default answer the first unconfigured interface, and when there are no unconfigured interfaces make the default answer 'done'. As a result _reprompt would always be set to 1, so eliminate it and the if statement testing it.
2002-04-30this is not run by hand, no need for #!/bin/sh; krw okTheo de Raadt
2002-04-29Expose a few more comments to stripping: must be on separate line, andKenneth R Westerback
must *not* start with consecutive '#'s.
2002-04-29Eliminate basename(). Just use parameter expansion syntax to removeKenneth R Westerback
everything up to and including the last '/'. Also removes a now unnecessary variable from install_tape(). Which brings up the question 'Does anyone use tape installs?'.
2002-04-29Rely on [] evaluating empty string as false, non-empty string as trueKenneth R Westerback
to eliminate a lot of -z and -n tests. Thus, '[ -z "$x" ] && cmd' -> '[ "$x" ] || cmd' 'if [ -z "$x" ]; then; y; fi' -> '[ "$x" ] || y'. '[ -n "$x" ]' -> '[ "$x" ]' Use variable default value syntax in a couple of places rather than if statements. e.g. ': ${_ouranswer:=$_ifs}'. Suggestions from millert@, aaron@, espie@, miod@ at various times.
2002-04-28Remove superfluous '{}' in variable references that are all alone in aKenneth R Westerback
string. i.e. "${a}" -> "$a". Save the {} form for strings where variables are mixed with text. Remove superfluous X's. e.g. "X$resp" = "Xdone" -> "$resp" = "done". Change last few '[ "$v" = "" ]' or equivalents to '[ -z "$v" ]'.
2002-04-28Change getresp() into ask().Kenneth R Westerback
ask() takes 2 parameters. The first one is the question to ask the user, and the 2nd is the default answer. Shrinks and makes the code clearer. From espie@ with some tweaking, ok deraadt@.
2002-04-27Fix typo ('remel' -> 'rmel') in glob_selection.Kenneth R Westerback
2002-04-26Rework glob_selection() to eliminate 'Major hack' and a 'Eww' byKenneth R Westerback
getting eval to work correctly. Some other logic cleanups in glob_selection. Eliminate 'dead' code trying to use dns to resolve ftp.openbsd.org. Not only was the code dead, $_resolver_enabled having been eliminated a while ago, but unnecessary as Theo has promised the IP address will not change. Spell 'occurrences' correctly. From espie@ with slight modifications. ok espie@ millert@
2002-04-26Change 'while $1; shift' loops to 'for _b;' loops.Kenneth R Westerback
Move more 'if [] then; x; fi' to '[] && x' or '[] || x' idioms. Remove code supporting an optional IFS parameter in cutlast(), as it was never used. Also redo logic a bit in cutlast() to use eval to better effect. Improve logic a bit in bsort. From espie@ with slight modifications. ok espie@ millert@
2002-04-26Improve use of sed in various places, eliminating unnecessaryKenneth R Westerback
calls to grep and file redirections. Eliminate function firstchar(). Rework of partition gathering code removes the only use. Remove the usual extraneous 'X's and {}'s in the code being worked on. From espie@ with slight modifications. ok espie@ millert@
2002-04-20Split out a new function askpass() and as a resultKenneth R Westerback
greatly simplify both getresp() and the code around obtaining passwords. Shrinks, simplifies and makes the code clearer. From espie@. ok deraadt@ and espie@.
2002-04-13allow todd to do very weird things at the timezone prompt; fix from krwTheo de Raadt
2002-04-13only fsck root once in upgrade; from krwTheo de Raadt
2002-04-13do not check filesystems; krw okTheo de Raadt
2002-04-10If disk device nodes are missing, and MAKEDEV can be found on the media,Theo de Raadt
use it to make 'em. Now you can install with as many disks as you want. cleanup by espie, tests by jason