| doc | ||
| examples | ||
| internal | ||
| .golangci.yml | ||
| go.mod | ||
| go.sum | ||
| LICENSE.txt | ||
| main.go | ||
| README.md | ||
| whereami.8 | ||
WHEREAMI 8 "August 2025" "local" "local system manager commands"
whereami - detect current network location and act upon it
SYNOPSIS
whereami [options] list|status|run|register [options]
DESCRIPTION
whereami tries to detect the current network (location). It does so by getting the MAC address of the current default gateway and stops/starts services according the location.
GLOBAL OPTIONS
The following options apply to all commands.
-root dir: The root directory for the links. Defaults to "/".
-verbose: Be more verbose about what's going on.
COMMANDS
The operational mode is selected by one of the following commands.
- list: List the available locations and exit.
- run: Switch the current location and exit. This command accepts the -force option.
- status: Show the current location (and the "running" one, if configured).
- register name: Register the current location for name. The configuration dir name must exist.
FILES
The static following layout is used:
/etc/whereami
├── ether:00:0D:B9:35:A3:60 -> office
├── ether:24:69:A5:D6:3C:B7 -> home
├── ip:1.1.1.1 -> home
├── ip:1.1.1.* -> home
├── home
│ ├── run.d
│ │ └── 00local
│ └── squid.conf
└── office
├── run.d
│ └── 00local
└── squid.conf
The runtime directory contains a symlink, e.g.:
/run/whereami -> /etc/whereami/home
And for specific configuration (as for squid in our example) we use
/etc/squid/local.conf -> /run/whereami/squid.conf
INSTALLATION
The whereami tool needs to be on any change in the network setup. For NetworkManager
a good place is /etc/NetworkManager/dispatcher.d/02local as
#!/bin/sh
exec systemctl-run --description "whereami for $1" whereami -v
AUTHOR
Heiko Schlittermann hs@schlittermann.de, https://schlittermann.de