#!/bin/sh
#
# $Id: whereami.network-hook,v 1.5 2006/11/12 00:39:14 andrew Exp $
#
# Hook for whereami to run when network is being brought up
# Andrew McMillan <awm@debian.org>
#
# Not a lot to do, AFAICS - just call whereami...
#
# Unless it is going to get really complicated we will use the same
# script in all situations, so we need the name we were called by.
# We only run in pre-up phase because that is where network detection
# generally needs to happen.  Possibly we could run something post-up
# but whereami ain't architected that way.
#

# Quit if we're called for the loopback
[ "$IFACE" = lo ] && exit 0

# Just exit if whereami is no longer installed
test ! -e /usr/sbin/whereami && exit 1

EXTRA_HINT=""
SITUATION=$(basename $(dirname "$0") .d)
if [ "$SITUATION" = "pre-up" ] ; then
  EXTRA_HINT=',netstart'
fi

# Can't use --syslog because syslog starts after the network (bug #160187)
/usr/sbin/whereami --run_from ${SITUATION} --hint "${SITUATION},${IFACE}${EXTRA_HINT}"

exit 0
