#!/bin/sh

PATH=/bin:/usr/bin

if [ $# -lt 1 -o $# -gt 2 ]; then
    echo "usage: $0 resolve_ip [serve_ip]"
    exit 1
fi

resolve_ip=$1
serve_ip=$2

rm -rf @l_prefix@/var/djbdns/dnscache
@l_prefix@/sbin/dnscache-conf @l_rusr@ @l_rusr@ \
    @l_prefix@/var/djbdns/dnscache \
    $resolve_ip

if [ x"$serve_ip" != x ]; then
    rm -rf @l_prefix@/var/djbdns/tinydns
    @l_prefix@/sbin/tinydns-conf @l_rusr@ @l_rusr@ \
        @l_prefix@/var/djbdns/tinydns \
        $serve_ip

    rm -rf @l_prefix@/var/djbdns/axfrdns
    @l_prefix@/sbin/axfrdns-conf @l_rusr@ @l_rusr@ \
        @l_prefix@/var/djbdns/axfrdns \
        @l_prefix@/var/djbdns/tinydns \
        $serve_ip
fi
