#!/bin/sh

[ "$WRP_CFG" ] || . /etc/wrp.cfg

dev=""
for i in "$LOCAL_INTERFACES" "$EXTERN_INTERFACES"; do
    rng=`. /etc/wrp.cfg; $i; echo "$DHCP_RANGE"`
    dev=`. /etc/wrp.cfg; $i; echo "$DEVICE"`
    [ "$rng" ] && break
done

if [ -r /etc/dhcpd.conf ]; then
    echo -n "dhcpd starting..."
    /sbin/respawn 5 /sbin/dhcpd $dev
    echo " done!"
else
    echo "No dhcpd configuration."
fi

exit 0
