Lots of third party programs declare
[dragonfly.git] / sbin / newbtconf / newbtconf.8
1 .\"     $NetBSD: newbtconf.8,v 1.18 2004/08/31 17:08:06 uwe Exp $
2 .\"     $DragonFly: src/sbin/newbtconf/newbtconf.8,v 1.1 2005/05/16 20:57:31 rob 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
46 is used to set up the system in such a way that the user is offered a
47 selection of environments in which to boot the system up into.
48 The most obvious application being for laptops to provide a network
49 and non-network environment after a successful boot into multi-user mode.
50 .Ss Background
51 In order to accomplish this task, the files usually associated with
52 establishing the current system's running configuration are replaced with
53 symbolic links which are adjusted with each boot to point to the appropriate
54 file for the desired run-time environment.
55 This is accomplished by directing all of the symbolic links through a
56 directory which itself is a symbolic link
57 .Pq Pa /etc/etc.current ,
58 to the destination files.
59 At each bootup, the selection made changes which directory
60 .Pa /etc/etc.current
61 points to.
62 .Pp
63 Through doing this and reloading
64 .Pa /etc/rc.conf
65 in
66 .Pa /etc/rc
67 after the link has
68 been established, the resulting run-time configuration is effectively
69 controlled without the need to directly edit any files.
70 The default boot-up environment is selected by manually directing which
71 configuration directory
72 .Pa /etc/etc.default
73 points to.
74 As opposed to
75 .Pa /etc/etc.current
76 (which is updated
77 with every boot),
78 .Pa /etc/etc.default
79 is not automatically updated.
80 .Ss Getting Started
81 By default,
82 .Nx
83 only has one boot-up configuration - that set in the
84 file
85 .Pa /etc/rc.conf .
86 In order to initialize the system for operating in a
87 manner which supports multiple boot configurations,
88 .Nm
89 must be run with an argument of
90 .Sq init .
91 This will create two symbolic links
92 .Pa /etc/etc.current
93 and
94 .Pa /etc/etc.default
95 to the directory
96 .Pa /etc/etc.network .
97 The following files are all moved into
98 that directory and symbolic links put in their place, in
99 .Pa /etc ,
100 pointing to
101 .Pa /etc/etc.current/\*[Lt]filename\*[Gt] :
102 .Bd -literal -offset indent
103 /etc/defaultdomain
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/ntp.conf
113 /etc/rc.conf
114 /etc/rc.conf.d
115 /etc/resolv.conf
116 .Ed
117 .Pp
118 To test that this has been performed correctly, reboot your system into
119 .Nx .
120 After the kernel has autoconfigured and tty flags have been set,
121 a prompt should appear, preceded by the following like, looking like this:
122 .Bd -literal
123 [network]
124 Which configuration [network] ?
125 .Ed
126 .Pp
127 The []'s are used to indicate the default configuration, which can be
128 selected by just pressing return.
129 If there were other configurations available at this stage, you would
130 have 30 seconds to enter that name and press
131 .Sy RETURN .
132 .Ss Multiple Configurations
133 Once an initial configuration has been set up, we can proceed to set up further
134 run time environments.
135 This is done by invoking
136 .Nm
137 with the name of the new configuration to be created.
138 By default, this step
139 will use the current configuration files as the basis for this setup unless
140 a second parameter is given - that of the configuration to use as the basis
141 for the new one.
142 Upon completion, a new directory,
143 .Pa /etc/etc.\*[Lt]newname\*[Gt] ,
144 will have been created,
145 priming the directory with the appropriate files for editing.
146 For example, if we do
147 .Nm
148 .Ar nonet network
149 it would create a directory named
150 .Pa /etc/etc.nonet
151 and copy all the files from
152 .Pa /etc/etc.network
153 into that directory.
154 Upon rebooting, we should see:
155 .Bd -literal
156 [network] nonet
157 Which configuration [network] ?
158 .Ed
159 .Pp
160 To set up the system for booting into the
161 .Dq nonet
162 configuration, the files in
163 .Pa /etc/etc.nonet
164 need be edited.
165 .Pp
166 If you wanted to make
167 .Dq nonet
168 the default configuration when booting, you
169 would need delete the symbolic link
170 .Pa /etc/etc.default
171 and create a new symbolic link (with the same name) to
172 .Pa /etc/etc.nonet .
173 Booting up after having made such a change would
174 result in the following being displayed:
175 .Bd -literal
176 network [nonet]
177 Which configuration [nonet] ?
178 .Ed
179 .Ss \&No Network
180 Assuming that we performed the above command successfully, in order to
181 successfully configure
182 .Nx
183 to not configure interfaces (or generate no
184 errors from attempting to do so), the following settings (at least) should
185 be used in
186 .Pa /etc/etc.nonet/rc.conf :
187 .Bd -literal
188 auto_ifconfig=NO
189 net_interfaces=NO
190 .Ed
191 .Pp
192 Of course other networking services, such as NTP, routed, etc, are all
193 expected to be
194 .Dq NO .
195 In general, the only setting that should be
196 .Dq YES
197 is syslogd, and perhaps cron (if your cron scripts don't
198 need the network) or screenblank/wscons (if applicable).
199 Other actions such as deleting any NFS mounts from
200 .Pa /etc/etc.nonet/fstab
201 would also need to be undertaken.
202 .Ss Reverting multiple boot configurations
203 Multiple boot configurations can be deactivated by running
204 .Nm
205 with an argument of
206 .Cm revert .
207 All the symlinks mentioned above are then removed and the files they point to
208 are copied to their default place.
209 This effectively makes the currently selected
210 configuration the only one active.
211 The symbolic links
212 .Pa /etc/etc.current
213 and
214 .Pa /etc/etc.default
215 are also removed so upon rebooting no configuration selection menu is
216 displayed.
217 Note that the previously created configurations (in
218 .Pa /etc/etc.\*[Lt]name\*[Gt] )
219 are not removed.
220 .Sh FILES
221 .Bl -tag -width /etc/mrouted.current -compact
222 .It Pa /etc/etc.current
223 Symbolic link to current config directory.
224 .It Pa /etc/etc.default
225 Symbolic link to default config directory.
226 .Pp
227 .It Pa /etc/defaultdomain
228 These files all become symbolic links.
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/ntp.conf
238 .It Pa /etc/rc.conf
239 .It Pa /etc/rc.conf.d
240 .It Pa /etc/resolv.conf
241 .El
242 .Sh SEE ALSO
243 .Xr rc.conf 5 ,
244 .Xr rc 8
245 .Sh HISTORY
246 The
247 .Nm
248 program first appeared in
249 .Nx 1.5 .
250 .Sh AUTHORS
251 This shell script was written by
252 .An Darren Reed
253 .Aq darrenr@NetBSD.org
254 with initial input from
255 .An Matthew Green
256 .Aq mrg@NetBSD.org
257 on how to approach this problem.
258 .Sh BUGS
259 It presently does not display a count down timer whilst waiting for input
260 to select which configuration and nor does it abort said timer when a key
261 is first pressed.
262 .Pp
263 The management of the overall collection of multiple configurations is much
264 more manual than it ought to be.
265 A general system configuration tool needs to be written to ease their
266 management.