xref: /dragonfly/sbin/newbtconf/newbtconf.8 (revision 0bb9290e)
1.\"     $NetBSD: newbtconf.8,v 1.18 2004/08/31 17:08:06 uwe Exp $
2.\"	$DragonFly: src/sbin/newbtconf/newbtconf.8,v 1.3 2005/07/02 21:05:56 swildner Exp $
3.\"
4.\" Copyright (c) 1999 Darren Reed.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the author nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd January 6, 2003
31.Dt NEWBTCONF 8
32.Os
33.Sh NAME
34.Nm newbtconf
35.Nd multiple boot-up configurations
36.Sh SYNOPSIS
37.Nm
38.Ar new-conf-name
39.Op Ar orig-conf-name
40.Nm
41.Cm init
42.Nm
43.Cm revert
44.Sh DESCRIPTION
45.Nm
46is used to set up the system in such a way that the user is offered a
47selection of environments in which to boot the system up into.
48The most obvious application being for laptops to provide a network
49and non-network environment after a successful boot into multi-user mode.
50.Ss Background
51In order to accomplish this task, the files usually associated with
52establishing the current system's running configuration are replaced with
53symbolic links which are adjusted with each boot to point to the appropriate
54file for the desired run-time environment.
55This is accomplished by directing all of the symbolic links through a
56directory which itself is a symbolic link
57.Pq Pa /etc/etc.current ,
58to the destination files.
59At each bootup, the selection made changes which directory
60.Pa /etc/etc.current
61points to.
62.Pp
63Through doing this and reloading
64.Pa /etc/rc.conf
65in
66.Pa /etc/rc
67after the link has
68been established, the resulting run-time configuration is effectively
69controlled without the need to directly edit any files.
70The default boot-up environment is selected by manually directing which
71configuration directory
72.Pa /etc/etc.default
73points to.
74As opposed to
75.Pa /etc/etc.current
76(which is updated
77with every boot),
78.Pa /etc/etc.default
79is not automatically updated.
80.Ss Getting Started
81By default,
82.Dx
83only has one boot-up configuration - that set in the
84file
85.Pa /etc/rc.conf .
86In order to initialize the system for operating in a
87manner which supports multiple boot configurations,
88.Nm
89must be run with an argument of
90.Sq init .
91This will create two symbolic links
92.Pa /etc/etc.current
93and
94.Pa /etc/etc.default
95to the directory
96.Pa /etc/etc.network .
97The following files are all moved into
98that directory and symbolic links put in their place, in
99.Pa /etc ,
100pointing to
101.Pa /etc/etc.current/\*[Lt]filename\*[Gt] :
102.Bd -literal -offset indent
103/etc/defaultdomain
104/etc/dntpd.conf
105/etc/fstab
106/etc/ifconfig.*
107/etc/inetd.conf
108/etc/mrouted.conf
109/etc/mygate
110/etc/myname
111/etc/netstart
112/etc/nsswitch.conf
113/etc/ntpd.conf
114/etc/rc.conf
115/etc/rc.conf.d
116/etc/resolv.conf
117.Ed
118.Pp
119To test that this has been performed correctly, reboot your system into
120.Dx .
121After the kernel has autoconfigured and tty flags have been set,
122a prompt should appear, preceded by the following like, looking like this:
123.Bd -literal
124[network]
125Which configuration [network] ?
126.Ed
127.Pp
128The []'s are used to indicate the default configuration, which can be
129selected by just pressing return.
130If there were other configurations available at this stage, you would
131have 30 seconds to enter that name and press
132.Sy RETURN .
133.Ss Multiple Configurations
134Once an initial configuration has been set up, we can proceed to set up further
135run time environments.
136This is done by invoking
137.Nm
138with the name of the new configuration to be created.
139By default, this step
140will use the current configuration files as the basis for this setup unless
141a second parameter is given - that of the configuration to use as the basis
142for the new one.
143Upon completion, a new directory,
144.Pa /etc/etc.\*[Lt]newname\*[Gt] ,
145will have been created,
146priming the directory with the appropriate files for editing.
147For example, if we do
148.Nm
149.Ar nonet network
150it would create a directory named
151.Pa /etc/etc.nonet
152and copy all the files from
153.Pa /etc/etc.network
154into that directory.
155Upon rebooting, we should see:
156.Bd -literal
157[network] nonet
158Which configuration [network] ?
159.Ed
160.Pp
161To set up the system for booting into the
162.Dq nonet
163configuration, the files in
164.Pa /etc/etc.nonet
165need be edited.
166.Pp
167If you wanted to make
168.Dq nonet
169the default configuration when booting, you
170would need delete the symbolic link
171.Pa /etc/etc.default
172and create a new symbolic link (with the same name) to
173.Pa /etc/etc.nonet .
174Booting up after having made such a change would
175result in the following being displayed:
176.Bd -literal
177network [nonet]
178Which configuration [nonet] ?
179.Ed
180.Ss \&No Network
181Assuming that we performed the above command successfully, in order to
182successfully configure
183.Dx
184to not configure interfaces (or generate no
185errors from attempting to do so), the following settings (at least) should
186be used in
187.Pa /etc/etc.nonet/rc.conf :
188.Bd -literal
189auto_ifconfig=NO
190net_interfaces=NO
191.Ed
192.Pp
193Of course other networking services, such as NTP, routed, etc, are all
194expected to be
195.Dq NO .
196In general, the only setting that should be
197.Dq YES
198is syslogd, and perhaps cron (if your cron scripts don't
199need the network) or screenblank/wscons (if applicable).
200Other actions such as deleting any NFS mounts from
201.Pa /etc/etc.nonet/fstab
202would also need to be undertaken.
203.Ss Reverting multiple boot configurations
204Multiple boot configurations can be deactivated by running
205.Nm
206with an argument of
207.Cm revert .
208All the symlinks mentioned above are then removed and the files they point to
209are copied to their default place.
210This effectively makes the currently selected
211configuration the only one active.
212The symbolic links
213.Pa /etc/etc.current
214and
215.Pa /etc/etc.default
216are also removed so upon rebooting no configuration selection menu is
217displayed.
218Note that the previously created configurations (in
219.Pa /etc/etc.\*[Lt]name\*[Gt] )
220are not removed.
221.Sh FILES
222.Bl -tag -width /etc/mrouted.current -compact
223.It Pa /etc/etc.current
224Symbolic link to current config directory.
225.It Pa /etc/etc.default
226Symbolic link to default config directory.
227.Pp
228.It Pa /etc/defaultdomain
229These files all become symbolic links.
230.It Pa /etc/dntpd.conf
231.It Pa /etc/fstab
232.It Pa /etc/ifconfig.*
233.It Pa /etc/inetd.conf
234.It Pa /etc/mrouted.conf
235.It Pa /etc/mygate
236.It Pa /etc/myname
237.It Pa /etc/netstart
238.It Pa /etc/nsswitch.conf
239.It Pa /etc/ntpd.conf
240.It Pa /etc/rc.conf
241.It Pa /etc/rc.conf.d
242.It Pa /etc/resolv.conf
243.El
244.Sh SEE ALSO
245.Xr rc.conf 5 ,
246.Xr rc 8
247.Sh HISTORY
248The
249.Nm
250program first appeared in
251.Nx 1.5 .
252.Sh AUTHORS
253This shell script was written by
254.An Darren Reed
255.Aq darrenr@NetBSD.org
256with initial input from
257.An Matthew Green
258.Aq mrg@NetBSD.org
259on how to approach this problem.
260.Sh BUGS
261It presently does not display a count down timer whilst waiting for input
262to select which configuration and nor does it abort said timer when a key
263is first pressed.
264.Pp
265The management of the overall collection of multiple configurations is much
266more manual than it ought to be.
267A general system configuration tool needs to be written to ease their
268management.
269