Release new version 0.105.0
[grml-terminalserver.git] / templates / dhcpd_config
1 # the following variables are available in the template:
2 #
3 # $INTERFACE_     (interface for the terminalserver)
4 # $IP_            (ip for the terminalserver to bind)
5 # $NETMASK_       (network mask)
6 # $GW_            (gateway)
7 # $NAMESERVERS_   (nameservers for the nodes)
8 # $IPRANGE_FROM_  (user configured iprange, first ip)
9 # $IPRANGE_TO_    (user configured iprange, last ip)
10 # $NETWORK_       (first ip in this subnet)
11 # $OPTIONS_       (options for grml-terminalserver)
12 # $BOOT_ARGS_     (boot arguments for the nodes)
13 #
14 # NOTE:
15 # templates are shellscript fragments and will be sourced from the
16 # terminalserver
17 #
18 # GLOBAL_README_END
19
20 #
21 # this is the template to create the config file for the dhcpd server
22 #
23
24 date_=`execute date warn`
25
26 # insert commas when having multiple nameservers
27 if [ -n "$NAMESERVERS_" ]; then
28         DNS_LINE_="option domain-name-servers $(echo "$NAMESERVERS_" | sed -e 's/\([0-9]\) \([0-9]\)/\1, \2/g');"
29 fi
30 # note: we don't support multiple routers options
31 if [ -n "$GW_" ]; then
32         ROUTERS_LINE_="option routers $GW_;"
33 fi
34
35 cat >"$DHCPD_CONFIG_FILE_" <<EOT
36 # ${DHCPD_CONFIG_FILE_##/*/} for GRML terminalserver
37 # created on $date_
38 # THIS IS A GENERATED CONFIG FROM GRML-TERMINALSERVER, DO NOT EDIT!!!
39 # better adapt $TEMPLATE_CONFIG_DIR_/dhcpd_config to your needs and update config
40 # with grml-terminalserver config dhcp
41 #
42 # If you really want to edit _this_ file remove the next line
43 # __PLEASE_UPDATE_THIS_FILE__
44
45 # global settings
46 allow booting;
47 allow bootp;
48 #option option-150 code 150 = text ;
49 #option T150 code 150 = string;
50 default-lease-time 600;
51 max-lease-time 7200;
52
53 subnet $NETWORK_ netmask $NETMASK_ {
54   next-server $IP_;
55   if substring (option vendor-class-identifier, 0, 9) = "Etherboot" { filename "etherboot.nbi"; }
56   else { filename "pxelinux.0"; }
57 #  option subnet-mask $NETMASK_;
58   range $IPRANGE_FROM_ $IPRANGE_TO_;
59   $ROUTERS_LINE_
60   $DNS_LINE_
61 #  option T150 "/menu.lst";
62 #  option option-150 "(nd)/menu.lst";
63 }
64
65 EOT
66