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