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