1.\" $NetBSD: newbtconf.8,v 1.8 2002/02/08 01:30:45 ross 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 49In order to accomplish this task, the files usually associated with 50establishing the current system's running configuration are replaced with 51symbolic links which are adjusted with each boot to point to the appropriate 52file for the desired run-time environment. 53This is accomplished by directing all of the symbolic links through a 54directory which itself is a symbolic link 55.Pa ( /etc/etc.current ) , 56to the destination files. 57At each bootup, the selection made changes which directory 58.Pa /etc/etc.current 59points to. 60.Pp 61Through doing this and reloading 62.Pa /etc/rc.conf 63in 64.Pa /etc/rc 65after the link has 66been established, the resulting run-time configuration is effectively 67controlled without the need to directly edit any files. 68The default boot-up environment is selected by manually directing which 69configuration directory 70.Pa /etc/etc.default 71points to. 72As opposed to 73.Pa /etc/etc.current 74(which is updated 75with every boot), 76.Pa /etc/etc.default 77is not automatically updated. 78.Ss Getting Started 79By default, 80.Nx 81only 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/\*[Lt]filename\*[Gt] : 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 115.Nx . 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 129Once an initial configuration has been setup, we can proceed to setup further 130run time environments. 131This is done by invoking 132.Nm 133with the name of the new configuration to be created. 134By default, this step 135will use the current configuration files as the basis for this setup unless 136a second parameter is given - that of the configuration to use as the basis 137for the new one. 138Upon completion, a new directory, 139.Pa /etc/etc.\*[Lt]newname\*[Gt] , 140will have been created, 141priming the directory with the appropriate files for editing. 142For example, if we do 143.Nm 144\fInonet\fP \fInetwork\fP it would create a directory named 145.Pa /etc/etc.nonet 146and copy all the files from 147.Pa /etc/etc.network 148into that directory. 149Upon rebooting, we should see: 150.Bd -literal 151[network] nonet 152Which configuration [network] ? 153.Ed 154.Pp 155To setup the system for booting into the "nonet" configuration, the files 156in 157.Pa /etc/etc.nonet 158need be edited. 159.Pp 160If you wanted to make "nonet" the default configuration when booting, you 161would need delete the symbolic link 162.Pa /etc/etc.default 163and create a new symbolic link (with the same name) to 164.Pa /etc/etc.nonet . 165Booting up after having made such a change would 166result in the following being displayed: 167.Bd -literal 168network [nonet] 169Which configuration [nonet] ? 170.Ed 171.Ss No Network 172Assuming that we performed the above command successfully, in order to 173successfully configure 174.Nx 175to not configure interfaces (or generate no 176errors from attempting to do so), the following settings (at least) should 177be used in 178.Pa /etc/etc.nonet/rc.conf : 179.Bd -literal 180auto_ifconfig=NO 181net_interfaces=NO 182.Ed 183.Pp 184Of course other networking services, such as NTP, routed, etc, are all 185expected to be "NO". 186In general, the only settings which should be "YES" are syslogd and 187update, with perhaps cron (if your cron scripts don't need the network) 188and screenblank/wscons (if applicable). 189Other actions such as deleting any NFS mounts from 190.Pa /etc/etc.nonet/fstab 191would also need to be undertaken. 192.El 193.Sh FILES 194.Bl -tag -width /etc/mrouted.current -compact 195.It Pa /etc/etc.current 196Symbolic link to current config directory. 197.It Pa /etc/etc.default 198Symbolic link to default config directory. 199.Pp 200.It Pa /etc/defaultdomain 201These files all become symbolic links. 202.It Pa /etc/fstab 203.It Pa /etc/ifconfig.* 204.It Pa /etc/inetd.conf 205.It Pa /etc/mrouted.conf 206.It Pa /etc/mygate 207.It Pa /etc/myname 208.It Pa /etc/netstart 209.It Pa /etc/nsswitch.conf 210.It Pa /etc/ntp.conf 211.It Pa /etc/rc.conf 212.It Pa /etc/rc.conf.d 213.It Pa /etc/resolv.conf 214.El 215.Sh SEE ALSO 216.Xr rc.conf 5 , 217.Xr rc 8 218.Sh HISTORY 219The 220.Nm 221program first appeared in 222.Nx 1.5 . 223.Sh AUTHORS 224This shell script was written by Darren Reed \*[Lt]darrenr@netbsd.org\*[Gt] with 225initial input from Matthew Green \*[Lt]mrg@netbsd.org\*[Gt] on how to approach this 226problem. 227.Sh BUGS 228It presently does not display a count down timer whilst waiting for input 229to select which configuration and nor does it abort said timer when a key 230is first pressed. 231.Pp 232The management of the overall collection of multiple configurations is much 233more manual than it ought to be. 234A general system configuration tool needs to be written to ease their 235management. 236