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