#!/bin/sh
tld=.example

mode=$1
ip=$2
name=$3$tld

filename="/etc/dnsmasq.d/wildcard-dhcp-$ip.conf"
echo $@ >> /tmp/log
if [ "$mode" == add ]; then
    echo "address=/.$name/$ip" > "$filename"
    /etc/init.d/dnsmasq restart &
elif [ "$mode" == del ]; then
    rm "$filename"
    /etc/init.d/dnsmasq restart &
fi
