summaryrefslogtreecommitdiff
path: root/distrib/miniroot/install.sh
AgeCommit message (Collapse)Author
2004-11-06select dd or ed from newly installed filesystem instead, ok krwTheo de Raadt
2004-10-02Minor code cleanup and shrinkage. No functional change.Kenneth R Westerback
2004-07-30Use '#!/bin/ksh' for install scripts, as we use so many ksh'isms. Some ofKenneth R Westerback
which will be disabled for /bin/sh invocations soon. Requested by millert@. ok pval@.
2004-07-18spacesTheo de Raadt
2004-07-04Remove requirement that the 'b' partition on the root disk beKenneth R Westerback
configured during install. If it is configured it will still be unconditionally used as swap, so don't let the user set a mount point for it. Minor white space, commment and verbiage adjustments. Suggested by many including Mickey, Henning, Todd, and Theo. ok deraadt@
2004-06-26Allow change of default console to first serial device during install. Used inKenneth R Westerback
i386 only at this time. ok beck@ deraadt@
2004-05-28Add MDROOTFSOPT handling code to allow non-default newfs options toKenneth R Westerback
be specified for root filesystems. Add MDROOTFSOPT value for luna88k so installed system can boot. Tested by Kenji Ayoma. ok miod@.
2004-03-23Update copyrights to 2004.Kenneth R Westerback
ok deraadt@.
2004-03-18Don't ask for timezone info during an upgrade.Kenneth R Westerback
Suggestion by Tom Cosgrove. ok miod@ millert@ deraadt@.
2003-12-04ask if sshd should be on by default (default to yes, still); tested by nickTheo de Raadt
2003-11-03spelling fix in commentsDavid Krause
2003-09-26Fix typo: 'Which disk do you wish to initialize??' -> '... initialize?'.Kenneth R Westerback
Only appeared when non-boot disks were initialized.
2003-09-22Introduce a function ask_yn() to use when asking 'yes or no'Kenneth R Westerback
questions. ask_yn() always returns a 'y' or 'n' in $resp, vastly simplifying the logic used to check the user response. ask_yn() insists on the user responding with a 'y', 'n', 'yes', or 'no'. Case is ignored. Previously almost any input was accepted as either a yes or a no depending on the question. ask_yn() reduces the chance of user error, e.g. by answering the next question (default route) instead of the posed one (Use DNS server now?). All 'yes or no' questions now use ask_yn(). All questions show the full default answer, i.e. 'yes' or 'no' rather than 'y' or 'n'. Some minor logic cleanups of the usual sort, but no changes to logic flow or questions bar minor verbiage adjustment. Inspired by a Bob Beck install nit.
2003-08-17Message clarification & cleanup.Kenneth R Westerback
Replace the generic 'Done - no available Xs found.' message with two more relevant ones. Suggested several times, most memorably by Todd@. a) For selection of disks or cds to install from, and for selection of the root disk, make it 'No Xs found.'. b) For processing the list of disks or interfaces to initialize, make it 'No more Xs to initialize.'. Delete get_root() as it is only called in one place, and insert code at that location. Reclaim a few characters by putting ask_which() punctuation where message is output rather than repeating it where message passed.
2003-08-07spacesTheo de Raadt
2003-07-03Use numeric comparison operators when testing numeric values.Kenneth R Westerback
2003-07-02Eliminate cutword(), replacing it with specific code: 'set --' in twoKenneth R Westerback
cases and a simple sed expression in the third. Add pfsync to the list of interfaces that should not be offered to the user for configuration. Display the server line selected from the ftp/http server list in a more compact form with only a single space between fields. The usual [] -> [[]], etc. in areas being revised.
2003-06-30Cleanup ask_which() logic.Kenneth R Westerback
Use first device in supplied list as default unless overridden. Eliminates repeated 'echo XXX | cutword 1' constructs. Use 'set -- $_devs' to parse _devs and find out if there are any devices in the list. Then use '_devs="$*" to eliminate all extraneous whitespace from _devs, rather than just a single trailing blank. Usual [...] -> [[...]], `` -> $(), extra '{}' and '"' eliminations in areas being fixed up.
2003-06-27Improve swap partition handling during install/upgrade.Kenneth R Westerback
a) Add all defined swap partitions except the default partition on the root disk to the installed /etc/fstab. b) Mount all possible swap partitions just before creating all devices, giving small memory machines a better chance to successfully install/upgrade. Should obviate the need for FAQ 4.3.6. ok deraadt@ millert@ (slightly earlier version)
2003-06-02licence cleanup; agreement from krw and millertTheo de Raadt
2002-12-14Expunge some trailing whitespace.Kenneth R Westerback
From David Krause.
2002-12-08Fix botch in last commit: prepend comments to hosts after adding FQDN toKenneth R Westerback
hosts entries, so comments are not processed. Last few touchups & shrinkage for this round. Current score: install.sh+install.sub+upgrade.sh = 36,934 (vs 40,062 for 3.2).
2002-12-08Fix & cleanup logic, especially around interrupted installs.Kenneth R Westerback
Use value of 'hostname' to store all HOSTNAME and FQDN information. Elminate those global variables. For install accept user input as is, but if the short form hostname is unchanged, save any domain info by not re-setting hostname. For upgrade just set hostname from /tmp/myname. Unconditionally create default hosts file in install.sh, rather than doing it in separate places depending on whether or not the user configures the network. Always ask if the user wants to edit the hosts file when the network is configured, but without listing it out. Don't put 'search' command in resolv.conf as we now set hostnames to include fully qualified domain names, which will be used to yield local domain name. Loop asking for the default route until the user enters one that 'route' accepts or the user explicitly asks for no default route by entering 'none'. Add FQDN info to hosts file just before saving configuration files to the installed system. Preserve user added lines - those with aliases or with domain information in the hostname. Clean up donetconfig() logic. Delete network config files in install.sh so that if the user restarts an interrupted install previous network configuration does not leak into installed system. Elminiate get_resolv_fqdn(), searching resolv.conf for domain info only when dhcp was used. get_fqdn() is reduced to looking for domain info in current hostname, and supplying 'my.domain' if none found. Add save_comments() and use to preserve useful comments in the installed /etc/hosts and /etc/dhclient.conf files. Previous logic for dhclient.conf could cause repeated appending of configuration info rather than just preserving the comments. Cleanup logic copying files from /tmp to /mnt/etc, eliminating unneeded cfgfiles variable. Use wildcards and subshells to shrink code size.
2002-12-04Code cleanup & shrinkage.Kenneth R Westerback
Redo configure_ifs() to take full advantage of recent code refactoring, and cleanup code while there. Move address or dhcp question to after media option handling so that each question gives immediate feedback. i.e. if the media options given don't work then say so and exit, and if dhcp is requested immediately issue the dhcp request. Also allows some code shrinkage. Eliminate addifconfig() and remount(). The former is folded into configure_ifs() and the latter's three lines simply replace the call in install.sh. Move remount code to before any configuration files are moved to the installed system.
2002-12-03More code consolidation.Kenneth R Westerback
Create dhcp_request() and use in configure_ifs() rather than repeat code. When dhcp is successful, move /etc/dhclient.conf, /etc/resolv.conf.tail to /tmp, and use normal configuration file installation to put them on the installed system. Also apply any user specified media options immediately. If they don't compute then return immediately.
2002-11-28Use any existing hostname as the default, as the install could haveKenneth R Westerback
been restarted. Discard any domain information the user supplies.
2002-11-28spacesTheo de Raadt
2002-11-28Make questions out of requests for user input that were demands. UseKenneth R Westerback
a standard format of <question>? (<extra verbiage>) [<default value>] Makes things more consistant, and sometimes more terse.
2002-11-24use 8 rounds for passwd, like login.conf specifies; rob_ses@web.deTheo de Raadt
2002-11-01Cleanup. install_sets() no longer takes a parameter.Kenneth R Westerback
2002-10-03Divorce system hostname handling from network configuration.Kenneth R Westerback
Every system has a name, and thus generated keys with that name, even if there is no currently configured network. So, ask for a system hostname before configuring the network. Eliminate /tmp/myname and just keep hostname set to the lastest name and FQDN. Construct /etc/myname from hostname as configuration data is being saved. Construct /etc/hosts (preserving the informative leading comment from the /etc/hosts file in etcXX.tgx) at the same time. Construct an appropriate /etc/hosts file even if the network is not configured. During upgrade, if the user enables the network using the existing configuration, don't ask about the domain name - just use the configured one. Take care to handle existing /etc/myname files which do not necessarily have a FQDN. Originally problem with hostname handling pointed out by beck@. ok deraadt@
2002-09-28Cleanup/fix/improve question asking.Kenneth R Westerback
1) If the user escapes to a shell with '!' or executes a command with '!foo' at a prompt then repeat the prompt when the shell or command returns. 2) If ask_which() is passed an empty list of devices , then set resp to 'done' and return. Replaces a couple of checks before calling ask_which(). Also emit a message about the lack of devices. 3) In ask_which(), delete any trailing blank which rmel() may have appended to the device list. Replaces a check before calling ask_which(). 4) Remove an unneeded blank line before the 'invalid choice' message from ask_which(). 5) Make the first disk device the default answer when asking for which disk contains install sets. A few code/verbiage nits: 1) make _a a local in cutlast(). 2) use normal ': ${_defdev:=done}' idiom instead of an or condition in ask_which. 3) Eliminate an unnecessary blank line/paragraph by putting 3(!) sentences into a single paragraph when describing process of selecting install sets. 4) Eliminate another unnecessary blank line between the list of possible install sources and the question about which one to use. 5) Eliminate another unnecessary blank line before the 'Extract more sets?' question 6) Eliminate a double blank line after the sanity check error messages. ok deraadt@.
2002-09-25Try to minimize places where suid programs and devices can liveKenneth R Westerback
by implementing the rules: Only '/' is neither nodev nor nosuid. i.e. it can obviously *always* contain devices or setuid programs. Every other mounted filesystem is nodev. If the user chooses to mount /dev as a separate filesystem, then on the user's head be it. The only directories that install puts suid binaries into (as of 3.2) are: /sbin /usr/bin /usr/sbin /usr/libexec /usr/libexec/auth /usr/X11R6/bin and ports and users can do who knows what to /usr/local and sub directories thereof. So try to ensure that only filesystems that are mounted at or above these directories can contain suid programs. In the case of /usr/libexec, give blanket permission for subdirectories. Note that if *all* the above are split into separate filesystems the install process will attempt a couple of cross-device links when installing base32.tgz, and fail. ok deraadt@.
2002-09-24Rejig addel()/rmel() to keep items on a single line, with blanksKenneth R Westerback
separating items. This allows a compaction of the displayed lines for device selection. Customize the device selection routine so the actual device type is shown (disk or CD-ROM). Rename ask_fordev to ask_which so the invocations (with device type) read better.
2002-09-22Do not allow install to proceed until root filesystem can be mounted onKenneth R Westerback
$ROOTDEV and ${ROOTDISK}b can be used for swap. Also shortens output generated during (successful) install. Fix problem with upgrade on systems with many disk devices by automatically creating devices encountered during the fsck'ing of fstab filesystems. Problem noted by Dethlef Madsen and Nick Nauwelaerts. Adjust some verbiage in i386 install.md to make it more consistant. Reformat welcome message to make sure all lines are <80 characters wide. Minor cleanups.
2002-09-17Ruthlessly expunge unnecessary verbiage and whitespace to make sureKenneth R Westerback
the install example will easily fit on the CD insert at some reasonable font size. Reword many messages and questions for same reason. In addition: 1) Add '...done.' to match 'Installing boot block...' 2) During install, after asking which is the root disk, start initializing it immediately rather than asking again which disk to work on. 3) Move munged fstab filesystem mounting to *before* network initialization so that if you bail out during network initialization and restart you do not have to go through disk initialization again. Also puts fsck and mount messages close to each other rather than spitting out the latter just before root password questions. 4) Make 'usr/obj' nosuid,nodev by default, /home nodev by default. 5) For network interfaces only show the complete list of media options if the user indicates they want to change the default. 6) Move the question about the ftp server supporting passive ftp to *after* selecting the ftp server where it is more 'rational' and can easily be made more concise. 7) Don't bother umount'ing filesystems or stopping the dhclient after a successful install/upgrade. The next step is a reboot after all. Some minor code tweaks and comment cleanup while in the area. Tested in recent snapshots. Suggested by & ok deraadt@.
2002-08-27Move general partitioning advice from machine dependant per diskKenneth R Westerback
routine to install.sh so it is displayed only once. Strongly advise /, /tmp, /var, /usr and /home have their own disk partitions as requested by deraadt@. Rather than rely on users not re-selecting an already initialized disk, just allow them to choose from un-initialized disks. Move get_root invocation into install.sub as both install.sh and upgrade.sh did it first thing. Remove the 'workaround' to a 'vnode aliasing bug' that came in with the initial import of upgrade.sh from NetBSD. ok millert@. Rework verbiage in a few places. Clean up logic around looping through disk units by handling root disk better.
2002-08-25More fixes to mount point handling.Kenneth R Westerback
1) Correctly sort >10 total partitions. 2) Don't allow user to specify duplicate mount points via disklabel. 3) Fix mount point checking so that empty mount points do not confuse logic. 4) Fix mount point checking so that duplicate mount points from previous disk initialization are correctly detected. 5) Show configured partitions/mount points in partition order (i.e. sorted by disk and then partition) rather than mount point order. This seems easier to read to me and reflects the order of user action. Sort the entries after user approval. 6) Clarify, clean up some verbiage and logic.
2002-08-18Fix various mount point problems:Kenneth R Westerback
1) Fix 'already mounted' checking so a mount point name can be the same as the leading substring of a previously specified mount point. Now you can specify /usr after /usr/obj, and since the mount points are sorted before writing to fstab, it should work. This also fixes the error message generated when a requested mount point matches the leading substring of multiple mount points. e.g. trying to mount '/' again. 2) Fix fstab sorting so that it works across all initialized disks, not just on a disk by disk basis. 3) For additional paranoia during multiple disk installs, unset _partitions, _psizes, and _mount_points before processing a disk. Eliminate individual blanking of _mount_points entries. 4) Shorten/simplify logic by storing ${DISK} in _partitions entries rather than always adding it back in when referencing _partitions. 5) Rework verbiage a bit, eliminating the duplicate display of configured devices before making new filesystems. Some code clean up, eliminating '{}'s, better loops, ifs, etc. Appox. 67 bytes net bloat.
2002-07-31/tmp/fstab.$DISK is created in install.md, so put back referencesKenneth R Westerback
to it. Fixes mount point prompts during install. 'Improve' an error message. Noted by todd@ and jsyn@.
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-21Put a doing...done wrapper around creation of the host.random fileHugh Graham
as this takes so long inside simh that people were assuming the system had hung. Grows install.sh 66 bytes, but krw said ok anyway!
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-01Prevent passwords of the form '-X' from being (mis)interpreted as anKenneth R Westerback
option to encrypt, by terminating option list with '--'. This generated an error during install and left root with a blank password. Mentioned a couple of months ago by Adrian Close, and dhartmei@ prodded me again today.
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-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-15Insert entry for /var/tmp to /etc/fstab like /tmp one,i.e. nosuid and nodevMike Pechkin
Idea from form@. millert@, krw@ ok
2002-04-30Tighten up installed options on /tmp by adding nosuid,nodev.Kenneth R Westerback
Suggested by Ian McWilliam. ok deraadt@.