#!/bin/sh i like colors :)
#
# the following variables are available in the template:
#
# $INTERFACE_     (interface for the gateway)
# $SERVER_IP_     (ip for the dhcpd)
# $NETMASK_       (network mask)
# $NAMESERVERS_   (nameservers for the nodes)
# $IPRANGE_FROM_  (user configured iprange, first ip)
# $IPRANGE_TO_    (user configured iprange, last ip)
# $NETWORK_       (first ip in this subnet)
#
# NOTE:
# templates are shellscript fragments and will be sourced from grml-btnet
#
# GLOBAL_README_END

#
# this is the template to create the config file for the dhcpd server
#

date_=`execute date warn`

local T_dhcpd_config_nameserver_="`echo $NAMESERVERS_| tr -s ' ' |tr ' ' ','`"

cat >"$DHCPD_CONFIG_FILE_" <<EOT
# ${DHCPD_CONFIG_FILE_##/*/} for GRML btnet
# created on $date_
# THIS IS A GENERATED CONFIG FROM GRML-BTNET, DO NOT EDIT!!!
# better adapt $DHCPD_TEMPLATE_FILE to your needs

# global settings
default-lease-time 600;
max-lease-time 7200;

subnet $NETWORK_ netmask $NETMASK_ {
  range $IPRANGE_FROM_ $IPRANGE_TO_;
  option domain-name-servers $NAMESERVERS_;
  option routers $SERVER_IP_;
#  option broadcast-address 10.5.5.31;
#  option subnet-mask 255.255.255.0;
}

EOT

