#!/bin/sh -e
#
# Test if the DHCP server is working.

if test -r /etc/debian-edu/config ; then
    . /etc/debian-edu/config
fi

# Only main-server and thin-client server profiles run dhcpd
if echo "$PROFILE" | egrep -q 'Main-Server|Thin-Client-Server' ; then
    :
else
    exit 0
fi

cfg=/etc/default/dhcp3-server

if [ -f $cfg ] ; then
    . $cfg
    echo "info: $0: configured interfaces is '$INTERFACES'"
else
    echo "error: $0: $cfg is missing."
    exit 1
fi

if pidof dhcpd3 > /dev/null ; then
    echo "success: $0: dhcpd3 is running."
else
    echo "error: $0: dhcpd3 is not running."
    exit 1
fi

exit 0
