afbe1d5dae1e73a6da9866276357051fc1261152
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_splash.sh
1 #!/bin/sh
2 # Setup_splash, takes 1 argument: 1=net
3
4 . /etc/functions.sh
5 . $dir/functions.sh
6
7 net=$1
8
9 if [ ! "$has_luci_splash" == TRUE ]; then
10         echo "    Luci Splash is not installed, skipping setup of it."
11         exit
12 fi
13
14 dhcprange=$(uci -q get meshwizard.netconfig.$net\_dhcprange)
15
16 if [ "$dhcp_range" == 1 ]; then
17         handle_splash() {
18                 config_get network "$1" network
19                 if [ "$network" == "${netrenamed}dhcp" ]; then
20                         if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
21                                 section_rename luci_splash $1 ${netrenamed}dhcp
22                         fi
23                 fi
24         }
25         config_load luci_splash
26         config_foreach handle_splash iface
27
28         uci set luci_splash.${netrenamed}dhcp="iface"
29         uci set luci_splash.${netrenamed}dhcp.network="${netrenamed}dhcp"
30         uci set luci_splash.${netrenamed}dhcp.zone="freifunk"
31
32         uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
33         /etc/init.d/luci_splash enable
34 fi
35