# whereami - Automatic Configuration Utility

## What?

whereami can automatically configure the system during boot, whenever a PCMCIA network card is inserted or removed, and whenever there is an APM event. It can:

- examine the system's network environment in order to detect the current location
- adapt the system configuration to that environment

Since this all happens on PCMCIA card removal or insertion (or whenever else you set it to happen), it should be easy to automate all the actions you would normally take when you arrive at a new location.

## Why?

I work at quite a variety of places. When I arrive at a new location I find it a pain if it takes me half a morning to get the network set up. Well, I could write scripts to tell my computer where I am, but that's no challenge!

So I like to have my computer automatically know where it is, set the mail relay, DNS forwarder and so forth automatically without me having to worry about it and I can concentrate on getting my job done :-)

Other considerations which have made me design this framework in this way include:

- easy extension to new situations
- easy to enhance functionality through new helper scripts
- a component-based framework which I (and others) can enhance piecemeal

## How?

whereami splits the problem of re-configuration into several parts:

- triggering of location detection
- detecting the current location
- adapting to the current location

### Triggering location detection

My feeling is that there are only a few times when a laptop might find itself in a new 'location': during the boot process, when a PCMCIA (network) card is inserted or removed and after waking up. whereami can run at any or all of these times, after basic hardware initialisation, to detect and configure the more high-level components of the system such as named and sendmail.

By default, whereami is run at boot time and on ifup.

whereami can also be run by the PCMCIA card manager, cardmgr, if the pcmcia-cs package is appropriately set up.

You can also configure whereami to run before APM suspend or after APM resume. This might be useful, for example, for configuring a built-in network adapter when one changes location. You can enable this by editing /etc/whereami/apm.conf.

### Detecting the current location

Location detection is configured by editing /etc/whereami/detect.conf. Here one specifies the unique characteristics of a location that can be discovered by performing tests.

Since version 1.0, whereami allows for one to be at multiple locations at the same time; for example, both 'docked' and 'atwork'.

Go here for full details of setting up location detection in whereami, or read the detect.conf(5) manual page.

### Adapting to the location

Once the current location has been detected, whereami performs actions that are specified for:

- when one 'leaves' a location
- when one 'arrives' at a location
- when one 'is at' a location

For full details of configuration actions, go here, or read the whereami.conf(5) manual page.

#### Overriding location detection

Sometimes it is desirable to tell whereami where we are rather than let it try to work it out. This can be used, e.g., to ensure that network drives are unmounted cleanly before going somewhere else. To override the location, give the name of the location as an argument to whereami:

          whereami <location>

For example, I often use "`whereami undocked`" when I am about to disconnect from my current network to ensure that all nfs drives are unmounted before the network is physically disconnected.

The whereami command accepts other options. Enter:

          whereami --help

or read the whereami(5) manual page for more information.

## Where?

Since version 0.8, whereami is included in Debian. E-Mail me if you would be interested in using this utility in other distributions, and if you are willing to be a guinea pig for me!

## Who?

whereami was written by Andrew McMillan, with contributions from various other users, most notably Chris Halls. See the AUTHORS file for full details.

Andrew's Linux Page | 'Whereami' home page | Location Detection | Actions | | © Andrew McMillan, 1999-2002 released under the GPL v2