2003-02-14 19:21:47 +03:00
|
|
|
.\" $NetBSD: newbtconf.8,v 1.14 2003/02/14 16:21:48 grant Exp $
|
1999-10-05 15:22:43 +04:00
|
|
|
.\"
|
2000-08-22 16:06:46 +04:00
|
|
|
.\" Copyright (c) 1999 Darren Reed. All rights reserved.
|
1999-10-05 15:22:43 +04:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. Neither the name of the author nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2003-01-06 14:37:19 +03:00
|
|
|
.Dd January 6, 2003
|
2000-08-22 16:06:46 +04:00
|
|
|
.Dt NEWBTCONF 8
|
1999-10-05 15:22:43 +04:00
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm newbtconf
|
|
|
|
.Nd multiple boot-up configurations
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Ar new-conf-name
|
|
|
|
.Op Ar orig-conf-name
|
|
|
|
.Nm ""
|
2003-01-06 14:37:19 +03:00
|
|
|
.Cm init
|
2003-01-06 03:31:49 +03:00
|
|
|
.Nm ""
|
2003-01-06 14:37:19 +03:00
|
|
|
.Cm revert
|
1999-10-05 15:22:43 +04:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.Nm
|
|
|
|
is used to setup the system in such a way that the user is offered a
|
2000-08-22 16:06:46 +04:00
|
|
|
selection of environments in which to boot the system up into.
|
|
|
|
The most obvious application being for laptops to provide a network
|
|
|
|
and non-network environment after a successful boot into multi-user mode.
|
|
|
|
.Ss Background
|
1999-10-05 15:22:43 +04:00
|
|
|
In order to accomplish this task, the files usually associated with
|
|
|
|
establishing the current system's running configuration are replaced with
|
|
|
|
symbolic links which are adjusted with each boot to point to the appropriate
|
2000-08-22 16:06:46 +04:00
|
|
|
file for the desired run-time environment.
|
|
|
|
This is accomplished by directing all of the symbolic links through a
|
|
|
|
directory which itself is a symbolic link
|
2002-10-01 18:36:21 +04:00
|
|
|
.Pq Pa /etc/etc.current ,
|
2000-08-22 16:06:46 +04:00
|
|
|
to the destination files.
|
1999-10-05 15:22:43 +04:00
|
|
|
At each bootup, the selection made changes which directory
|
|
|
|
.Pa /etc/etc.current
|
|
|
|
points to.
|
|
|
|
.Pp
|
2000-08-22 16:06:46 +04:00
|
|
|
Through doing this and reloading
|
1999-10-05 15:22:43 +04:00
|
|
|
.Pa /etc/rc.conf
|
|
|
|
in
|
2000-08-26 17:45:20 +04:00
|
|
|
.Pa /etc/rc
|
|
|
|
after the link has
|
1999-10-05 15:22:43 +04:00
|
|
|
been established, the resulting run-time configuration is effectively
|
2000-08-22 16:06:46 +04:00
|
|
|
controlled without the need to directly edit any files.
|
|
|
|
The default boot-up environment is selected by manually directing which
|
|
|
|
configuration directory
|
1999-10-05 15:22:43 +04:00
|
|
|
.Pa /etc/etc.default
|
2000-08-22 16:06:46 +04:00
|
|
|
points to.
|
|
|
|
As opposed to
|
1999-10-05 15:22:43 +04:00
|
|
|
.Pa /etc/etc.current
|
|
|
|
(which is updated
|
|
|
|
with every boot),
|
|
|
|
.Pa /etc/etc.default
|
|
|
|
is not automatically updated.
|
2000-08-22 16:06:46 +04:00
|
|
|
.Ss Getting Started
|
2001-11-16 15:03:54 +03:00
|
|
|
By default,
|
|
|
|
.Nx
|
|
|
|
only has one boot-up configuration - that set in the
|
1999-10-05 15:22:43 +04:00
|
|
|
file
|
2000-08-26 17:45:20 +04:00
|
|
|
.Pa /etc/rc.conf .
|
1999-10-05 15:22:43 +04:00
|
|
|
In order to initialize the system for operating in a
|
|
|
|
manner which supports multiple boot configurations,
|
|
|
|
.Nm
|
2000-08-22 16:06:46 +04:00
|
|
|
must be run with an argument of
|
|
|
|
.Sq init .
|
2002-11-21 21:12:15 +03:00
|
|
|
This will create two symbolic links
|
1999-10-05 15:22:43 +04:00
|
|
|
.Pa /etc/etc.current
|
|
|
|
and
|
2001-04-03 15:09:01 +04:00
|
|
|
.Pa /etc/etc.default
|
1999-10-05 15:22:43 +04:00
|
|
|
to the directory
|
2000-08-22 16:06:46 +04:00
|
|
|
.Pa /etc/etc.network .
|
1999-10-05 15:22:43 +04:00
|
|
|
The following files are all moved into
|
2002-10-01 18:36:21 +04:00
|
|
|
that directory and symbolic links put in their place, in
|
|
|
|
.Pa /etc ,
|
|
|
|
pointing to
|
2002-02-08 04:21:55 +03:00
|
|
|
.Pa /etc/etc.current/\*[Lt]filename\*[Gt] :
|
2000-08-22 16:06:46 +04:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/etc/defaultdomain
|
1999-10-05 15:22:43 +04:00
|
|
|
/etc/fstab
|
|
|
|
/etc/ifconfig.*
|
2000-08-22 16:06:46 +04:00
|
|
|
/etc/inetd.conf
|
|
|
|
/etc/mrouted.conf
|
|
|
|
/etc/mygate
|
|
|
|
/etc/myname
|
|
|
|
/etc/netstart
|
1999-10-05 15:22:43 +04:00
|
|
|
/etc/nsswitch.conf
|
2000-08-22 16:06:46 +04:00
|
|
|
/etc/ntp.conf
|
|
|
|
/etc/rc.conf
|
|
|
|
/etc/rc.conf.d
|
|
|
|
/etc/resolv.conf
|
1999-10-05 15:22:43 +04:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
To test that this has been performed correctly, reboot your system into
|
2001-11-16 15:03:54 +03:00
|
|
|
.Nx .
|
2000-08-22 16:06:46 +04:00
|
|
|
After the kernel has autoconfigured and tty flags have been set,
|
2001-08-20 16:00:46 +04:00
|
|
|
a prompt should appear, preceded by the following like, looking like this:
|
1999-10-05 15:22:43 +04:00
|
|
|
.Bd -literal
|
|
|
|
[network]
|
|
|
|
Which configuration [network] ?
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The []'s are used to indicate the default configuration, which can be
|
2000-08-22 16:06:46 +04:00
|
|
|
selected by just pressing return.
|
|
|
|
If there were other configurations available at this stage, you would
|
|
|
|
have 30 seconds to enter that name and press
|
|
|
|
.Sy RETURN .
|
|
|
|
.Ss Multiple Configurations
|
1999-10-05 15:22:43 +04:00
|
|
|
Once an initial configuration has been setup, we can proceed to setup further
|
2000-08-22 16:06:46 +04:00
|
|
|
run time environments.
|
|
|
|
This is done by invoking
|
1999-10-05 15:22:43 +04:00
|
|
|
.Nm
|
2000-08-22 16:06:46 +04:00
|
|
|
with the name of the new configuration to be created.
|
|
|
|
By default, this step
|
1999-10-05 15:22:43 +04:00
|
|
|
will use the current configuration files as the basis for this setup unless
|
|
|
|
a second parameter is given - that of the configuration to use as the basis
|
2000-08-22 16:06:46 +04:00
|
|
|
for the new one.
|
2000-08-26 17:45:20 +04:00
|
|
|
Upon completion, a new directory,
|
2002-02-08 04:21:55 +03:00
|
|
|
.Pa /etc/etc.\*[Lt]newname\*[Gt] ,
|
2000-08-26 17:45:20 +04:00
|
|
|
will have been created,
|
|
|
|
priming the directory with the appropriate files for editing.
|
2000-08-22 16:06:46 +04:00
|
|
|
For example, if we do
|
1999-10-05 15:22:43 +04:00
|
|
|
.Nm
|
2003-01-06 14:37:19 +03:00
|
|
|
.Ar nonet network
|
|
|
|
it would create a directory named
|
2000-08-26 17:45:20 +04:00
|
|
|
.Pa /etc/etc.nonet
|
1999-10-05 15:22:43 +04:00
|
|
|
and copy all the files from
|
|
|
|
.Pa /etc/etc.network
|
2000-08-22 16:06:46 +04:00
|
|
|
into that directory.
|
|
|
|
Upon rebooting, we should see:
|
1999-10-05 15:22:43 +04:00
|
|
|
.Bd -literal
|
|
|
|
[network] nonet
|
|
|
|
Which configuration [network] ?
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-10-01 18:36:21 +04:00
|
|
|
To setup the system for booting into the
|
|
|
|
.Dq nonet
|
|
|
|
configuration, the files in
|
2000-08-26 17:45:20 +04:00
|
|
|
.Pa /etc/etc.nonet
|
|
|
|
need be edited.
|
1999-10-05 15:22:43 +04:00
|
|
|
.Pp
|
2002-10-01 18:36:21 +04:00
|
|
|
If you wanted to make
|
|
|
|
.Dq nonet
|
|
|
|
the default configuration when booting, you
|
1999-10-05 15:22:43 +04:00
|
|
|
would need delete the symbolic link
|
|
|
|
.Pa /etc/etc.default
|
|
|
|
and create a new symbolic link (with the same name) to
|
2000-08-26 17:45:20 +04:00
|
|
|
.Pa /etc/etc.nonet .
|
1999-10-05 15:22:43 +04:00
|
|
|
Booting up after having made such a change would
|
|
|
|
result in the following being displayed:
|
|
|
|
.Bd -literal
|
|
|
|
network [nonet]
|
|
|
|
Which configuration [nonet] ?
|
|
|
|
.Ed
|
2000-08-22 16:06:46 +04:00
|
|
|
.Ss No Network
|
1999-10-05 15:22:43 +04:00
|
|
|
Assuming that we performed the above command successfully, in order to
|
2001-11-16 15:03:54 +03:00
|
|
|
successfully configure
|
|
|
|
.Nx
|
|
|
|
to not configure interfaces (or generate no
|
1999-10-05 15:22:43 +04:00
|
|
|
errors from attempting to do so), the following settings (at least) should
|
|
|
|
be used in
|
2000-08-22 16:06:46 +04:00
|
|
|
.Pa /etc/etc.nonet/rc.conf :
|
1999-10-05 15:22:43 +04:00
|
|
|
.Bd -literal
|
|
|
|
auto_ifconfig=NO
|
|
|
|
net_interfaces=NO
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Of course other networking services, such as NTP, routed, etc, are all
|
2002-10-01 18:36:21 +04:00
|
|
|
expected to be
|
|
|
|
.Dq NO .
|
2002-12-16 13:32:16 +03:00
|
|
|
In general, the only setting that should be
|
2002-10-01 18:36:21 +04:00
|
|
|
.Dq YES
|
2002-12-16 13:32:16 +03:00
|
|
|
is syslogd, and perhaps cron (if your cron scripts don't
|
|
|
|
need the network) or screenblank/wscons (if applicable).
|
2000-08-22 16:06:46 +04:00
|
|
|
Other actions such as deleting any NFS mounts from
|
1999-10-05 15:22:43 +04:00
|
|
|
.Pa /etc/etc.nonet/fstab
|
|
|
|
would also need to be undertaken.
|
2003-01-06 03:31:49 +03:00
|
|
|
.Ss Reverting multiple boot configurations
|
|
|
|
Multiple boot configurations can be deactivated by running
|
|
|
|
.Nm
|
|
|
|
with an argument of
|
2003-01-06 14:37:19 +03:00
|
|
|
.Cm revert .
|
2003-01-06 03:31:49 +03:00
|
|
|
All the symlinks mentioned above are then removed and the files they point to
|
2003-01-06 14:37:19 +03:00
|
|
|
are copied to their default place.
|
|
|
|
This effectively makes the currently selected
|
|
|
|
configuration the only one active.
|
|
|
|
The symbolic links
|
2003-01-06 03:31:49 +03:00
|
|
|
.Pa /etc/etc.current
|
|
|
|
and
|
|
|
|
.Pa /etc/etc.default
|
2003-01-06 14:37:19 +03:00
|
|
|
are also removed so upon rebooting no configuration selection menu is
|
|
|
|
displayed.
|
|
|
|
Note that the previously created configurations (in
|
2003-01-06 03:31:49 +03:00
|
|
|
.Pa /etc/etc.\*[Lt]name\*[Gt] )
|
|
|
|
are not removed.
|
1999-10-05 15:22:43 +04:00
|
|
|
.El
|
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /etc/mrouted.current -compact
|
|
|
|
.It Pa /etc/etc.current
|
2000-08-22 16:06:46 +04:00
|
|
|
Symbolic link to current config directory.
|
1999-10-05 15:22:43 +04:00
|
|
|
.It Pa /etc/etc.default
|
2000-08-22 16:06:46 +04:00
|
|
|
Symbolic link to default config directory.
|
|
|
|
.Pp
|
|
|
|
.It Pa /etc/defaultdomain
|
1999-10-05 15:22:43 +04:00
|
|
|
These files all become symbolic links.
|
2000-08-22 16:06:46 +04:00
|
|
|
.It Pa /etc/fstab
|
1999-10-05 15:22:43 +04:00
|
|
|
.It Pa /etc/ifconfig.*
|
2000-08-22 16:06:46 +04:00
|
|
|
.It Pa /etc/inetd.conf
|
1999-10-05 15:22:43 +04:00
|
|
|
.It Pa /etc/mrouted.conf
|
2000-08-22 16:06:46 +04:00
|
|
|
.It Pa /etc/mygate
|
|
|
|
.It Pa /etc/myname
|
|
|
|
.It Pa /etc/netstart
|
|
|
|
.It Pa /etc/nsswitch.conf
|
1999-10-05 15:22:43 +04:00
|
|
|
.It Pa /etc/ntp.conf
|
2000-08-22 16:06:46 +04:00
|
|
|
.It Pa /etc/rc.conf
|
|
|
|
.It Pa /etc/rc.conf.d
|
|
|
|
.It Pa /etc/resolv.conf
|
1999-10-05 15:22:43 +04:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2001-04-03 15:09:01 +04:00
|
|
|
.Xr rc.conf 5 ,
|
1999-10-05 15:22:43 +04:00
|
|
|
.Xr rc 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2000-08-22 16:06:46 +04:00
|
|
|
program first appeared in
|
|
|
|
.Nx 1.5 .
|
2001-11-16 15:03:54 +03:00
|
|
|
.Sh AUTHORS
|
2003-02-14 19:21:47 +03:00
|
|
|
This shell script was written by
|
|
|
|
.An Darren Reed
|
|
|
|
.Aq darrenr@NetBSD.org
|
|
|
|
with initial input from
|
|
|
|
.An Matthew Green
|
|
|
|
.Aq mrg@NetBSD.org
|
2002-10-01 18:36:21 +04:00
|
|
|
on how to approach this problem.
|
1999-10-05 15:22:43 +04:00
|
|
|
.Sh BUGS
|
|
|
|
It presently does not display a count down timer whilst waiting for input
|
|
|
|
to select which configuration and nor does it abort said timer when a key
|
|
|
|
is first pressed.
|
|
|
|
.Pp
|
|
|
|
The management of the overall collection of multiple configurations is much
|
2000-08-22 16:06:46 +04:00
|
|
|
more manual than it ought to be.
|
|
|
|
A general system configuration tool needs to be written to ease their
|
|
|
|
management.
|