# The detection configuration file for 'whereami'
#
# This file describes unique features of various environments you connect
# to and associates them with those locations.

# When a test is successful, no further tests will be conducted
# until a subsequent 'if' or 'fi' statement, or if the line is preceded
# by the word 'always'
#
# You may also set environment variables for the scripts (test and action)
# subsequently called by whereami using "set <varname> <value>".
#
# See "man 5 detect.conf" for lots more information, especially for the
# details of the helper scripts used here.
#

# It is a good idea to default to somewhere...
default undocked

# Test for the presence of an ethernet connection plugged into eth0
testmii eth0 lan

# Uncomment this for exhaustive debugging output
# set DEBUGWHEREAMI 1

# 'down' might be a location that is forced from the command line
# like "whereami down"
if down
  always at undocked
  always notat eth0,eth1
elif stop
  # Or maybe we can't remember the exact command, so we do it twice!
  # like "whereami stop" this time
  always at undocked
  always notat eth0,eth1
elif lan
  # If the testmii at the top was successful
  set INTERFACE eth0
  # testdhcp    '*.*.*.*'    dhcp
  # testarp     eth0,00:24:5e:17:12:11,10.2.0.4  morrinsville
  # testping    192.168.138.1,192.168.138.55     queenstown
  # testping    202.49.41.18,202.49.41.1         rotorua
else
  # If the testmii at the top failed
  # modprobe prism54 w_eth1
  # always modprobe orinoco w_eth1
  # always modprobe ath_pci atheros
  # always modprobe ipw2100 w_eth1
  # ... and we unload this in whereami.conf, if we don't find one,
  # in an attempt to minimise power, and RFI
fi

if w_eth1
  # Some wireless drivers use one interface name
  set INTERFACE eth1
  testap scan wlan
fi

if atheros
  # And some use a different one
  set INTERFACE ath0
  testap scan wlan
fi

# If we have found at least some WLAN APs in the vicinity, find out
# if we can do anything with any of them
if wlan
  # testap      milford,1234-5FED-CB                      milford,wdhcp
  # testap      wanaka,1234-2468-1357-dead-beef-feed-99  wanaka,wdhcp
  # testap      ruapehu                 ruapehu,wdhcp
  # # If there's anything there at all, try and DHCP off it
  # testap      .+                  wdhcp
  # # And if there isn't, we will indicate that.
  # notat  wlan,wdhcp
fi

# So it seems we should try and get DHCP off a WLAN AP
if wdhcp
  # testdhcp    '*.*.*.*'    dhcp
fi

# And if we have DHCP (wired or wireless) we want to make
# a decision as to which LAN that is, exactly.
if dhcp
  # testdhcp    192.168.5.*     waiheke
  # testdhcp    192.168.7.*     tauranga
  # testdhcp    192.168.10.*    wellington
  # testdhcp    192.168.55.3*   picton
  # # Note that we only get here, if the one above is _unsuccessful_
  # testdhcp    192.168.55.*    rakaia
fi

