#!/bin/sh

# Don't do anything for the lo interface
test "$IFACE" != lo || exit 0

# Only run from ifup
test "$MODE" = start || exit 0

# Only care about inet, inet6 and NetworkManager
case "$ADDRFAM" in
    inet|inet6|NetworkManager)
        ;;
    *)
        exit 0
esac

if [ -x /usr/bin/logger ]; then
    logger=logger
else
    logger=true
fi

$logger -t epoptes -p syslog.info "Running epoptes-client, IFACE=$IFACE, pid=$$"

if [ -x /sbin/ethtool ] && [ -f /etc/default/epoptes-client ]; then
    . /etc/default/epoptes-client
    if [ -n "$WOL" ]; then
        # $WOL is unquoted in case someone wants to add sopass
        ethtool -s "$IFACE" wol $WOL
    fi
fi

/usr/sbin/epoptes-client &
