<inttypes.h>: Small sync with FreeBSD.
[dragonfly.git] / sbin / newbtconf / newbtconf.8
blob23714cc87e1aba119a6d49c6a0df1dcda28802af
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 December 31, 2019
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
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/mygate
108 /etc/myname
109 /etc/netstart
110 /etc/nsswitch.conf
111 /etc/rc.conf
112 /etc/rc.conf.d
113 /etc/resolv.conf
116 To test that this has been performed correctly, reboot your system into
117 .Dx .
118 After the kernel has autoconfigured and tty flags have been set,
119 a prompt should appear, preceded by the following like, looking like this:
120 .Bd -literal
121 [network]
122 Which configuration [network] ?
125 The []'s are used to indicate the default configuration, which can be
126 selected by just pressing return.
127 If there were other configurations available at this stage, you would
128 have 30 seconds to enter that name and press
129 .Sy RETURN .
130 .Ss Multiple Configurations
131 Once an initial configuration has been set up, we can proceed to set up further
132 run time environments.
133 This is done by invoking
135 with the name of the new configuration to be created.
136 By default, this step
137 will use the current configuration files as the basis for this setup unless
138 a second parameter is given - that of the configuration to use as the basis
139 for the new one.
140 Upon completion, a new directory,
141 .Pa /etc/etc.\*[Lt]newname\*[Gt] ,
142 will have been created,
143 priming the directory with the appropriate files for editing.
144 For example, if we do
146 .Ar nonet network
147 it would create a directory named
148 .Pa /etc/etc.nonet
149 and copy all the files from
150 .Pa /etc/etc.network
151 into that directory.
152 Upon rebooting, we should see:
153 .Bd -literal
154 [network] nonet
155 Which configuration [network] ?
158 To set up the system for booting into the
159 .Dq nonet
160 configuration, the files in
161 .Pa /etc/etc.nonet
162 need be edited.
164 If you wanted to make
165 .Dq nonet
166 the default configuration when booting, you
167 would need delete the symbolic link
168 .Pa /etc/etc.default
169 and create a new symbolic link (with the same name) to
170 .Pa /etc/etc.nonet .
171 Booting up after having made such a change would
172 result in the following being displayed:
173 .Bd -literal
174 network [nonet]
175 Which configuration [nonet] ?
177 .Ss \&No Network
178 Assuming that we performed the above command successfully, in order to
179 successfully configure
181 to not configure interfaces (or generate no
182 errors from attempting to do so), the following settings (at least) should
183 be used in
184 .Pa /etc/etc.nonet/rc.conf :
185 .Bd -literal
186 auto_ifconfig=NO
187 net_interfaces=NO
190 Of course other networking services, such as NTP, routed, etc, are all
191 expected to be
192 .Dq NO .
193 In general, the only setting that should be
194 .Dq YES
195 is syslogd, and perhaps cron (if your cron scripts don't
196 need the network) or screenblank/wscons (if applicable).
197 Other actions such as deleting any NFS mounts from
198 .Pa /etc/etc.nonet/fstab
199 would also need to be undertaken.
200 .Ss Reverting multiple boot configurations
201 Multiple boot configurations can be deactivated by running
203 with an argument of
204 .Cm revert .
205 All the symlinks mentioned above are then removed and the files they point to
206 are copied to their default place.
207 This effectively makes the currently selected
208 configuration the only one active.
209 The symbolic links
210 .Pa /etc/etc.current
212 .Pa /etc/etc.default
213 are also removed so upon rebooting no configuration selection menu is
214 displayed.
215 Note that the previously created configurations (in
216 .Pa /etc/etc.\*[Lt]name\*[Gt] )
217 are not removed.
218 .Sh FILES
219 .Bl -tag -width ".Pa /etc/nsswitch.conf" -compact
220 .It Pa /etc/etc.current
221 Symbolic link to current config directory.
222 .It Pa /etc/etc.default
223 Symbolic link to default config directory.
225 .It Pa /etc/defaultdomain
226 These files all become symbolic links.
227 .It Pa /etc/dntpd.conf
228 .It Pa /etc/fstab
229 .It Pa /etc/ifconfig.*
230 .It Pa /etc/inetd.conf
231 .It Pa /etc/mygate
232 .It Pa /etc/myname
233 .It Pa /etc/netstart
234 .It Pa /etc/nsswitch.conf
235 .It Pa /etc/rc.conf
236 .It Pa /etc/rc.conf.d
237 .It Pa /etc/resolv.conf
239 .Sh SEE ALSO
240 .Xr rc.conf 5 ,
241 .Xr rc 8
242 .Sh HISTORY
245 program first appeared in
246 .Nx 1.5 .
247 .Sh AUTHORS
248 .An -nosplit
249 This shell script was written by
250 .An Darren Reed Aq Mt darrenr@NetBSD.org
251 with initial input from
252 .An Matthew Green Aq Mt mrg@NetBSD.org
253 on how to approach this problem.
254 .Sh BUGS
255 It presently does not display a count down timer whilst waiting for input
256 to select which configuration and nor does it abort said timer when a key
257 is first pressed.
259 The management of the overall collection of multiple configurations is much
260 more manual than it ought to be.
261 A general system configuration tool needs to be written to ease their
262 management.