summaryrefslogtreecommitdiff
path: root/distrib/miniroot/upgrade.sh
AgeCommit message (Collapse)Author
2012-04-21remove the "Do you want to do any manual network configuration?" question.Henning Brauer
there is barely ever a need to do so these days, I for one don't remember ever using it, and we have a well documented way of escaping to a shell at any point in the install process, which the installer conveniently points out right at the beginning. stumbled upon while reviewing the upcoming 2nd edition of Michael Lucas' "Absolute OpenBSD" ok sthen deraadt halex krw
2011-07-06Remove the verbiage about manually merging 'etc' on upgrade. You getAntoine Jacoutot
the sysmerge(8) question now which makes it pretty obvious. ok krw@
2010-01-10remove and move some chatty byte during upgrade startup; ok krw, idea from ↵Theo de Raadt
mcbride
2009-05-06Split the collection of many questions from the appplication of theirTheo de Raadt
change. Then ask them at the start. The timezone stuff remains a bit weird since we have to depend on when we get the TZ names, or when we get network... so there are 3 possible places that question can be asked. But now basically once it starts ftp'ing the sets, you only have the final done prompt.
2009-04-25Cleanup. Some ksh'ing, shrinkage, verbiage tweaks and consistency.Kenneth R Westerback
2009-04-25During upgrades don't bother displaying the fstab to be 'munged'Kenneth R Westerback
and a long explanation of what is about to happen. Unlikely this was read by or helped many. Fewer distractions make better users.
2009-04-25Always configure the network (if any) during upgrades. Another questionKenneth R Westerback
bites the dust. ok deraadt@
2008-06-27Remove clauses 3 and 4 from license copyrighted by millert, deraadt,Ray Lai
krw, and NetBSD. OK millert, krw, and deraadt
2006-08-29Handle site${VERSION}-$(hostname -s).tgz files better so that theyKenneth R Westerback
don't get in the way of noticing that all default sets are installed. Restores the desired behaviour where [done] becomes the default answer to the "Location of sets?" question once all default sets are successfully installed. spotted by & ok deraadt@
2006-06-23Add a set siteXY-<hostname>.tgz and make it selected by default. ThisKenneth R Westerback
allows host specific files to be trivially installed and makes creating/maintaining large numbers of host specific configurations much simpler. Suggested by work being done by Alex Holst, brought to my attention by mk@ during c2k6. Name format suggested by henning@, tweaked by deraadt@.
2005-10-12Comments are now allowed in myname and mygate. Steal stripcom() fromKenneth R Westerback
/etc/netstart and use in myname and mygate processing. Fixes problems with (U)pgrade's. Discovered while preparing for Todd's new mygate functionality. ok todd@
2005-04-02Scrounge a few characters of whitespace.Kenneth R Westerback
2005-03-26More cleanup. ${MODE} -> $MODE.Kenneth R Westerback
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-04-06Remove the 3.3 -> 3.4 upgrade openssl hack.Kenneth R Westerback
2004-03-23Update copyrights to 2004.Kenneth R Westerback
ok deraadt@.
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-09-09do not defer * matching; from drahn, with some input from meTheo de Raadt
2003-09-06Do the ssl/openssl directory/link dance in both places it could occur,Kenneth R Westerback
/usr/include and /usr/libdata/perl5/site_perl/*-openbsd. Allows both base34 and comp34 to be upgraded from a stock install. ok deraadt@.
2003-08-17With 3.4, /usr/include/ssl is a link and /usr/include/openssl is theKenneth R Westerback
directory it points to. Previously ssl was the directory and openssl the link. That change causes the upgrade of the comp34 set to fail, so manually adjust a pre-3.4 setup to the 3.4 setup before attempting to upgrade any sets. ok millert@.
2003-08-16Minor cosmetic cleanup.Kenneth R Westerback
Use '<msg>...done.' consistantly by replacing last five varient uses. Out with '<msg> ... done.', '<msg>...Done.', etc.
2003-06-23Fix comment typo in last commit.Kenneth R Westerback
2003-06-23Minor cleanups.Kenneth R Westerback
1) Don't check for the existance of /mnt/etc/hosts twice. Since we bail out at the first check the 2nd one is superfluous. 2) Shorten and clarify the upgrade network configuration logic. 3) Always ask if manual network configuration is desired when upgrading. Allows the upgrader to decline to use the existing network configuration and still have an explicit opportunity to configure the network. 4) Don't bail out if the existing network configuration fails. Instead (see 3)) offer manual network configuration and let the user decide if it is worthwhile to continue. 5) Refer to actual file that is missing when bailing out, rather than forcing user to be alert enough to prepend '/mnt'.
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-01Code consolidation. Create edit_tmp_file(), manual_net_cfg(), inet_info()Kenneth R Westerback
to abstract repeated code blocks. Current score: 3.2 install+upgrade+install.sub = 40,062 bytes -current " " " = 38,051
2002-11-10Polish wording on fstab verbiage, and swap paragraphs so the paragraphKenneth R Westerback
descibing how the fstab will be used follows immediately after the fstab listing, and the paragraph explaining about editing the fstab comes immediately before the offer to edit the fstab. Eliminate a blank line before the question as it is now tightly related to the paragraph that precedes it.
2002-11-07Treat 'bsd' like just another filename in THESETS, no more 'kernel'Kenneth R Westerback
logic. As result, MDSETS gone from everything but mac68k. MDSETS now treated as a list of complete file names to add to THESETS, allowing more MD flexibility, i.e. may or may not be .tgz files. All traces of tar.gz removed. Not used for sets since 2.7 or so. As a result of code simplification from not having to consider tar.gz, the functions get_sets(), make_lastset(), and set_not_done() are eliminated, along with the global SETS. Build THESETS and DEFAULTSETS to contain full file names. Always install sets in the order they appear in THESETS, keeping siteXX last but without needing special logic. More predictable for user if a lot of set additions and removals done before being satisfied, as the sets are now installed in the same order they appear in the selection list. Remove ability to look for non-set .tgz/.tar.gz files. The job of the install scripts is to install the standard sets in a simple and rational way. Not to install general tar balls. The user can do that post-install or simply '!' out to do it during install. On their head be it. If no sets are found in a specified source, list the filenames in THESETS to show what is being looked for.
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-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-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-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-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-06Remove obsolete upgrade hacks for XF3->XF4 and movingKenneth R Westerback
sendmail.cf to /etc/mail. ok deraadt@, millert@, todd@
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-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-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-13only fsck root once in upgrade; from krwTheo de Raadt
2002-04-09More reorganizations, fixes and shrinkage.Kenneth R Westerback
a) Make [ -z "$var" ] standard idiom, replacing many variants on [ X"$var" = X"" ]. b) Factor out three large chunks of repeated code for finding sets, getting user to select sets and then installing the sets. This creates get_sets_list(), get_get_files_list() and install_get_files_list(). c) Eliminate unneeded dir_has_sets() function. d) Indent last large functions that were not properly indented. e) Replace most if not all 'test' invocations with [], replacing a few if statements along the way. f) Use ${MODE} a lot more to make messages appear more relevant to process. g) Fix erroneous display of $local_sets_dir so the error for a non-existant dir actually displays the user input, not an empty string. h) Eliminate the 'list' option in selecting sets. It was not possible to actually select anything except what was already displayed, so bring verbiage and options into line with code. i) Replace a number of '\"' and "\'" with just plain 's or "s as appropriate. j) Replace ". " with ". ". k) Use some more "OpenBSD {$VERSION_MAJOR}.${VERSION_MINOR}" to make more messages correct and current. l) Various typos fixed. Net shrinkage approximately 2K. ok millert@ deraadt@
2002-04-05Abstract out common startup and finishing code from install.shKenneth R Westerback
and upgrade.sh, putting it into install.sub. Replace groups of echo's with here documents. Eliminate bare echo's with embedded \n's. Abstract repeated verbiage into display_* functions, also eliminating a backslash orgy when showing the ftp/http server location. This also makes the verbiage consistant across ftp, cd, etc. installs. Try hard to make file selection screen fit on one screen. Fix default in 'File name?' prompt so it contains the first non-selected set. Some minor wording adjustment, typos, etc. Net shrinkage of about 1.5K.
2002-04-02Do not copy /etc/mygate to install'ed systems if dhcp is specifiedKenneth R Westerback
for one or more network interfaces. Rework timezone logic to shrink it and make it more clear. Don't bother checking for /usr/share/zoneinfo as it is never there, just look for /mnt/usr/share/zoneinfo. Eliminate spurious early call to get_timezone() that (accidentally?) made GMT the default timezone during installs. Instead rely on the /etc/localtime that is installed from etcXX.gz. Currently this means the default timezone is the historically resonant US/Pacific. Ideas if not code details ok deraadt@ and millert@
2002-03-31naddy@ pointed out that in the two situationsKenneth R Westerback
case WORD and var=WORD Bourne and related/descendant shells such as our sh do *not* do field splitting or globbing on WORD. Thus we can eliminate a large number of unnecessary '"'s in case statements and variable assignments. This is a lightly adapted version of naddy's diff, to take account of changes in the scripts since he generated it.
2002-03-31This omnibus diff does a number of cleanups:Kenneth R Westerback
1) Move the 'executed' code at the top of install.sub to the end, so that it can successfully use .md functions. 2) Get _DKDEVS once only, and get _CDDEVS at the same time (see (1)) 3) Clean up calls to getresp so that a) no '"'s used on constants b) '"'s always used for variables c) never use {} for variables d) ensure parameter passed matches default shown in any preceeding [] 4) Try to put '"'s around directory names 5) Replace a couple of instances of using []s around a prompt comment instead of ()s 6) Reduce some code by putting $_DKDEVS inside here documents, rather than echo'ing it 7) eliminate an unused variable _directory 8) eliminate a couple of while RESP="" loops which never loop because a non-null default is provided to getresp 9) move some code into mount_a_disk to make logic clearer 10) eliminate a couple of extra blanks in prompts 11) eliminate ALLSETS and UPGRSETS by just removing 'etc' from THESETS in upgrade.sh 12) Indent a couple of smaller functions ok deraadt@
2002-03-30shrink 599 more bytes: cleanups to "case" and such; ok krwTheo de Raadt
2002-03-30Squeeze a few bytes out of the installation scripts by usingKenneth R Westerback
standard __EOT as here document delimiter. Remove unnecessary escaping of __EOT. Could be/Should be extended to .md scripts and other non-miniroot architectures. Concept approved a *long* time ago by deraadt@ and millert@ but never got out of my tree.
2002-03-26Cleanup (and shrink) ftp_list_files() in install.sub by removingKenneth R Westerback
some unneeded intermediate local variables and just using the parameters. Make upgrade fsck output for root partition consistant with later fsck output for other partitions. ok deraadt@