Age | Commit message (Collapse) | Author |
|
From David Krause.
|
|
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).
|
|
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.
|
|
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.
|
|
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.
|
|
been restarted.
Discard any domain information the user supplies.
|
|
|
|
a standard format of
<question>? (<extra verbiage>) [<default value>]
Makes things more consistant, and sometimes more terse.
|
|
|
|
|
|
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@
|
|
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@.
|
|
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@.
|
|
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.
|
|
$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.
|
|
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@.
|
|
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.
|
|
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.
|
|
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.
|
|
to it. Fixes mount point prompts during install.
'Improve' an error message.
Noted by todd@ and jsyn@.
|
|
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.
|
|
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!
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Idea from form@.
millert@, krw@ ok
|
|
Suggested by Ian McWilliam. ok deraadt@.
|
|
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" ]'.
|
|
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@.
|
|
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@
|
|
greatly simplify both getresp() and the code around
obtaining passwords. Shrinks, simplifies and
makes the code clearer.
From espie@.
ok deraadt@ and espie@.
|
|
when people specify, e.g. /usr/local before /usr. deraadt@ OK
|
|
last minute tweaks to it by me, but you can trust me, right?
|
|
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@
|
|
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.
|
|
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@
|
|
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.
|
|
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@
|
|
|
|
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.
|
|
In particular
a) save dhclient.leases so the lease obtained during installation
is retained.
b) create /etc/resolv.conf.tail with 'lookup file bind' so that
the resolv.conf files created by dhclient have the same settings
as the default resolv.conf we install. i.e. use the /etc/hosts
file before trying bind.
ok millert@
|
|
is nfs mounted, i.e. install is running on a diskless machine.
ok millert@
|
|
|
|
a) Add /var/run to the filesystem created when the installation media
boots. This allows the creation and use of the dhclient.pid file.
Synchronize all mtree.conf files in architectures using miniroot.
b) Rework the traps used in upgrade.sh and install.sh so that HUP,
INT, QUIT, TERM and EXIT all invoke a cleanup function that kills an
active dhclient, unmounts all filesystems and fsck's -p all devices
in /etc/fstab, or just /mnt if /etc/fstab is not present.
c) Make sure the actions of the cleanup function are visible, thus
eliminating the long delay with no feedback at the end of the
upgrade/install script, after the congratulatory message.
d) Reduce manual parsing of fstab files by using umount -a to
unmount all mounted filesystems.
e) Since the new cleanup function tries to unmount all filesystems,
use the presence of /etc/fstab, rather than a difference between
`df /` and `df /mnt`, to determine if an install is being restarted
in a state where disk initialization can be skipped.
f) Change munge_fs, check_fs, mount_fs, remount_fs so that they
all 'know' about /etc/fstab rather than passing the same
parameter in all the time.
g) Use input redirection on munge_fs to read correct file, rather
than passing a file name as a parameter.
h) Indent code for various smaller functions.
i) Eliminate some subshell usage to simplify code further.
j) Display pretty messages during fsck -p to clearly indicate success
or failure of fsck, rather than just dumping fsck output.
k) Always run mount_fs in install.sh, even if disk initialization is
being skipped, because the trap should have unmounted all filesystems
when the last run terminated.
ok weingart@ millert@
|
|
a) Indent encode_for_url() in install.sub with tabs not spaces
b) delete a couple of extra blank lines
c) delete a few unnecessary ';'s at the end of lines
d) delete a few unnecessary '"'s around values assigned to resp (e.g.
'resp="X"' to 'resp=X'
|
|
trailing spaces during install.
Do not make the previously entered first password value the default
value if passwords do not match the first time.
Update Copyright (ok deraadt@).
|
|
comments that, being on the end of code lines, cannot be stripped
automatically.
Just delete unhelpful ones, and move the rest onto separate lines
where they can be stripped.
Also remove a duplicated initialization of ROOTDISK.
In total, reduces script size on floppy by 1117 bytes, making room
for coming improvements.
|