contrib/meshwizard: Better formatting
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_dhcp.sh
1 #!/bin/sh
2 # Sets up the dhcp part of dnsmasq
3
4 . /etc/functions.sh
5 . $dir/functions.sh
6
7 net="$1"
8
9 handle_dnsmasq() {
10         config_get interface "$1" interface
11         if [ "$interface" == "${netrenamed}dhcp" ]; then
12                 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
13                         section_rename dhcp $1 ${netrenamed}dhcp
14                 fi
15         fi
16 }
17 config_load dhcp
18 config_foreach handle_dnsmasq dhcp
19
20 uci batch << EOF
21         set dhcp.${netrenamed}dhcp="dhcp"
22         set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp"
23 EOF
24
25 set_defaults "dhcp_" dhcp.${netrenamed}dhcp
26
27 uci_commitverbose "Setup DHCP for $netrenamed" dhcp
28