a193b313cc887d876cab41e49d6af2a65d1d0198
[feed/routing.git] / nodogsplash / files / nodogsplash.migrate
1 #!/bin/sh
2
3 . /lib/functions.sh
4
5 add_uci_default() {
6 local disabled=$1
7
8 # add default configuration
9 uci batch <<EOF
10 add nodogsplash instance
11 set nodogsplash.@instance[-1].network='lan'
12 set nodogsplash.@instance[-1].gatewayname='OpenWrt Nodogsplash'
13 set nodogsplash.@instance[-1].maxclients=250
14 set nodogsplash.@instance[-1].idletimeout=1200
15 set nodogsplash.@instance[-1].disabled=$disabled
16 add_list nodogsplash.@instance[-1].users_to_router='allow tcp port 22'
17 add_list nodogsplash.@instance[-1].users_to_router='allow tcp port 23'
18 add_list nodogsplash.@instance[-1].users_to_router='allow tcp port 53'
19 add_list nodogsplash.@instance[-1].users_to_router='allow udp port 53'
20 add_list nodogsplash.@instance[-1].users_to_router='allow udp port 67'
21 add_list nodogsplash.@instance[-1].users_to_router='allow tcp port 80'
22 add_list nodogsplash.@instance[-1].users_to_router='allow tcp port 443'
23 EOF
24
25 }
26
27 [ -e /etc/config/nodogsplash ] && exit 0
28
29 touch /etc/config/nodogsplash
30
31 # check if we have an old config
32 if [ -e "/etc/nodogsplash/nodogsplash.conf" ] ; then
33
34 uci batch <<EOF
35 add nodogsplash instance
36 set nodogsplash.@instance[-1].config='/etc/nodogsplash/nodogsplash.conf'
37 EOF
38
39 add_uci_default 1
40 else
41 add_uci_default 0
42 fi
43
44 exit 0