1.\" $NetBSD: newbtconf.8,v 1.6 2001/08/20 12:00:49 wiz 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 June 18, 2001 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.Li init 41.Sh DESCRIPTION 42.Bl -tag -width indent 43.Nm 44is used to setup the system in such a way that the user is offered a 45selection of environments in which to boot the system up into. 46The most obvious application being for laptops to provide a network 47and non-network environment after a successful boot into multi-user mode. 48.Ss Background 49.Pp 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.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 80.Pp 81By default, NetBSD only has one boot-up configuration - that set in the 82file 83.Pa /etc/rc.conf . 84In order to initialize the system for operating in a 85manner which supports multiple boot configurations, 86.Nm 87must be run with an argument of 88.Sq init . 89This will create two symbolic 90.Pa /etc/etc.current 91and 92.Pa /etc/etc.default 93to the directory 94.Pa /etc/etc.network . 95The following files are all moved into 96that directory and symbolic links put in their place, in /etc, pointing to 97.Pa /etc/etc.current/<filename> : 98.Bd -literal -offset indent 99/etc/defaultdomain 100/etc/fstab 101/etc/ifconfig.* 102/etc/inetd.conf 103/etc/mrouted.conf 104/etc/mygate 105/etc/myname 106/etc/netstart 107/etc/nsswitch.conf 108/etc/ntp.conf 109/etc/rc.conf 110/etc/rc.conf.d 111/etc/resolv.conf 112.Ed 113.Pp 114To test that this has been performed correctly, reboot your system into 115NetBSD. 116After the kernel has autoconfigured and tty flags have been set, 117a prompt should appear, preceded by the following like, looking like this: 118.Bd -literal 119[network] 120Which configuration [network] ? 121.Ed 122.Pp 123The []'s are used to indicate the default configuration, which can be 124selected by just pressing return. 125If there were other configurations available at this stage, you would 126have 30 seconds to enter that name and press 127.Sy RETURN . 128.Ss Multiple Configurations 129.Pp 130Once an initial configuration has been setup, we can proceed to setup further 131run time environments. 132This is done by invoking 133.Nm 134with the name of the new configuration to be created. 135By default, this step 136will use the current configuration files as the basis for this setup unless 137a second parameter is given - that of the configuration to use as the basis 138for the new one. 139Upon completion, a new directory, 140.Pa /etc/etc.<newname> , 141will have been created, 142priming the directory with the appropriate files for editing. 143For example, if we do 144.Nm 145\fInonet\fP \fInetwork\fP it would create a directory named 146.Pa /etc/etc.nonet 147and copy all the files from 148.Pa /etc/etc.network 149into that directory. 150Upon rebooting, we should see: 151.Bd -literal 152[network] nonet 153Which configuration [network] ? 154.Ed 155.Pp 156To setup the system for booting into the "nonet" configuration, the files 157in 158.Pa /etc/etc.nonet 159need be edited. 160.Pp 161If you wanted to make "nonet" the default configuration when booting, you 162would need delete the symbolic link 163.Pa /etc/etc.default 164and create a new symbolic link (with the same name) to 165.Pa /etc/etc.nonet . 166Booting up after having made such a change would 167result in the following being displayed: 168.Bd -literal 169network [nonet] 170Which configuration [nonet] ? 171.Ed 172.Ss No Network 173Assuming that we performed the above command successfully, in order to 174successfully configure NetBSD to not configure interfaces (or generate no 175errors from attempting to do so), the following settings (at least) should 176be used in 177.Pa /etc/etc.nonet/rc.conf : 178.Bd -literal 179auto_ifconfig=NO 180net_interfaces=NO 181.Ed 182.Pp 183Of course other networking services, such as NTP, routed, etc, are all 184expected to be "NO". 185In general, the only settings which should be "YES" are syslogd and 186update, with perhaps cron (if your cron scripts don't need the network) 187and screenblank/wscons (if applicable). 188Other actions such as deleting any NFS mounts from 189.Pa /etc/etc.nonet/fstab 190would also need to be undertaken. 191.El 192.Sh FILES 193.Bl -tag -width /etc/mrouted.current -compact 194.It Pa /etc/etc.current 195Symbolic link to current config directory. 196.It Pa /etc/etc.default 197Symbolic link to default config directory. 198.Pp 199.It Pa /etc/defaultdomain 200These files all become symbolic links. 201.It Pa /etc/fstab 202.It Pa /etc/ifconfig.* 203.It Pa /etc/inetd.conf 204.It Pa /etc/mrouted.conf 205.It Pa /etc/mygate 206.It Pa /etc/myname 207.It Pa /etc/netstart 208.It Pa /etc/nsswitch.conf 209.It Pa /etc/ntp.conf 210.It Pa /etc/rc.conf 211.It Pa /etc/rc.conf.d 212.It Pa /etc/resolv.conf 213.El 214.Sh SEE ALSO 215.Xr rc.conf 5 , 216.Xr rc 8 217.Sh HISTORY 218The 219.Nm 220program first appeared in 221.Nx 1.5 . 222.Sh BUGS 223.Pp 224It presently does not display a count down timer whilst waiting for input 225to select which configuration and nor does it abort said timer when a key 226is first pressed. 227.Pp 228The management of the overall collection of multiple configurations is much 229more manual than it ought to be. 230A general system configuration tool needs to be written to ease their 231management. 232.Sh AUTHORS 233This shell script was written by Darren Reed <darrenr@netbsd.org> with 234initial input from Matthew Green <mrg@netbsd.org> on how to approach this 235problem. 236