#!/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/isc-dhcp-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 dhcpd > /dev/null ; then
    echo "success: $0: dhcpd is running."
else
    echo "error: $0: dhcpd is not running."
    exit 1
fi

exit 0
